10 multiple-choice questions related to deadlock prevention in DBMS:

Here are 10 multiple-choice questions related to deadlock prevention in DBMS with their answers:


Question 1: Deadlock Definition

Q1: A deadlock in DBMS occurs when:

  • A) Multiple transactions wait indefinitely for each other to release resources
  • B) A single transaction is completed
  • C) A transaction is rolled back
  • D) The database is updated

Answer: A) Multiple transactions wait indefinitely for each other to release resources


Question 2: Deadlock Prevention Techniques

Q2: Which of the following is a technique used for deadlock prevention?

  • A) Wait-Die Scheme
  • B) Two-Phase Commit
  • C) Data Replication
  • D) Shadow Paging

Answer: A) Wait-Die Scheme


Question 3: Resource Allocation Graph

Q3: In the context of deadlock prevention, a Resource Allocation Graph (RAG) is used to:

  • A) Schedule transactions
  • B) Detect cycles and potential deadlocks
  • C) Optimize queries
  • D) Manage memory

Answer: B) Detect cycles and potential deadlocks


Question 4: Wait-Die Scheme

Q4: In the Wait-Die Scheme, if an older transaction requests a resource held by a younger transaction, it:

  • A) Waits for the resource
  • B) Is aborted
  • C) Preempts the resource
  • D) Rolls back

Answer: A) Waits for the resource


Question 5: No Preemption

Q5: The "No Preemption" rule in deadlock prevention states that:

  • A) Resources cannot be forcibly taken from transactions
  • B) Transactions must always wait for resources
  • C) Resources are always available
  • D) Transactions can request resources multiple times

Answer: A) Resources cannot be forcibly taken from transactions


Question 6: Circular Wait Condition

Q6: Preventing which of the following conditions can help in deadlock prevention?

  • A) Circular Wait
  • B) Mutual Exclusion
  • C) Hold and Wait
  • D) Starvation

Answer: A) Circular Wait


Question 7: Hold and Wait Condition

Q7: To prevent deadlock, the "Hold and Wait" condition can be avoided by:

  • A) Ensuring transactions request all resources at once
  • B) Allowing transactions to hold resources indefinitely
  • C) Granting resources in a cyclic order
  • D) Preventing transactions from requesting resources

Answer: A) Ensuring transactions request all resources at once


Question 8: Wait-for Graph

Q8: A Wait-for Graph is used to:

  • A) Allocate resources
  • B) Detect deadlocks
  • C) Backup data
  • D) Normalize the database

Answer: B) Detect deadlocks


Question 9: Priority-Based Prevention

Q9: In priority-based deadlock prevention schemes, if a low-priority transaction requests a resource held by a high-priority transaction, it:

  • A) Preempts the resource
  • B) Is rolled back
  • C) Waits for the resource
  • D) Releases all resources

Answer: C) Waits for the resource


Question 10: Timestamp Ordering

Q10: In Timestamp Ordering, if a transaction with a higher timestamp requests a resource held by a transaction with a lower timestamp, it:

  • A) Waits for the resource
  • B) Is aborted
  • C) Is granted the resource immediately
  • D) Preempts the resource

Answer: A) Waits for the resource

Comments