Database Questions and Answers – Deadlocks

This set of Database Multiple Choice Questions & Answers (MCQs) focuses 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
View Answer

Answer: c
Explanation: 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
View Answer

Answer: b
Explanation: 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
View Answer

Answer: d
Explanation: 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.
advertisement
advertisement

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
View Answer

Answer: a
Explanation: 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
View Answer

Answer: c
Explanation: The wound–wait scheme is a preemptive technique. It is a counterpart to the wait–die scheme.
Note: Join free Sanfoundry classes at Telegram or Youtube

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
View Answer

Answer: a
Explanation: 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
View Answer

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

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
View Answer

Answer: a
Explanation: 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
View Answer

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

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
View Answer

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

Sanfoundry Global Education & Learning Series – Database Management System.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

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.