← Quiz: Unique ID Generator: all 15 questions
Quiz: Unique ID Generator · Question 3 of 15
What does this print? (code)
What does this print?
ts, machine, seq = 5, 3, 2
i = (ts << 22) | (machine << 12) | seq
print(i >> 22, (i >> 12) & 1023, i & 4095)
- A.5 3 0
- B.5 3 2
- C.2 3 5
- D.20971520 3 2
Answer & explanation
Correct answer: 5 3 2
Shifting right and masking pulls each field back out exactly as it went in.
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 →