Transaction · Databases
38 questions · asked in 20 of 27 years (2000–2026)
MCQ 32 · MSQ 5 · NAT 11-mark 19 · 2-mark 19
2000Questions per year2026
Questions 21–25 of 38
Consider a simple checkpointing protocol and the following set of operations in the log.
(start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7);
(checkpoint);
(start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3), (write, T3, z, 7, 2);
If a crash happens now and the system tries to recover using both undo and redo operations, what are the contents of the undo list and the redo list?
(start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7);
(checkpoint);
(start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3), (write, T3, z, 7, 2);
If a crash happens now and the system tries to recover using both undo and redo operations, what are the contents of the undo list and the redo list?
Answer: (A)
Going through each transaction:
- T4 committed before the checkpoint it is already safe, so nothing is needed.
- T1 started before the checkpoint and did not commit undo it.
- T2 committed after the checkpoint redo it.
- T3 did not commit undo it.
Answer: Undo: T3, T1; Redo: T2
- T4 committed before the checkpoint it is already safe, so nothing is needed.
- T1 started before the checkpoint and did not commit undo it.
- T2 committed after the checkpoint redo it.
- T3 did not commit undo it.
Answer: Undo: T3, T1; Redo: T2
Consider the following partial Schedule S involving two transactions T1 and T2. Only the read and the write operations have been shown. The read operation on data item P is denoted by read(P) and the write operation on data item P is denoted by write(P).
Suppose that the transaction T1 fails immediately after time instance 9. Which one of the following statements is correct?
Suppose that the transaction T1 fails immediately after time instance 9. Which one of the following statements is correct?
Answer: (B)
T1 writes A at time 2. T2 then reads that value of A at time 7. T2 commits at time 8, and this is before T1 commits.
T1 fails after that. T2 has already committed after using a value of A that must be rolled back. T2's effects cannot be undone, so S is non-recoverable.
Answer: Schedule S is non-recoverable and cannot ensure transaction atomicity
T1 fails after that. T2 has already committed after using a value of A that must be rolled back. T2's effects cannot be undone, so S is non-recoverable.
Answer: Schedule S is non-recoverable and cannot ensure transaction atomicity
Consider the following four schedules due to three transactions (indicted by the subscript) using read and write on a data item x, denoted by r(x) and w(x) respectively. Which one of them is conflict serializable?
Answer: (D)
Build the precedence graph of each schedule. Two operations on conflict when they come from different transactions and at least one is a write.
- (A) r1(x); r2(x); w1(x); r3(x); w2(x): r2 comes before w1, so . Also r1 comes before w2, so . Cycle.
- (B) r2(x); r1(x); w2(x); r3(x); w1(x): r1 comes before w2, so . Also r2 comes before w1, so . Cycle.
- (C) r3(x); r2(x); r1(x); w2(x); w1(x): r1 comes before w2, so . Also r2 comes before w1, so . Cycle.
- (D) r2(x); w2(x); r3(x); r1(x); w1(x): w2 comes before r3 and r1, so and . r3 comes before w1, so . There is no cycle, so the schedule is conflict equivalent to the serial order .
Answer: (D)
- (A) r1(x); r2(x); w1(x); r3(x); w2(x): r2 comes before w1, so . Also r1 comes before w2, so . Cycle.
- (B) r2(x); r1(x); w2(x); r3(x); w1(x): r1 comes before w2, so . Also r2 comes before w1, so . Cycle.
- (C) r3(x); r2(x); r1(x); w2(x); w1(x): r1 comes before w2, so . Also r2 comes before w1, so . Cycle.
- (D) r2(x); w2(x); r3(x); r1(x); w1(x): w2 comes before r3 and r1, so and . r3 comes before w1, so . There is no cycle, so the schedule is conflict equivalent to the serial order .
Answer: (D)
Consider the following schedule S of transactions T1, T2, T3, T4:
Which one of the following statements is CORRECT?
Which one of the following statements is CORRECT?
Answer: (C)
Sequence of operations: R2(X), W3(X), C3, W1(X), C1, W2(Y), R2(Z), C2, R4(X), R4(Y), C4.
Conflict edges are: T2 T3, T2 T1, T3 T1 (on X), T1 T4, T3 T4 (on X), and T2 T4 (on Y). The graph has no cycle so S is conflict serializable, with order T2, T3, T1, T4.
T4 reads X from T1 and Y from T2. Both of them commit before T4 commits so S is recoverable.
Answer: S is both conflict-serializable and recoverable
Conflict edges are: T2 T3, T2 T1, T3 T1 (on X), T1 T4, T3 T4 (on X), and T2 T4 (on Y). The graph has no cycle so S is conflict serializable, with order T2, T3, T1, T4.
T4 reads X from T1 and Y from T2. Both of them commit before T4 commits so S is recoverable.
Answer: S is both conflict-serializable and recoverable
Consider the transactions T1, T2, and T3 and the schedules S1 and S2 given below.
T1 : r1(X); r1(Z); w1(X); w1(Z)
T2 : r2(Y); r2(Z); w2(Z)
T3 : r3(Y); r3(X); w3(Y)
S1: r1(X); r3(Y); r3(X); r2(Y); r2(Z); w3(Y); w2(Z); r1(Z); w1(X); w1(Z)
S2: r1(X); r3(Y); r2(Y); r3(X); r1(Z); r2(Z); w3(Y); w1(X); w2(Z); w1(Z)
Which one of the following statements about the schedules is TRUE?
T1 : r1(X); r1(Z); w1(X); w1(Z)
T2 : r2(Y); r2(Z); w2(Z)
T3 : r3(Y); r3(X); w3(Y)
S1: r1(X); r3(Y); r3(X); r2(Y); r2(Z); w3(Y); w2(Z); r1(Z); w1(X); w1(Z)
S2: r1(X); r3(Y); r2(Y); r3(X); r1(Z); r2(Z); w3(Y); w1(X); w2(Z); w1(Z)
Which one of the following statements about the schedules is TRUE?
Answer: (A)
Draw the precedence graph for each schedule: add when an operation of comes before a conflicting operation of on the same item.
S1: r2(Y) comes before w3(Y), so . r3(X) comes before w1(X), so . r2(Z) and w2(Z) come before r1(Z) and w1(Z), so . The graph has no cycle, so S1 is conflict serializable (order ).
S2: r1(Z) comes before w2(Z), so . r2(Z) comes before w1(Z), so . The graph has a cycle, so S2 is not conflict serializable.
Answer: (A)
S1: r2(Y) comes before w3(Y), so . r3(X) comes before w1(X), so . r2(Z) and w2(Z) come before r1(Z) and w1(Z), so . The graph has no cycle, so S1 is conflict serializable (order ).
S2: r1(Z) comes before w2(Z), so . r2(Z) comes before w1(Z), so . The graph has a cycle, so S2 is not conflict serializable.
Answer: (A)
Keep practising