Difficulty: Easy
Correct Answer: Valid statement
Explanation:
Introduction / Context:Locking is a classic mechanism to preserve consistency under concurrent access. This question asks whether locking exists to prevent conflicting, simultaneous modifications of the same data.
Given Data / Assumptions:
Concept / Approach:Yes—locking (especially pessimistic locking) prevents multiple writers from updating the same record at once. Even in MVCC systems, write-write conflicts are prevented or detected, and one transaction typically must wait or be rolled back to avoid corruption.
Step-by-Step Solution:Identify conflict: two sessions intend to change the same row.Apply locking rule: acquire a write-intent lock; others block or validate later.Result: only one change is committed; the other is serialized or rejected.
Verification / Alternative check:Simulate two concurrent UPDATEs under READ COMMITTED with row locks; the second updater waits until the first commits/rolls back.
Why Other Options Are Wrong:Calling the statement invalid ignores the fundamental purpose of locking; restricting to table-level or certain engines is unnecessary.
Common Pitfalls:Confusing read locks with write locks; assuming MVCC “removes” locking—it still coordinates writers.
Final Answer:Valid statement
Discussion & Comments