0
0
DBMS Theoryknowledge~20 mins

Distributed transactions and 2PC in DBMS Theory - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Distributed Transactions Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding the Two-Phase Commit Protocol

What is the main purpose of the Two-Phase Commit (2PC) protocol in distributed transactions?

ATo speed up transaction processing by allowing partial commits in distributed systems.
BTo ensure all participating databases either commit or abort a transaction together, maintaining consistency.
CTo allow transactions to commit independently on each node without coordination.
DTo replicate data asynchronously across distributed databases.
Attempts:
2 left
💡 Hint

Think about how distributed systems keep data consistent when multiple databases are involved.

📋 Factual
intermediate
2:00remaining
Phases of the Two-Phase Commit Protocol

Which two phases correctly describe the Two-Phase Commit protocol?

AStart phase and End phase
BLock phase and Unlock phase
CVote phase and Execute phase
DPrepare phase and Commit phase
Attempts:
2 left
💡 Hint

One phase asks participants if they are ready, the other finalizes the decision.

🔍 Analysis
advanced
2:00remaining
Handling Coordinator Failure in 2PC

In a Two-Phase Commit protocol, what happens if the coordinator fails after sending the prepare message but before sending the commit or abort decision?

AParticipants remain blocked, waiting indefinitely for the coordinator's decision.
BParticipants automatically abort the transaction after a timeout.
CParticipants commit the transaction immediately after prepare phase.
DParticipants elect a new coordinator and proceed without delay.
Attempts:
2 left
💡 Hint

Consider what participants do when they don't receive the final decision after voting.

Comparison
advanced
2:00remaining
Comparing 2PC and 3PC Protocols

Which statement correctly distinguishes the Three-Phase Commit (3PC) protocol from the Two-Phase Commit (2PC) protocol?

A3PC adds an extra phase to avoid blocking participants during coordinator failure, unlike 2PC.
B3PC is faster than 2PC because it skips the prepare phase.
C2PC allows participants to commit independently, while 3PC requires strict coordination.
D2PC uses asynchronous messaging, whereas 3PC uses synchronous messaging only.
Attempts:
2 left
💡 Hint

Think about how protocols handle failures and participant blocking.

Reasoning
expert
2:00remaining
Impact of Network Partition on 2PC

During a distributed transaction using 2PC, a network partition occurs isolating some participants from the coordinator. What is the most likely outcome for the isolated participants?

AThey automatically abort the transaction after detecting the partition.
BThey elect a new coordinator and proceed with the transaction.
CThey remain in a prepared state, unable to commit or abort until the partition resolves.
DThey commit the transaction independently to avoid delays.
Attempts:
2 left
💡 Hint

Consider what participants do when they cannot communicate with the coordinator after voting.