🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: How Hashing Works: questions with answers

13 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What does this print? (code)
  2. Q2. What is a collision in a hash table?
  3. Q3. In separate chaining, what does each bucket hold?
  4. Q4. Java's HashMap resizes when the load factor passes:
  5. Q5. What is the WORST-case time of a lookup in a basic chained hash table?
  6. Q6. A Java class overrides equals() but not hashCode(). What happens with a HashSet?
  7. Q7. Which of these can be a Python dict key?
  8. Q8. Why is inserting into a hash map still O(1) on average even though resizing costs O(n)?
  9. Q9. What does this print? (code)
  10. Q10. In linear probing, what happens when the computed bucket is already taken?
  11. Q11. A hash map has 12 keys in 16 buckets. What is its load factor?
  12. Q12. Why must you not change a field used by hashCode() while the object is inside a HashSet?
  13. Q13. Why can't a Python list be used as a dictionary key?