Database Questions and Answers – Lock Release and Undo Operations

This set of Database Multiple Choice Questions & Answers (MCQs) focuses on “Lock Release and Undo Operations”.

1. Which lock should be obtained to prevent a concurrent transaction from executing a conflicting read, insert or delete operation on the same key value.
a) Higher-level lock
b) Lower-level lock
c) Read only lock
d) Read write
View Answer

Answer: a
Explanation: Operations acquire lower-level locks while they execute, but release them when they complete; the corresponding transaction must however retain a higher-level lock in a two-phase manner to prevent concurrent transactions from executing conflicting actions.

2. Once the lower-level lock is released, the operation cannot be undone by using the old values of updated data items, and must instead be undone by executing a compensating operation; such an operation is called
a) Logical operation
b) Redo operation
c) Logical undo operation
d) Undo operation
View Answer

Answer: a
Explanation: It is important that the lower-level locks acquired during an operation are sufficient to perform a subsequent logical undo of the operation.

3. Which of the following is used for undo operations alone?
a) Logical logging
b) Physical logging
c) Physical log records
d) Physical logging and Physical log records
View Answer

Answer: a
Explanation: If the operation inserted an entry in a B+-tree, the undo information U would indicate that a deletion operation is to be performed, and would identify the B+-tree and what entry to delete from the tree. Such logging of information about operations is called logical logging.

4. Redo operations are performed exclusively using
a) Logical logging
b) Physical logging
c) Physical log records
d) Both Physical logging and Physical log records
View Answer

Answer: d
Explanation: Logging of old-value and new-value information is called physical logging.

advertisement
advertisement

5. To perform logical redo or undo, the database state on disk must be operation ___________ that is, it should not have partial effects of any operation.
a) Persistent
b) Resistant
c) Consistent
d) None of the mentioned
View Answer

Answer: c
Explanation: Data structures such as B+-trees would not be in a consistent state, and neither logical redo nor logical undo operations can be performed on an inconsistent data structure.

6. An operation is said to be __________ if executing it several times in a row gives the same result as executing it once.
a) Idempotent
b) Changed
c) Repetitive
d) All of the above
View Answer

Answer: a
Explanation: Operations such as inserting an entry into a B+-tree may not be idempotent, and the recovery algorithm must therefore make sure that an operation that has already been performed is not performed again.

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

7. Immediate database modification technique uses
a) Both undo and redo
b) Undo but no redo
c) Redo but no undo
d) Neither undo nor redo
View Answer

Answer: a
Explanation: Undo erases all the changes and redo makes the deleted changes.

8. Shadow paging has
a) no redo
b) no undo
c) redo but no undo
d) neither redo nor undo
View Answer

Answer: a
Explanation: Undo erases all the changes and redo makes the deleted changes.

advertisement

9. For correct behaviour during recovery, undo and redo operation must be
a) Commutative
b) Associative
c) Idempotent
d) Distributive
View Answer

Answer: c
Explanation: Undo erases all the changes and redo makes the deleted changes.

10. If ___________ are not obtained in undo operation it will cause problem in undo-phase.
a) Higher-level lock
b) Lower-level lock
c) Read only lock
d) Read write
View Answer

Answer: b
Explanation: Operations acquire lower-level locks while they execute, but release them when they complete; the corresponding transaction must however retain a higher-level lock in a two-phase manner to prevent concurrent transactions from executing conflicting actions.

advertisement

Sanfoundry Global Education & Learning Series – Database Management System.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.