Home »
MCQs »
DBMS MCQs
DBMS Lock-Based Protocol MCQs
DBMS Lock-Based Protocol MCQs: This section contains multiple-choice questions and answers on Lock-Based Protocol in DBMS.
Submitted by Anushree Goswami, on April 20, 2022
1. When using this type of protocol, each transaction must obtain a ___ on the data before it can read or write it.
- Lock
- Protocol
- Base
- Transaction
Answer: A) Lock
Explanation:
When using this type of protocol, each transaction must obtain a lock on the data before it can read or write it.
Discuss this Question
2. How many types of locks are there in this protocol?
- 2
- 3
- 4
- 5
Answer: A) 2
Explanation:
There are 2 types of locks in this protocol.
Discuss this Question
3. Which of the following is a type of lock?
- Shared lock
- Exclusive lock
- Both A and B
- None of the above
Answer: C) Both A and B
Explanation:
The following types of locks are there in this protocol -
- Shared lock
- Exclusive lock
Discuss this Question
4. What is a shared lock also known as?
- Share-only lock
- Read-only lock
- Write-only lock
- Fetch-only lock
Answer: B) Read-only lock
Explanation:
Shared lock is also known as Read-only lock.
Discuss this Question
5. Only the transaction can ___ the data item when the data item is locked in a shared lock.
- Read
- Write
- Share
- Fetch
Answer: A) Read
Explanation:
Only the transaction can read the data item when the data item is locked in a shared lock.
Discuss this Question
6. Since the transaction cannot update data on the data item when the shared lock is held, it can be shared ___ transactions.
- Before
- After
- Between
- None
Answer: C) Between
Explanation:
Since the transaction cannot update data on the data item when the lock is held, it can be shared between transactions.
Discuss this Question
7. The transaction can read as well as write the data item with a/an ___ lock.
- Shared
- Exclusive
- Read
- Write
Answer: B) Exclusive
Explanation:
The transaction can read as well as write the data item with an exclusive lock.
Discuss this Question
8. Multiple transactions cannot modify the same data simultaneously in the lock which is ___.
- Exclusive
- Write
- Read
- Shared
Answer: A) Exclusive
Explanation:
Multiple transactions cannot modify the same data simultaneously in this lock because it is exclusive.
Discuss this Question
9. How many types of lock protocols are there?
- 2
- 3
- 4
- 5
Answer: C) 4
Explanation:
There are 4 types of lock protocols.
Discuss this Question
10. Which of the following is a type of Lock Protocol?
- Simplistic Lock Protocol
- Pre-claiming Lock Protocol
- Two-phase locking
- All of the above
Answer: D) All of the above
Explanation:
The types of lock protocols are -
- Simplistic Lock Protocol
- Pre-claiming Lock Protocol
- Two-phase locking
- Strict Two-phase locking
Discuss this Question
11. All the transactions obtain a lock on the data before ___ it with simplistic lock-based protocols.
- Modifying
- Deleting
- Inserting
- All of the above
Answer: D) All of the above
Explanation:
All the transactions obtain a lock on the data before modifying, deleting, or inserting it with simplistic lock-based protocols.
Discuss this Question
12. What is TRUE about Pre-claiming lock protocol?
- In pre-claiming lock protocols, all items on which locks are needed are analyzed by evaluating the transaction.
- It requests the DBMS for a lock on all the data items before initiating the transaction.
- This protocol allows the transaction to begin if all the locks have been granted.
- All of the above
Answer: D) All of the above
Explanation:
In case of Pre-claiming lock protocol -
- In pre-claiming lock protocols, all items on which locks are needed are analyzed by evaluating the transaction.
- It requests the DBMS for a lock on all the data items before initiating the transaction.
- This protocol allows the transaction to begin if all the locks have been granted.
Discuss this Question
13. Lock-based protocols ___ transactions if not all locks are granted, and they wait until all locks are granted until the transaction can continue.
- Abort
- Commit
- Rollback
- End
Answer: C) Rollback
Explanation:
Lock-based protocols roll back transactions if not all locks are granted, and they wait until all locks are granted until the transaction can continue.
Discuss this Question
14. In how many parts does the Two-phase locking protocol divide the transaction's execution phase.
- 2
- 3
- 4
- 5
Answer: B) 3
Explanation:
During the execution phase of the transaction, two-phase locking divides the process into three parts.
Discuss this Question
15. What is TRUE about Two-phase locking?
- As long as the transaction is already running, it will try to obtain the required lock in the first part.
- As long as the transaction is already running, it will try to obtain the required lock in the second part.
- As long as the transaction is already running, it will try to obtain the required lock in the third part.
- As long as the transaction is already running, it will try to obtain the required lock in the fourth part.
Answer: A) As long as the transaction is already running, it will try to obtain the required lock in the first part.
Explanation:
As long as the transaction is already running, it will try to obtain the required lock in the first part.
Discuss this Question
16. The second part of the transaction involves the ___ of all the locks.
- Initialization
- Acquisition
- Termination
- None
Answer: B) Acquisition
Explanation:
The second part of the transaction involves the acquisition of all the locks.
Discuss this Question
17. Once the ___ lock is released, the third phase begins.
- First
- Second
- Middle
- Last
Answer: A) First
Explanation:
Once the first lock is released, the third phase begins.
Discuss this Question
18. The transaction ___ the acquired locks in the third phase.
- Attains
- Releases
- Adds
- Deletes
Answer: B) Releases
Explanation:
The transaction releases the acquired locks in the third phase.
Discuss this Question
19. How many phases of 2PL are there?
- 2
- 3
- 4
- 5
Answer: A) 2
Explanation:
There are 2 phases of 2PL.
Discuss this Question
20. What are the two phases of 2PL?
- Growing phase
- Shrinking phase
- Both A and B
- None of the above
Answer: C) Both A and B
Explanation:
The two phases of 2PL are -
- Growing phase
- Shrinking phase
Discuss this Question
21. The transaction may acquire a new lock on the data item during the ___ phase, but none can be released.
- Growing
- Shrinking
- Simplistic
- Pre-claiming
Answer: A) Growing
Explanation:
The transaction may acquire a new lock on the data item during the growing phase, but none can be released.
Discuss this Question
22. A transaction may be allowed to ___ its existing lock during the shrinking phase, but it cannot acquire any new locks.
- Delete
- Release
- Add
- Update
Answer: B) Release
Explanation:
A transaction may be allowed to release its existing lock during the shrinking phase, but it cannot acquire any new locks.
Discuss this Question
23. Strict-2PL follows the same process as ___ in that processing continues normally after all locks are acquired.
- Simplistic
- Pre-claiming
- 2PL
- None
Answer: C) 2PL
Explanation:
Strict-2PL follows the same process as 2PL in that processing continues normally after all locks are acquired.
Discuss this Question
24. What is the difference between 2PL and Strict-2PL?
- In Strict-2PL, locks are not released after use.
- In Strict-2PL, locks are not updated after use.
- In Strict-2PL, locks are not added after use.
- In Strict-2PL, locks are released after use.
Answer: A) In Strict-2PL, locks are not released after use.
Explanation:
The difference between 2PL and Strict-2PL is that in Strict-2PL, locks are not released after use.
Discuss this Question
25. The strict-2PL method waits until the entire transaction has been ___ before it releases all of the locks.
- Aborted
- Committed
- Rollbacked
- Updated
Answer: B) Committed
Explanation:
The strict-2PL method waits until the entire transaction has committed before it releases all of the locks.
Discuss this Question
26. A ___ phase of lock release is not part of the strict-2PL protocol.
- Growing
- Shrinking
- Both A and B
- None of the above
Answer: B) Shrinking
Explanation:
A shrinking phase of lock release is not part of the strict-2PL protocol.
Discuss this Question
27. There is no cascading ___ in strict-2PL as there is in 2PL.
- Commit
- Rollback
- End
- Abort
Answer: D) Abort
Explanation:
There is no cascading abort in strict-2PL as there is in 2PL.
Discuss this Question