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
- You wrote the code believing it was correct. What does re-reading it start from?
- 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.
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
- A bug appears only in production, never locally, and disappears when logging is added. What class of bug does…
- Select every practice that the lesson recommends for debugging.
- Order the steps of the disciplined debugging routine.
- Sort each debugging action by whether it reasons from evidence or merely guesses.