With optimistic locking a user may have to redo their work when a conflict occurs?
-
True
-
False
The answer is: A
Explanation:
Optimistic locking is a technique used to prevent data conflicts in a multi-user environment. It involves checking for conflicts only at the time of update, that is, when a user tries to modify a piece of data that may have already been modified by another user. If a conflict is detected, the optimistic locking mechanism rolls back the transaction and the user has to redo their work. Therefore, option A is correct. Option B is incorrect because it contradicts the explanation given above.
Optimistic locking lets multiple users read and edit the same data without acquiring a lock upfront, checking for conflicts only at commit/save time (typically via a version number or timestamp). If another user has saved changes in the meantime, the conflict is detected then, and the losing user must redo their edits against the fresh data rather than silently overwriting it. This tradeoff is what distinguishes optimistic from pessimistic locking, which prevents the conflict entirely by locking the record upfront.