← Quiz: Consistent Hashing: all 15 questions
Quiz: Consistent Hashing · Question 7 of 15
What does this print? (code)
What does this print?
keys = range(12)
moved = sum(1 for k in keys if k % 3 != k % 4)
print(moved)
- A.3
- B.9
- C.6
- D.12
Answer & explanation
Correct answer: 9
Only 0, 1 and 2 give the same answer for % 3 and % 4, so 9 of 12 keys move — the modulo problem in miniature.
Can you get the rest right without peeking?
Take the timed Quiz: Consistent Hashing quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →