← 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=" ")
- A.1 2 3 0
- B.2 2 3 3
- C.2 3 3 2
- 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 →