Learn the vocabulary of assuming no conflict, then verifying a version number before writing.
0 / 5 completed
1 / 5
At standup, a dev mentions a database update that reads a row's current version number, later writes back only if that version number hasn't changed in the meantime, and simply retries if it has. What is this concurrency-control strategy called?
Optimistic locking reads a row's current version number, does its work assuming no conflict will occur, and only checks at write time whether that version number still matches, writing successfully if it does and simply retrying if some other transaction changed it in the meantime. Pessimistic locking instead takes an actual lock on the row up front for the whole transaction, blocking any other transaction from touching it until the lock is released. This assume-no-conflict-then-verify approach is exactly what "optimistic" refers to, betting that conflicts will be rare enough that checking at the end is cheaper than blocking upfront.
2 / 5
During a design review, the team picks optimistic locking specifically for a workload where conflicting concurrent updates to the same row are expected to be rare. Which capability does this choice provide?
Choosing optimistic locking for a low-conflict workload provides higher throughput under low contention, since transactions never block waiting on a lock at all, and the only cost paid is an occasional retry on the rare occasion two transactions genuinely do conflict over the same row. Pessimistic locking instead makes every transaction touching that row wait for a lock regardless of whether a real conflict was ever actually going to occur, which adds unnecessary blocking overhead when conflicts are genuinely rare. This is exactly why the choice between optimistic and pessimistic locking depends heavily on how often real conflicts are actually expected for the specific workload.
3 / 5
In a code review, a dev notices an optimistic-locking update checks the row's version number at write time but has no retry logic at all when that check fails, simply discarding the user's change silently. What does this represent?
This is a missing retry path, since optimistic locking's entire design assumes a version-mismatch failure at write time will trigger either a retry, re-reading the row and reapplying the change, or at minimum surfacing the conflict back to the caller, rather than silently discarding the user's intended update as if it had never happened. A cache eviction policy is an unrelated concept about discarded cache entries. This silent-discard gap is exactly the kind of bug a reviewer needs to catch, since it means a user's change can vanish without any error or feedback at all whenever a genuine conflict occurs.
4 / 5
An incident report shows users occasionally reported their edits silently disappearing, and the root cause was traced to an optimistic-locking update whose version-mismatch failure path simply discarded the change instead of retrying or surfacing an error. What practice would prevent this?
Adding an explicit retry-or-surface-conflict path for the version-mismatch case ensures a real conflict either automatically retries the update against the row's fresh version, or at minimum clearly reports the failure back to the user instead of vanishing silently, which is exactly the fix for the disappearing edits described in this incident. Continuing to silently discard the change on a version mismatch is exactly what caused users to lose work without any indication anything had gone wrong. This explicit conflict-handling path is a required part of any correct optimistic-locking implementation, not an optional extra.
5 / 5
During a PR review, a teammate asks why the team chooses optimistic locking for this workload instead of just always taking a pessimistic lock up front to guarantee no conflict can ever occur in the first place. What is the reasoning?
Always taking a pessimistic lock up front forces every single transaction touching that row to wait for the lock, even in the vast majority of cases where no other transaction was actually going to conflict with it, which adds real blocking overhead and reduces throughput unnecessarily. Optimistic locking instead lets every transaction proceed without ever blocking, paying a retry cost only on the rare occasion a genuine conflict is detected at write time via the version-number mismatch. The tradeoff is that optimistic locking becomes wasteful, with transactions retrying over and over, if conflicts turn out to be far more common than expected, which is exactly why pessimistic locking is chosen instead for a workload where contention on the same row is known to be high.
What does the "Optimistic Locking Vocabulary" vocabulary exercise cover?
This exercise tests real IT vocabulary related to optimistic locking vocabulary through 5 multiple-choice questions, each built from realistic workplace sentences rather than abstract definitions.
Is this vocabulary exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is completely free — no account, sign-up, or payment required.
How many questions does this exercise have?
This exercise has 5 questions. Each one shows a real-world sentence or scenario with multiple-choice options and an explanation once you answer.
What happens after I answer a question?
You'll see immediate feedback showing whether your answer was correct, along with a short explanation of why — then a button to move to the next question, and a full results screen at the end.
Can I retry the exercise if I get questions wrong?
Yes. Once you reach the results screen, click "Try again" to reset your answers and go through the exercise from the start as many times as you like.
Do I need to create an account to take this exercise?
No account is needed. Your answers are scored in your browser during the session — nothing is saved to a server, so you can jump straight in.
Is my progress saved if I leave the page?
No — progress within an exercise resets if you navigate away or reload. Each exercise is short enough to complete in a few minutes in one sitting.
Are these vocabulary exercises connected to other topics?
Yes — browse the full vocabulary exercises hub to find related modules covering adjacent IT topics and roles.
How is this different from reading a glossary or blog article?
Exercises like this one are active recall drills — you have to choose the correct term or phrasing yourself, which builds retention faster than passively reading a definition.
Where can I find more vocabulary exercises?
Browse the full Vocabulary exercises hub for hundreds of modules covering Agile, DevOps, security, databases, architecture, and more — organised by IT role and skill.