Skip to content
Sharp

Collections · interview question

How does a HashSet handle collisions in hash values?

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

Correct answer

D. Uses a linked list to store collided elements.

Why

HashSet handles hash collisions by using a linked list or a similar structure to store all elements that hash to the same index. This allows multiple elements to coexist at the same hash index.

Test yourself on Collections

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

Start free test
All Collections questions →