Skip to content
Sharp

Exceptions · interview question

A bug appears around try and except. What is the strongest first debugging move?

Multiple choiceEasychapter-5-curatedpremiumexceptionstry-and-except
python
try:
    quantity = int("4")
except ValueError:
    quantity = 0
print(quantity)
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. Huge try blocks make it unclear which step actually failed and often catch more than intended.

Test yourself on Exceptions

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

Start free test
All Exceptions questions →