Difficulty: Easy
Correct Answer: Shared lock
Explanation:
Introduction / Context:This question tests your understanding of lock modes used by a Database Management System (DBMS) to coordinate concurrent access. Specifically, it asks which lock permits reads but prevents writes, a core idea behind isolation and concurrency.
Given Data / Assumptions:
Concept / Approach:A shared (S) lock is designed for read-only access. Many transactions can hold S locks concurrently on the same item. An exclusive (X) lock is required for updates and is incompatible with other S or X locks, preventing both reads and writes by others while held.
Step-by-Step Solution:
Identify the requirement: allow read, disallow change.Map lock modes: S allows read; X allows change and blocks others.Therefore the correct mode is the shared (S) lock.Verification / Alternative check:Compatibility matrix: S with S = compatible (reads proceed). S with X = incompatible (updates blocked). This matches the requirement.
Why Other Options Are Wrong:
Common Pitfalls:Confusing “implicit/explicit” (how a lock is obtained) with “shared/exclusive” (what a lock allows). The question is about behavior, not acquisition method.
Final Answer:Shared lock
Discussion & Comments