Skip to content
Sharp

Advanced Python · interview question

A teammate submits shaky resource cleanup code. Which review comment is the strongest?

Multiple choiceHardchapter-14-curatedpremiumadvanced-pythonresource-cleanup
Choose one answer
Answer and explanation

Correct answer

D. Make the rule clearer and easier to explain. Use context managers to guarantee cleanup around files, locks, and similar resources even when the body fails.

Why

The best review comment anchors the change to readability, correctness, and future maintenance. 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 →