Engineering Questions with Answers - Multiple Choice Questions

Database MCQ – Lock Release and Undo Operations

1 - Question

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 - Question

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 - Question

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 - Question

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.




5 - Question

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 - Question

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.




7 - Question

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 - Question

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.




9 - Question

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 - Question

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.

Get weekly updates about new MCQs and other posts by joining 18000+ community of active learners