Recovery Management MCQs for NSCT

By the NSCT Exam Editorial Team · Updated 2026-11-24 · Facts checked against official sources on 2026-11-24

Recovery management is how a DBMS brings the database back to a correct state after a failure: committed work must survive (durability) and uncommitted work must vanish (atomicity). It does this with a log, checkpoints, and undo and redo passes over that log. Recovery Management is topic 11 of the Databases area, which carries 10% of the NSCT according to HEC's Areas of Competencies. In 2026 candidates averaged 42.3% in Databases, per the HEC NSCT report and APP.

Failures come in three kinds. A transaction failure (an error or a deadlock victim) affects one transaction. A system crash wipes main memory but leaves the disk. A disk (media) failure destroys stored data and needs an archival dump plus the log. Most exam questions are about system crashes.

Logs

The log is a sequential file on stable storage that records every change. Using Silberschatz's notation:

Record Meaning
<T1 start> T1 has begun
<T1, A, 100, 150> T1 wrote A: old value 100 (for undo), new value 150 (for redo)
<T1 commit> T1 committed
<T1 abort> T1's rollback is complete

The write-ahead logging (WAL) rule says a page's log records must reach stable storage before the page itself is written to disk. A transaction counts as committed once its commit record is in the stable log (Elmasri-Navathe call this the commit point).

Buffer policies decide which operations recovery needs:

Policy Meaning Consequence
Steal Uncommitted pages may be written to disk Needs undo
No-force Commit does not force pages to disk Needs redo

So steal/no-force, the usual choice, needs both. Exam angle: deferred update is NO-UNDO/REDO, and immediate update with steal/no-force is UNDO/REDO.

Checkpoints

A checkpoint limits how much of the log recovery must read. In the simple version, the system pauses updates, writes all modified buffers to disk, and writes a <checkpoint L> record, where L lists the active transactions. A fuzzy checkpoint lets transactions continue while buffers are flushed.

After a crash, a transaction that committed before the last checkpoint needs nothing, because its pages were flushed. Exam angle: a transaction that was active at the checkpoint may have written pages before it, so its undo must read back past the checkpoint to its <T start> record.

Undo/redo

Undo writes old values, scanning the log backward. Redo writes new values, scanning forward. Textbooks give two versions:

Both give the same final values. Take this log with a sharp checkpoint:

<T1 start>
<T1, A, 5, 9>
<T1 commit>
<T2 start>
<T2, B, 2, 4>
<checkpoint {T2}>
<T3 start>
<T3, A, 9, 11>
<T3 commit>
--- crash ---

T1 needs nothing, T3 is redone (A = 11) and T2 is undone (B = 2). Exam angle: redo must be idempotent, because recovery itself can crash and run again. Writing a stored after-image is idempotent; re-applying "A := A + 10" is not.

Common traps

Worked examples

Understanding. Which buffer-policy combination needs both undo and redo at restart? Answer: steal with no-force. Steal lets uncommitted changes reach disk (undo), and no-force lets committed changes be missing from disk (redo).

Application. The log is <T5 start>, <T5, P, 8, 12>, <T6 start>, <T6, Q, 3, 9>, <T5 commit>, then a crash. What are P and Q after UNDO/REDO recovery? Answer: P = 12, Q = 3. T5 committed, so P is redone to 12. T6 did not, so Q is undone to its before-image 3.

Analysis. The log is <T1 start>, <T1, A, 1, 2>, <checkpoint {T1}>, <T2 start>, <T2, B, 5, 6>, <T2 commit>, <T1, C, 7, 8>, then a crash. What are A, B and C? Answer: A = 1, B = 6, C = 7. T2 committed after the checkpoint and is redone. T1 is a loser: both its writes are undone, including A, which it wrote before the checkpoint.

Practise

The quiz below has 100 Recovery Management questions, which you can filter by tier and difficulty.

Practise: 100 questions

