🎙 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 11 of 15

Why is MAX(id) + 1 in application code a bad way to create IDs?

Why is MAX(id) + 1 in application code a bad way to create IDs?

  1. A.It is too slow to compute
  2. B.Two requests can read the same maximum at the same time and create the same ID
  3. C.It only works with UUIDs
  4. D.Databases do not support MAX
Answer & explanation

Correct answer: Two requests can read the same maximum at the same time and create the same ID

This is a race condition; the database must generate or enforce unique IDs.

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 →