🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Unique ID Generator: questions with answers

15 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. In a Snowflake ID, why is the timestamp stored in the highest bits?
  2. Q2. How many IDs can one Snowflake machine create in a single millisecond with a 12-bit sequence?
  3. Q3. What does this print? (code)
  4. Q4. What is the main drawback of random UUID v4 as the primary key of a very large, insert-heavy table?
  5. Q5. Two Snowflake servers were accidentally given the same machine id. What can happen?
  6. Q6. A generator's clock is moved back 5 ms by NTP. What should a safe Snowflake generator do?
  7. Q7. What does this print? (code)
  8. Q8. Why does the ID range (ticket server) approach scale well?
  9. Q9. Why choose a custom epoch close to your launch date instead of 1970?
  10. Q10. Which option gives time-sorted IDs that are globally unique, at the cost of 128 bits?
  11. Q11. Why is MAX(id) + 1 in application code a bad way to create IDs?
  12. Q12. How many machines can a Snowflake layout with a 10-bit machine id support?
  13. Q13. What does this print? (code)
  14. Q14. Snowflake IDs are used directly in public order URLs. What can an outsider learn?
  15. Q15. In Kubernetes, what is a common trick to give each ID generator a unique machine id?