Software Developer · Question example
65/100 · Partially correct
How would you prevent two customers from booking the same seat at the same time?
Original answer: I would check whether the seat is available, then save the booking.
Independent evidence
Identifies the availability check and save steps, but does not prevent a race between them.
Follow-up: What if both customers read “available” before either booking is saved?
Follow-up response: I would use a transaction and lock the seat row while checking and saving, so the second request must wait.
After follow-up assistance
After the prompt, adds a transaction and row lock. This demonstrates additional knowledge with assistance, not an independently complete answer.
Why this score
Illustrative 65/100: credit for the relevant original workflow and the locking mechanism added after the follow-up. Deductions remain because the answer omits a final availability recheck and a database uniqueness safeguard.
Remaining gaps: Recheck availability inside the transaction; enforce one booking per seat; explain conflict handling.
Sample stronger answer
Begin a transaction, lock the seat row, recheck availability, and insert the booking only if available. Enforce a unique constraint on the seat booking, commit, and return a clear unavailable-seat response for conflicts.
Next practice step
Write the transaction steps without hints, then practise explaining how two simultaneous requests are handled.