Skip to content
Sharp

Advanced Python · interview question

A bug appears around resource cleanup. What is the strongest first debugging move?

Multiple choiceHardchapter-14-curatedpremiumadvanced-pythonresource-cleanup
python
with open("orders.csv", encoding="utf-8") as handle:
    print(handle.readline())
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. Forgetting cleanup tends to create slow, operationally messy bugs rather than immediate syntax errors.

Test yourself on Advanced Python

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

Start free test
All Advanced Python questions →