Skip to content
Sharp

Collections · interview question

Which Java collection class is best suited for implementing a queue that supports both FIFO and LIFO operations?

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

Correct answer

D. ArrayDeque

Why

ArrayDeque is designed to support both queue (FIFO) and stack (LIFO) operations efficiently. It provides operations to add and remove elements from both ends of the queue.

Test yourself on Collections

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

Start free test
All Collections questions →