← Quiz: Databases at Scale: all 10 questions
Quiz: Databases at Scale · Question 8 of 10
What does this print? (code)
What does this print?
users = [101, 102, 103, 104, 105, 106]
shards = {0: [], 1: [], 2: []}
for u in users:
shards[u % 3].append(u)
print(shards[0], shards[2])
- A.[101, 104] [103, 106]
- B.[103, 106] [101, 104]
- C.[102, 105] [101, 104]
- D.[102, 105] [103, 106]
Answer & explanation
Correct answer: [102, 105] [101, 104]
102 and 105 leave remainder 0; 101 and 104 leave remainder 2.
Can you get the rest right without peeking?
Take the timed Quiz: Databases at Scale quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →