Skip to content
Sharp

Collections · interview question

Which collection is the clearest fit for tracking distinct coupon codes that have already been applied?

Multiple choiceEasychapter-4-curatedpremiumcollectionsset-interface-and-hashset
Choose one answer
Answer and explanation

Correct answer

A. A HashSet<String>

Why

A set models uniqueness directly. HashSet is a good default when you care about membership and duplicate prevention more than ordering.

Test yourself on Collections

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

Start free test
All Collections questions →