Concurrency control techniques (locking, timestamping, multiversion) MCQs in DBMS
By: Prof. Dr. Fazal Rehman | Last updated: September 23, 2024
Which concurrency control technique uses locks to manage access to database resources?
a) Timestamping
b) Multiversioning
c) Locking
d) SerializationAnswer: c) Locking
In a locking-based concurrency control system, what happens when two transactions request conflicting locks?
a) One transaction is granted the lock, and the other is delayed or denied.
b) Both transactions are granted the locks, and a conflict is resolved later.
c) Both transactions are automatically rolled back.
d) The system crashes and restarts.Answer: a) One transaction is granted the lock, and the other is delayed or denied.
What type of lock allows both read and write operations but blocks other transactions from acquiring any lock on the same data item?
a) Shared Lock
b) Exclusive Lock
c) Intent Lock
d) Update LockAnswer: b) Exclusive Lock
In timestamp-based concurrency control, what determines the order in which transactions are executed?
a) The time at which the transaction was initiated
b) The number of operations performed by the transaction
c) The type of locks held by the transaction
d) The priority assigned to the transactionAnswer: a) The time at which the transaction was initiated
Which concurrency control technique maintains multiple versions of a data item to ensure consistency and manage concurrent access?
a) Locking
b) Timestamping
c) Multiversioning
d) Deadlock PreventionAnswer: c) Multiversioning
In the context of locking, what is a deadlock?
a) A situation where two or more transactions wait indefinitely for resources held by each other.
b) A scenario where transactions are rolled back due to system failure.
c) A state where all transactions are granted access to resources.
d) A condition where transactions are executed in a serializable manner.Answer: a) A situation where two or more transactions wait indefinitely for resources held by each other.
In timestamp-based concurrency control, what is the role of the read_timestamp and write_timestamp for each transaction?
a) To manage the execution order of transactions based on their timestamps.
b) To determine the frequency of read and write operations by each transaction.
c) To track the changes made by transactions for rollback purposes.
d) To record the time at which a transaction starts and ends.Answer: a) To manage the execution order of transactions based on their timestamps.
Which of the following is a common strategy for deadlock prevention in a locking-based system?
a) Timestamp ordering
b) Two-phase locking
c) Multiversion concurrency control
d) Wait-Die and Wound-Wait schemesAnswer: d) Wait-Die and Wound-Wait schemes
In multiversion concurrency control, what is a “snapshot” in the context of transaction management?
a) A real-time view of the database at a specific point in time.
b) A record of all transactions executed in the system.
c) A copy of the database schema.
d) A backup of the database.Answer: a) A real-time view of the database at a specific point in time.
Which locking protocol ensures that transactions are executed in a serializable order by acquiring a lock on data items?
a) Strict Two-Phase Locking (2PL)
b) Timestamp Ordering
c) Optimistic Concurrency Control
d) Multiversion Concurrency ControlAnswer: a) Strict Two-Phase Locking (2PL)
What is the primary advantage of using multiversion concurrency control (MVCC) over traditional locking techniques?
a) Reduced need for locking mechanisms and better handling of concurrent read and write operations.
b) Simplified implementation of transaction logs.
c) Lower storage requirements for maintaining multiple versions.
d) Better prevention of deadlocks through simpler conflict resolution.Answer: a) Reduced need for locking mechanisms and better handling of concurrent read and write operations.
In a timestamp-based concurrency control system, what action is taken if a transaction’s write operation conflicts with an already committed transaction’s read operation?
a) The conflicting transaction is aborted.
b) The database system automatically resolves the conflict by merging data.
c) The conflicting transaction is delayed until the read operation completes.
d) The read operation is rolled back.Answer: a) The conflicting transaction is aborted.
What type of lock is typically used to prevent other transactions from reading or writing to a data item that is being updated?
a) Shared Lock
b) Exclusive Lock
c) Intent Lock
d) Read LockAnswer: b) Exclusive Lock
Which concurrency control technique might require a database system to maintain a history of all versions of data items?
a) Locking
b) Timestamping
c) Multiversioning
d) Two-Phase LockingAnswer: c) Multiversioning
What is a major drawback of using timestamp-based concurrency control?
a) High overhead due to the management of timestamps and rollback of transactions.
b) Increased complexity in handling deadlocks.
c) Inefficient handling of read operations compared to locking.
d) Difficulty in managing concurrent updates without locking.Answer: a) High overhead due to the management of timestamps and rollback of transactions.