Menu

Earn Premium with Referrals

Invite your friends and earn Premium rewards through our referral program.

See how it works and start inviting friends.

Concurrency Control Quiz
DBMS

Concurrency Control Quiz

Test your knowledge of locking protocols, deadlocks, MVCC, and concurrency control mechanisms.

Test your understanding of concurrency control concepts.

What is a deadlock in database concurrency?

  • A) A transaction that takes too long to execute
  • B) A cycle of transactions waiting for locks held by each other
  • C) A lock that is never released
  • D) A transaction that reads uncommitted data

Answer: B Explanation: A deadlock occurs when two or more transactions each hold locks that the other needs, forming a cycle. Neither can proceed, and the DBMS must abort one of them (the victim) to break the cycle.

What does MVCC stand for?

  • A) Multi-Version Concurrency Control
  • B) Multi-Value Consistent Computing
  • C) Minimum Version Concurrency Check
  • D) Maximum Volume Cache Control

Answer: A Explanation: Multi-Version Concurrency Control (MVCC) creates multiple versions of data items so readers can see a consistent snapshot without waiting for write locks. It is used by PostgreSQL, MySQL (InnoDB), and Oracle.

In Strict 2PL, when are exclusive locks released?

  • A) Immediately after the write operation
  • B) After the transaction commits or aborts
  • C) After all read operations complete
  • D) At the start of the shrinking phase

Answer: B Explanation: Strict 2PL holds all exclusive locks until the transaction commits or aborts. This prevents cascading aborts because no other transaction can read uncommitted data.

What does a Wait-Die protocol do when an older transaction requests a lock held by a younger transaction?

  • A) The older transaction dies (aborts)
  • B) The younger transaction dies (aborts)
  • C) The older transaction waits
  • D) Both transactions abort

Answer: C Explanation: In Wait-Die, if an older transaction requests a lock held by a younger one, the older waits. If a younger requests a lock held by an older, the younger dies (aborts). The rule is: “older waits, younger dies.”

Which MVCC benefit is most important for web applications?

  • A) Faster writes
  • B) Readers never block writers and writers never block readers
  • C) No need for indexes
  • D) Automatic deadlock resolution

Answer: B Explanation: MVCC’s primary benefit for web applications is that read operations never block write operations and vice versa. Reads see a consistent snapshot without acquiring read locks, which is critical for read-heavy web workloads.

What is write skew?

  • A) Two transactions writing to the same row simultaneously
  • B) An anomaly under snapshot isolation where two transactions make disjoint updates that violate a constraint
  • C) A transaction that writes before reading
  • D) A deadlock caused by write operations

Answer: B Explanation: Write skew occurs under snapshot isolation when two transactions read overlapping data, make disjoint updates based on those reads, and the combined result violates a database constraint. Example: Two doctors both go off call because each sees the other as still on call.

What does a wait-for graph detect?

  • A) Transaction duration
  • B) Deadlocks (by finding cycles)
  • C) Lock types held by each transaction
  • D) Which transactions will commit

Answer: B Explanation: A wait-for graph has transactions as nodes and edges T1 → T2 meaning T1 waits for a lock held by T2. If the graph contains a cycle, a deadlock exists. The DBMS then chooses a victim transaction to abort.

In Wound-Wait, what happens when a younger transaction requests a lock held by an older transaction?

  • A) The younger transaction wounds the older
  • B) The younger transaction waits
  • C) The older transaction dies
  • D) Both transactions proceed

Answer: B Explanation: In Wound-Wait, if a younger transaction requests a lock held by an older transaction, the younger waits. The rule is: “older wounds younger, younger waits for older.” This is the opposite of Wait-Die.

My Private Notes

Notes are auto-saved locally to this device.