Skip to content
Sharp

Concurrency basics · interview question

Why is using nested synchronized blocks with different locks risky in practice?

Multiple choiceEasychapter-15-curatedpremiumconcurrencysynchronized-and-locks
Choose one answer
Answer and explanation

Correct answer

D. Deadlock

Why

Nested synchronized blocks on different locks can lead to deadlocks if threads acquire the locks in different orders. This occurs when each thread is holding one lock and waiting for the other, causing a permanent block.

Test yourself on Concurrency basics

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

Start free test
All Concurrency basics questions →