Q: 1 Two phase locking protocol has which of the following problem(s)?
Chances of Deadlock
Cascading Rollback
Neither (a) nor (b)
Both (a) and (b)
[ Option D ]
Two-Phase Locking (2PL) protocol, which is used for concurrency control in database systems, has the problems of deadlock and cascading rollback.
Q: 2 Which of the following concurrency control protocols ensure both conflict serializability and freedom from deadlock?
(I) 2PL (Two Phase Lock)
(II) Time-Stamp ordering
(III) Multiple granularity protocol
I only
II only
III only
Both I and II
[ Option B ]
Concurrency Control in a database ensures that when multiple transactions run at the same time, they do not interfere with each other. Its main goal is to maintain correctness, consistency, and isolation so that the final result remains the same as if transactions were executed one by one.
When we check concurrency control protocols, we look for two important properties:
Two Phase Locking (2PL) ensures conflict serializability by enforcing that transactions lock data in two phases (growing and shrinking), but it does not guarantee freedom from deadlock. The deadlocks can still occur in 2PL.
Timestamp Ordering Protocol guarantees both conflict serializability and freedom from deadlock because it assigns timestamps to transactions and schedules operations based on these timestamps, avoiding cyclic waits and deadlocks.
Multiple Granularity Protocol primarily helps reduce lock overhead and increase concurrency by using locks at different levels of granularity, but it does not guarantee deadlock freedom by itself. The deadlock can still occur.
Q: 3 Which of the following statements correctly differentiates strict two-phase locking from rigorous two-phase locking?
In strict 2PL, exclusive locks are released at the end of the transaction; in rigorous 2PL, all locks (shared and exclusive) are released at the end of the transaction.
In strict 2PL, all locks are released immediately after use; in rigorous 2PL, locks are never released.
Strict 2PL ensures serializability and deadlock freedom.
Rigorous 2PL ensures serializability and deadlock freedom.
[ Option A ]
Two-Phase Locking (2PL) is a concurrency control protocol used in databases to ensure serializability of transactions.
Strict 2PL and Rigorous 2PL are two variants of the two-phase locking protocol. In strict 2PL, only exclusive locks are held until the transaction commits, while shared locks can be released earlier.
In rigorous 2PL, all locks, both shared and exclusive are held until the end of the transaction. This makes rigorous 2PL stricter and ensures that no other transaction can access any locked data until the current transaction completes, providing serializability and strictness.
Q: 4 The concept of locking can be used to solve which of the following problems?
Lost update
Uncommitted dependency
Inconsistent data
All of the above
[ Option D ]
Locking is a concurrency control technique used in DBMS to ensure that multiple transactions do not interfere with each other.
Lost update occurs when two transactions update the same data and one update overwrites the other. Locking prevents this by allowing only one transaction to modify data at a time.
Uncommitted dependency or dirty read happens when a transaction reads data written by another uncommitted transaction. Locking avoids this by restricting access until commit.
Inconsistent data results from simultaneous uncontrolled access to data, which locking helps prevent.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.