Practice question · Select all that apply
Select every practice that the lesson recommends for debugging.
Hints
- One option is the named anti-pattern, not a recommendation.
- The lesson calls changing code at random 'shotgun debugging'.
Show the answer
- B. Narrow down where the state first becomes wrong
- C. Observe the actual values variables hold
- D. Reproduce the bug before trying to fix it
- E. Re-run the test suite after the fix to confirm nothing else broke
Why
Reproduce, observe, localize, and re-run after fixing are the recommended routine. Changing code randomly is 'shotgun debugging', the pitfall the lesson warns against, because it can hide a symptom without addressing the real cause.
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…
- Order the steps of the disciplined debugging routine.
- Systematic debugging narrows down where the state first becomes wrong, rather than reading the code looking…
- Sort each debugging action by whether it reasons from evidence or merely guesses.