Skip to content
Sharp

Advanced Python · interview question

What does a strong engineer do when reasoning through timing and audit scopes code?

Multiple choiceHardchapter-14-curatedpremiumadvanced-pythontiming-and-audit-scopes
python
import time

def timed(fn):
    def wrapper(*args, **kwargs):
        started = time.perf_counter()
        try:
            return fn(*args, **kwargs)
        finally:
            print(time.perf_counter() - started)
    return wrapper
Choose one answer
Answer and explanation

Correct answer

A. Narrate the data shape, the state changes, and the exact rule order step by step.

Why

Interviewers often use simple code to test whether you can reason through execution without bluffing.

Test yourself on Advanced Python

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

Start free test
All Advanced Python questions →