Computer Science I / Debugging Logic and State
Practice question · Multiple choice

Systematic debugging narrows down where the state first becomes wrong, rather than reading the code looking for the mistake. Why is bisecting the execution more reliable than inspecting the source?

Hints
  1. You wrote the code believing it was correct. What does re-reading it start from?
  2. Ask what evidence a printed value provides that reading cannot.
Show the answer

D. Because a bug is where your reading was wrong, so re-reading repeats it.

Why

You wrote the code believing it correct, so your reading already contains the error and re-reading begins from the same misunderstanding, which is why the bug is often obvious to someone else immediately. Checking actual state removes belief from the process, and each check halves the region. git bisect applies the identical logic to history.

Read the lesson: Debugging Logic and State →

Practise Debugging Logic and State

The app has 6 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Debugging Logic and State