Skip to content
Sharp

Collections · interview question

For which scenario is a Deque preferred over a Queue?

Multiple choiceMediumchapter-4-curatedpremiumcollectionsqueue-and-deque-basics
Choose one answer
Answer and explanation

Correct answer

D. When elements need to be accessed from both ends

Why

A Deque is preferred when elements need to be accessed, inserted, or removed from both ends, supporting both FIFO and LIFO operations efficiently.

Test yourself on Collections

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

Start free test
All Collections questions →