Log-recovery MCQs are rarely solved by recognising the word rollback. You must first classify committed winners and uncommitted losers, then decide whether the update policy needs REDO, UNDO or both. WAL, checkpoints, crash recovery, redo logs, SQL rollback and pre-commit visibility are central topics in log-based recovery. Choose an option before reading each answer. Pause, mark the log, and compute before checking. KnowledgeGate has over 10 practice questions on Log-Based Recovery Techniques, and you can place this topic within the wider GATE CS Exam Preparation path.
The winner-loser rule for immediate-update recovery logs
What the log shows | Classification | Recovery action |
|---|---|---|
| Winner | REDO from new values if needed |
Transaction started but has no | Loser | UNDO using old values under immediate update |
Deferred update | Uncommitted data never reaches the database | Only committed work may need REDO |
With immediate update and steal/no-force, REDO winners and UNDO losers. Write-ahead logging requires the relevant log record to reach stable storage before its dirty data page reaches disk. The commit record must also be durable before success is reported.
Recovery status comes first, values second. REDO reads new values forward; UNDO restores old values, normally while scanning a loser's actions backward.
Take A=800 and B=300, followed by <START T1>, <T1,A,800,650>, <START T2>, <T2,B,300,420>, <COMMIT T1>, then a crash. T1 is the winner; T2 is the loser. Because the page-flush state is unknown, REDO T1, setting A=650. Then UNDO T2, restoring B=300. The recovered state is therefore A=650, B=300.
Log-Based Recovery MCQs 1-3: WAL and checkpoints
Question 1
What does the Write-Ahead Logging (WAL) protocol ensure in terms of database recovery?
A. A transaction's changes are written to the log before the changes are applied to the database.
B. The database is always in a consistent state after a system crash.
C. Changes are applied to the database and log simultaneously.
D. All transaction logs are deleted once the transaction is committed.
Answer: A.
WAL guarantees log-before-page ordering. Durable records enable redo or undo after a crash. It does not mean every data page is already consistent.
Question 2
__________ rules used to limit the volume of log information that has to be handled and processed in the event of system failure involving the loss of volatile information.
A. Write-ahead log
B. Check-pointing
C. Log buffer
D. Thomas
Answer: B.
A checkpoint bounds the log history normally examined at restart. WAL controls write order, a log buffer is volatile storage, and Thomas' Write Rule concerns timestamps.
Question 3
_____ is the point of synchronisation between the database and the transaction log file in database management system.
A. Checkpoint
B. Shadow point
C. Mapping point
D. Key point
Answer: A.
A checkpoint connects recoverable database state to a known log position. The other terms are not standard recovery synchronisation markers.
Log-Based Recovery MCQs 4-5: build the UNDO and REDO sets
Question 4
Consider the following set of operations in the log.
(start, T0);
(write, T0, A, 500, 200);
(write, T0, A, 100, 110);
(start, T1);
(commit, T0);
(write, T1, B, 400, 200);
(commit, T1);
(start, T2);
(write, T2, A, 200, 1800);
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?
A. Undo: T2 then undo: T0 then Redo: T1
B. Redo: T2 then undo: T0 then undo: T1
C. Undo: T2 then redo: T0 then Redo: T1
D. Redo: T2 then undo: T0 then Redo: T1
Answer: C.
T0 and T1 committed, so both enter REDO. T2 wrote A: 200 -> 1800 without committing, so UNDO restores A=200. Only C classifies all three correctly.
Question 5
Consider the following sequence of two transactions on a bank account (𝐴) with initial balance 20,000 that transfers 5,000 to another account (𝐵) and then apply 10% interest.
(i) T1 start
(ii) T1 A old=20,000 new 15,000
(iii) T1 B old = 12,000 new = 17,000
(iv) T1 commit
(v) T2 start
(vi) T2 A old = 15,000 new = 16,500
(vii) T2 commit
Suppose the database system crashes just before log record (vii) is written. When the system is restarted, which one statement is true of the recovery process?
A. We must redo log record (vi) to set 𝐴 to 16,500
B. We must undo log record (vi) to set 𝐴 to 16,500 and then redo log records (ii) and (iii)
C. We need not redo log records (ii) and (iii) because transaction 𝑇1 is committed
D. We can apply redo and undo operations in arbitrary order because they are idempotent
Intended answer: B, but the option contains a numerical error.
T1 committed, so its transfer leaves A=15,000 and B=17,000. T2 did not commit, so recovery must undo its 10% interest update and restore A from 16,500 to 15,000, while redoing T1 if needed. Option B has the right UNDO/REDO classification but incorrectly says that UNDO sets A to 16,500. The recovered state is A=15,000 and B=17,000.
Log-Based Recovery MCQs 6-7: two versions of the same crash trace
Question 6
Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest.
1. T1 start
2. T1 B old=12000 new=10000
3. T1 M old=0 new=2000
4. T1 commit
5. T2 start
6. T2 B old=10000 new=10500
7. T2 commitSuppose the database system crashes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?
A. We must redo log record 6 to set B to 10500
B. We must undo log record 6 to set B to 10000 and then redo log records 2 and 3.
C. We need not redo log records 2 and 3 because transaction T1 has committed.
D. We can apply redo and undo operations in arbitrary order because they are idempotent
Answer: B.
T1 committed, leaving B=10,000, M=2,000. T2 is a loser because record 7 is absent. Undo 10,500 to 10,000; redo T1 if needed. Final: B=10,000, M=2,000.
Question 7
Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest. 1. T1 start 2. T1 B old=1200 new=10000 3. T1 M old=0 new=2000 4. T1 commit 5. T2 start 6. T2 B old=10000 new=10500 7. T2 commit Suppose the database system crashes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?
A. We must redo log record 6 to set B to 10500
B. We must undo log record 6 to set B to 10000 and then redo log records 2 and 3
C. We need not redo log records 2 and 3 because transaction T1 has committed
D. We can apply redo and undo operations in arbitrary order because they are idempotent.
Answer: B.
T1 committed, so redo its transfer if needed; T2 did not commit, so undo its interest update from 10,500 to 10,000. The old value 1,200 in record 2 is a typo because it conflicts with both the stated initial balance of 12,000 and the transfer to 10,000. The recovered state is B=10,000 and M=2,000.
Log-Based Recovery MCQ 8: interpreting a malformed redo-log option
Question 8
The easiest way in which we can transfer control is when the old backup site sends ________ to the old primary.
A. Red logs
B. Primary Logs
C. Undo Logs
D. All of the above
Intended answer: A; “Red logs” should read “redo logs”.
Redo logs carry committed changes that the receiving site can replay during control transfer. Undo logs instead reverse uncommitted work, so option C does not fit. Option A is the intended choice after correcting its missing letter.
Log-Based Recovery MCQs 9-11: ROLLBACK and visibility before COMMIT
Question 9
In SQL, ROLLBACK is used to _________.
A. Undo all the previous changes
B. Cut changes
C. Paste changes
D. End changes
Answer: A.
ROLLBACK reverses the current transaction's uncommitted changes to the last commit boundary, or to a named savepoint. It cannot reverse an earlier commit.
Question 10
Which of the following statements is false?
A. Rolling back the entire transaction erases all of its save points.
B. Rolling back the entire transaction reverses all of its changes.
C. Rolling back the entire transaction does not end the transaction.
D. Rolling back the entire transaction releases any transaction locks.
Answer: C.
A full rollback ends the transaction, reverses uncommitted changes, removes savepoints and releases locks. ROLLBACK TO SAVEPOINT keeps the transaction active.
Question 11
Before commit work in DBMS :
A. The changes you made are not visible to you nor to other developers of the database instant.
B. The changes you made are visible to you and to other developers of the database instant.
C. The changes you make are not final, but you can not do it with rollback statement as before.
D. The changes made by you are visible only to you, but not to others users of the database instant.
Answer: D.
The transaction reads its own uncommitted writes; other transactions ordinarily cannot. They remain reversible until commit. “Database instant” means database instance here, subject to isolation settings.
Recovery traps exposed by these 11 MCQs and the next practice step
Rule to remember | Questions |
|---|---|
WAL is log-before-data | Q1 |
A checkpoint bounds restart work | Q2-Q3 |
The commit record separates winners from losers | Q4-Q7 |
Redo carries committed history | Q8 |
Full rollback differs from savepoint rollback | Q9-Q11 |
Use one routine: scan commits, form REDO and UNDO sets, replay winners forward with new values, undo losers backward with old values, then compute the result.
Practise DBMS Transaction MCQs, Transactions & Concurrency Control in DBMS, and DBMS MCQs.
Re-solve Q4-Q7 without explanations to practise winner-loser computation. Use GATE Guidance by Sanchit Sir for DBMS learning and the GATE Test Series for timed practice.




