Code Reading · interview question
If you wrote a test around dry runs and rule narration, what should the test prove first?
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
A. That the rule behaves correctly at the boundary cases the lesson is trying to make explicit.
Why
Good tests make the design safer to change because they lock in the meaningful behavior rather than surface-level implementation details.
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?
- A bug appears around dry runs and rule narration. What is the strongest first debugging move?
- 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?