Code Reading · interview question
A bug appears around dry runs and rule narration. What is the strongest first debugging move?
Multiple choiceHardchapter-2-curatedpremiumcode-readingdry-runs-and-rule-narration
def preview_shipping(subtotal: float) -> str:
if subtotal >= 100:
return "free shipping"
return "standard shipping"Answer and explanation
Correct answer
B. Trace one concrete example, inspect the state transitions, and compare them to the intended rule before rewriting anything.
Why
That approach is reliable because it creates evidence. Skipping narration hides misunderstandings until the wrong row or edge case appears.
Test yourself on Code Reading
A free test with instant, explained results. No account needed.
More Code Reading questions
- What production risk should you worry about most if dry runs and rule narration is handled lazily?
- Which option describes the most likely pitfall around dry runs and rule narration?
- A teammate submits shaky dry runs and rule narration code. Which review comment is the strongest?
- If you wrote a test around dry runs and rule narration, what should the test prove first?
- If dry runs and rule narration fails in production, what handling philosophy is strongest?
- Which judgment is strongest when choosing a data shape for dry runs and rule narration?