250+ TOP MCQs on Deadlocks and Answers

Database Multiple Choice Questions on “Deadlocks”.

1. A system is in a ______ state if there exists a set of transactions such that every transaction in the set is waiting for another transaction in the set.
a) Idle
b) Waiting
c) Deadlock
d) Ready

Answer: c
Clarification: When one data item is waiting for another data item in a transaction then system is in deadlock.

2. The deadlock state can be changed back to stable state by using _____________ statement.
a) Commit
b) Rollback
c) Savepoint
d) Deadlock

Answer: b
Clarification: Rollback is used to rollback to the point before lock is obtained.

3. What are the ways of dealing with deadlock?
a) Deadlock prevention
b) Deadlock recovery
c) Deadlock detection
d) All of the mentioned

Answer: d
Clarification: Deadlock prevention is also called as deadlock recovery. Prevention is commonly used if the probability that the system would enter a deadlock state is relatively high; otherwise, detection and recovery are more efficient.

4. When transaction Ti requests a data item currently held by Tj, Ti is allowed to wait only if it has a timestamp smaller than that of Tj (that is, Ti is older than Tj). Otherwise, Ti is rolled back (dies). This is
a) Wait-die
b) Wait-wound
c) Wound-wait
d) Wait

Answer: a
Clarification: The wait–die scheme is a non-preemptive technique.

5. When transaction Ti requests a data item currently held by Tj, Ti is allowed to wait only if it has a timestamp larger than that of Tj (that is, Ti is younger than Tj ). Otherwise, Tj is rolled back (Tj is wounded by Ti). This is
a) Wait-die
b) Wait-wound
c) Wound-wait
d) Wait

Answer: c
Clarification: The wound–wait scheme is a preemptive technique. It is a counterpart to the wait–die scheme.

6. The situation where the lock waits only for a specified amount of time for another lock to be released is
a) Lock timeout
b) Wait-wound
c) Timeout
d) Wait

Answer: a
Clarification: The timeout scheme is particularly easy to implement, and works well if transactions are short and if longwaits are likely to be due to deadlocks.

7. The deadlock in a set of a transaction can be determined by
a) Read-only graph
b) Wait graph
c) Wait-for graph
d) All of the mentioned

Answer: a
Clarification: Each transaction involved in the cycle is said to be deadlocked.

8. A deadlock exists in the system if and only if the wait-for graph contains a ___________
a) Cycle
b) Direction
c) Bi-direction
d) Rotation

Answer: a
Clarification: Each transaction involved in the cycle is said to be deadlocked.

9. Selecting the victim to be rollbacked to the previous state is determined by the minimum cost. The factors determining cost of rollback is
a) How long the transaction has computed, and how much longer the transaction will compute before it completes its designated task
b) How many data items the transaction has used
c) How many more data items the transaction needs for it to complete
d) All of the mentioned

Answer: d
Clarification: We should roll back those transactions that will incur the minimum cost.

10. __________ rollback requires the system to maintain additional information about the state of all the running transactions.
a) Total
b) Partial
c) Time
d) Commit

Answer: b
Clarification: In total rollback abort the transaction and then restart it.

Leave a Reply

Your email address will not be published. Required fields are marked *