Skip to content
Sharp

Collections · interview question

Which collection would you use to implement a product catalog where each product can be accessed by its unique SKU quickly?

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

Correct answer

B. HashMap

Why

HashMap provides constant-time complexity for insertions and lookups, making it ideal for a catalog where products are accessed by unique keys like SKUs.

Test yourself on Collections

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

Start free test
All Collections questions →