CS FundamentalsModerateGATE CS (PYQ pattern)

A system uses UNDO-only logging; log records <T,item,old value> hold the value BEFORE the update. Log: <T1 start>, <T1,A,10>, <T2 start>, <T2,B,20>, <T1,C,30>, <T1 commit>, <T3 start>, <T3,A,15>, <T2,C,35>. Disk contents at the crash (all updates had reached disk): A = 40, B = 21, C = 50. Recovery scans the log backwards and restores old values for uncommitted transactions. What are (A, B, C) afterwards?

  1. A. (15, 20, 30)
  2. B. (15, 20, 35)
  3. C. (10, 20, 35)
  4. D. (40, 21, 50)

Correct answer: B. (15, 20, 35)

T1 committed (its new values stay: A = 15, C = 35). T2 and T3 did not commit, so their old values are restored in reverse order: B returns to 20, C's T2 write (old 35) restores C = 35, and T3's write restores A to its old value 15.

More DBMS and SQL questions

Exams that ask this topic