Skills101
← All practice quizzes

Quiz: How Hashing Works

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

What happens inside a HashMap or dict: hash functions, buckets, collisions with chaining and open addressing, load factor and resizing — and why lookups are O(1) on average but O(n) in the worst case.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does this print?

    buckets = 4
    for key in [10, 14, 7, 3]:
        print(key % buckets, end=" ")
    
  2. Question 2

    What is a collision in a hash table?

  3. Question 3

    In separate chaining, what does each bucket hold?

  4. Question 4

    Java's HashMap resizes when the load factor passes:

  5. Question 5

    What is the WORST-case time of a lookup in a basic chained hash table?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →