Skip to content
Sharp

Collections · interview question

If you need a collection that supports quick insertion and removal of elements at both ends, but also provides indexed access, which would you choose?

Multiple choiceHardchapter-4-curatedpremiumcollectionschoosing-the-right-collection
Choose one answer
Answer and explanation

Correct answer

C. LinkedList

Why

LinkedList can be used as a list and deque, allowing quick insertion and removal at both ends, as well as access by index, while ArrayDeque does not support indexing.

Test yourself on Collections

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

Start free test
All Collections questions →