Skip to content
Sharp

Collections · interview question

You have a list of product descriptions that are mostly accessed in sequential order but occasionally need to be searched. Which collection is generally more efficient?

Multiple choiceMediumchapter-4-curatedpremiumcollectionscollection-performance-basics
Choose one answer
Answer and explanation

Correct answer

A. ArrayList

Why

ArrayList is efficient for sequential access due to its underlying array structure, offering O(1) access time. However, searching is O(n), which is acceptable given the sporadic need.

Test yourself on Collections

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

Start free test
All Collections questions →