Interactive quiz loading. The first 10 questions are shown below.

  1. In Silberschatz's notation, what does the log record <Ti, X, V1, V2> store?

    1. Transaction Ti read X twice and got V1 and then V2
    2. Transaction Ti wrote data item X; V1 is the old value and V2 the new value
    3. Ti holds locks on items V1 and V2 of table X
    4. Ti wrote X; V1 is the new value and V2 the old value
    Show answer

    Answer: B. Transaction Ti wrote data item X; V1 is the old value and V2 the new value

    An update log record names the transaction, the data item, the old value (before-image, used for undo) and the new value (after-image, used for redo). Elmasri-Navathe write the same thing as [write_item, T, X, old_value, new_value].

  2. What does the write-ahead logging (WAL) rule require?

    1. A data page must be written to disk before its log records
    2. The log records for a data page must reach stable storage before that page is written to disk
    3. Every page a transaction changed must be written to disk before it commits
    4. The log must be written only at checkpoints
    Show answer

    Answer: B. The log records for a data page must reach stable storage before that page is written to disk

    WAL says the undo information in the log must be on stable storage before the changed page overwrites the disk copy. Otherwise a crash could leave a change on disk with no old value to undo it. The commit record and all redo information must also be forced before commit.

  3. What is the main purpose of taking a checkpoint?

    1. To make a backup copy of the whole database for media failure
    2. To release all locks held by active transactions
    3. To commit every active transaction
    4. To limit how much of the log must be scanned and redone after a crash
    Show answer

    Answer: D. To limit how much of the log must be scanned and redone after a crash

    At a checkpoint the system writes modified buffers to disk and records which transactions are active. After a crash, work committed before the checkpoint is already on disk, so recovery can start from the last checkpoint instead of the start of the log.

  4. Which kind of failure needs an archival copy (database dump) of the database to recover from?

    1. A disk (media) failure that destroys the stored data
    2. A transaction that divides by zero
    3. A system crash that wipes main memory
    4. A deadlock detected by the lock manager
    Show answer

    Answer: A. A disk (media) failure that destroys the stored data

    Transaction failures and system crashes leave the disk intact, so the log is enough. A disk failure destroys the stored database itself, so recovery restores the last archival dump and then redoes committed work from the log.

  5. The deferred update technique (no data written to the database until commit) is known as which recovery algorithm?

    1. UNDO/NO-REDO
    2. NO-UNDO/REDO
    3. UNDO/REDO
    4. NO-UNDO/NO-REDO
    Show answer

    Answer: B. NO-UNDO/REDO

    With deferred update nothing reaches the database before the transaction commits, so an uncommitted transaction never needs undoing. Committed work may still be only partly on disk at a crash, so it must be redone. Hence NO-UNDO/REDO (Elmasri-Navathe).

  6. With immediate update, where pages may reach disk before commit and commit does not force pages, which operations can recovery need?

    1. Undo only
    2. Both undo and redo
    3. Redo only
    4. Neither undo nor redo
    Show answer

    Answer: B. Both undo and redo

    Immediate update lets uncommitted changes reach the disk, so they may need undoing. Because commit does not force all pages, committed changes may be missing from the disk and need redoing. This is the UNDO/REDO algorithm.

  7. If the buffer manager uses a steal policy, which recovery operation becomes necessary?

    1. Redo
    2. Undo
    3. Neither undo nor redo
    4. Only archival restore
    Show answer

    Answer: B. Undo

    Steal lets a page changed by an uncommitted transaction be written to disk to free a buffer frame. If that transaction then aborts or the system crashes, the change on disk must be undone, so the log must keep before-images.

  8. If the buffer manager uses a no-force policy, which recovery operation becomes necessary?

    1. Undo
    2. Redo
    3. Neither undo nor redo
    4. Shadow-page swapping
    Show answer

    Answer: B. Redo

    No-force means a transaction can commit before all its changed pages are on disk. After a crash those committed changes may be lost from the disk, so they must be redone from the after-images in the log.

  9. Why must redo operations be idempotent?

    1. The system may crash during recovery, so the same redo can be applied more than once
    2. Redo is applied only to transactions that never committed
    3. Idempotent operations use less log space
    4. The undo phase runs before the redo phase
    Show answer

    Answer: A. The system may crash during recovery, so the same redo can be applied more than once

    An idempotent operation gives the same result whether applied once or many times. Writing a logged after-image (set X to 25) is idempotent, so if recovery itself crashes and restarts, repeating the redo is harmless.

  10. At what point is a transaction considered committed in log-based recovery?

    1. When its commit log record has been written to stable storage
    2. When all its data pages have been written to disk
    3. When it releases its first lock
    4. When the next checkpoint is taken
    Show answer

    Answer: A. When its commit log record has been written to stable storage

    Once the commit record is safely in the stable log, recovery can always redo the transaction, so it counts as committed even if none of its pages are on disk yet. Elmasri-Navathe call this the commit point.

FAQs

What is the difference between undo and redo?

Undo reverses an uncommitted transaction's changes by writing the old values from the log, scanning backward. Redo reapplies a committed transaction's changes by writing the new values, scanning forward. Undo enforces atomicity and redo enforces durability, and a steal/no-force system needs both.

Why is a checkpoint needed in recovery?

Without one, recovery would have to scan and redo the whole log from the start. A checkpoint flushes modified pages and records the active transactions, so work committed before it is already safe on disk. Recovery can start near the last checkpoint, reading earlier records only to undo transactions that were active at it.

What is write-ahead logging?

Write-ahead logging (WAL) requires the log records describing a change to be on stable storage before the changed page is written to disk, and all of a transaction's log records to be forced before it commits. Without WAL, a crash could leave an uncommitted change on disk with no old value to undo it.

Next step

Continue with Indexing & File Organization MCQs, go back to the Databases hub, or try a timed NSCT mock test.