Skip to content
Sharp

Concurrency · interview question

What does a strong engineer do when reasoning through semaphores, timeouts, and cancellation code?

Multiple choiceMediumchapter-15-curatedpremiumconcurrencysemaphores-timeouts-and-cancellation
python
semaphore = asyncio.Semaphore(10)

async with semaphore:
    await asyncio.wait_for(fetch_order("ORD-1"), timeout=2.0)
Choose one answer
Answer and explanation

Correct answer

D. 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 Concurrency

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

Start free test
All Concurrency questions →