Skip to content
Sharp

Code Safety · interview question

A bug appears around mutation and copying. What is the strongest first debugging move?

Multiple choiceHardchapter-3-curatedpremiumcode-safetymutation-and-copying
python
defaults = {"currency": "USD"}
payload = defaults.copy()
payload["currency"] = "EUR"
print(defaults, payload)
Choose one answer
Answer and explanation

Correct answer

C. 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. Shared mutable structures make later behavior depend on hidden history.

Test yourself on Code Safety

A free test with instant, explained results. No account needed.

Start free test
All Code Safety questions →