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
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
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
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.
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
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
Explanation: 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
View Answer
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
Explanation: 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
View Answer
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
Explanation: 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
View Answer
Explanation: In total rollback abort the transaction and then restart it.
Sanfoundry Global Education & Learning Series – Database Management System.
- Check Programming Books
- Practice Computer Science MCQs
- Apply for Computer Science Internship
- Practice Programming MCQs
- Practice RDBMS MCQ