🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Unique ID Generator: all 15 questions

Quiz: Unique ID Generator · Question 7 of 15

What does this print? (code)

What does this print?

servers = 3
ids = {k: [k + servers * i for i in range(3)] for k in (1, 2, 3)}
print(ids[2])
  1. A.[2, 3, 4]
  2. B.[2, 5, 8]
  3. C.[2, 4, 6]
  4. D.[3, 6, 9]
Answer & explanation

Correct answer: [2, 5, 8]

Database 2 in a group of 3 hands out 2, 5, 8 — the auto-increment-with-steps scheme.

Can you get the rest right without peeking?

Take the timed Quiz: Unique ID Generator quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →