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