🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: How Hashing Works: all 13 questions

Quiz: How Hashing Works · Question 1 of 13

What does this print? (code)

What does this print?

buckets = 4
for key in [10, 14, 7, 3]:
    print(key % buckets, end=" ")
  1. A.1 2 3 0
  2. B.2 2 3 3
  3. C.2 3 3 2
  4. D.10 14 7 3
Answer & explanation

Correct answer: 2 2 3 3

10 % 4 = 2, 14 % 4 = 2, 7 % 4 = 3, 3 % 4 = 3 — two pairs of collisions.

Can you get the rest right without peeking?

Take the timed Quiz: How Hashing Works quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →