15 questions · 23 marks · 45 minutes. Negative marking on MCQ only: −1/3 mark for a wrong 1-mark MCQ, −2/3 for a wrong 2-mark MCQ. No negative marking for MSQ or NAT; MSQ has no partial credit.
Q1 · MCQ · 1 mark(s) — ACID
Which ACID property is mainly the programmer's responsibility?
- (A) Durability
- (B) Atomicity
- (C) Isolation
- (D) Consistency
Q2 · MCQ · 1 mark(s) — Anomaly
W1(A) R2(A) A1 shows a:
- (A) phantom
- (B) unrepeatable read
- (C) lost update
- (D) dirty read
Q3 · NAT · 2 mark(s) — Counting
T1 has 4 operations and T2 has 3. How many non-serial schedules?
Numerical answer: ________
Q4 · NAT · 1 mark(s) — Topological
Vertices T1, T2, T3, T4 with edges T1 → T2 and T3 → T4. How many topological orders?
Numerical answer: ________
Q5 · MCQ · 2 mark(s) — CS
S = R1(A) W2(A) R3(A) W1(B) R2(B) W3(B). Conflict serializable?
- (A) Yes, T1, T2, T3
- (B) Yes, T2, T1, T3
- (C) No
- (D) Yes, T1, T3, T2
Q6 · MCQ · 2 mark(s) — VS
S = R1(X) W2(X) W1(X) W3(X) R4(X). Which is true?
- (A) VS only as T4, T3, T2, T1
- (B) CS
- (C) VS, equivalent to T1, T2, T3, T4
- (D) Not VS
Q7 · MCQ · 1 mark(s) — Recoverability
R1(A) W1(A) R2(A) W2(A) C2 C1 is:
- (A) recoverable
- (B) not recoverable
- (C) cascadeless
- (D) strict
Q8 · MSQ · 2 mark(s) — Nesting
Which statements are true?
- (A) Strict ⊂ cascadeless.
- (B) Serial schedules are strict.
- (C) Recoverable ⊂ conflict serializable.
- (D) Cascadeless ⊂ recoverable.
Q9 · MCQ · 1 mark(s) — Locks
How many of the following lock requests are compatible with an S lock held by another transaction: S, X?
- (A) 2
- (B) depends on 2PL
- (C) 0
- (D) 1
Q10 · MCQ · 2 mark(s) — 2PL
Which transaction follows 2PL?
- (A) lock-X(A) unlock(A) lock-S(B) unlock(B)
- (B) lock-S(A) lock-X(B) unlock(A) unlock(B)
- (C) lock-X(B) unlock(B) lock-X(A) unlock(A)
- (D) lock-S(A) unlock(A) lock-S(A) unlock(A)
Q11 · MCQ · 1 mark(s) — Variants
Which protocol prevents cascading rollbacks?
- (A) Conservative 2PL alone
- (B) Basic timestamp ordering
- (C) Strict 2PL
- (D) Basic 2PL
Q12 · NAT · 2 mark(s) — Wait-die
Wait-die with TS(T1) = 3, TS(T2) = 6, TS(T3) = 9. Requests (each considered alone): T1 asks for an item held by T3; T3 asks for an item held by T2; T2 asks for an item held by T1. How many requests cause a rollback?
Numerical answer: ________
Q13 · NAT · 2 mark(s) — TO
TS(T1) = 1, TS(T2) = 2. Basic TO on R1(A) R2(A) W2(A) W1(A) R2(B). How many operations execute successfully?
Numerical answer: ________
Q14 · MCQ · 1 mark(s) — Granularity
Which lock lets a transaction read a whole table while updating some of its rows?
- (A) IS
- (B) SIX
- (C) IX
- (D) S
Q15 · MSQ · 2 mark(s) — Recovery
Immediate update. Log: ⟨T1 start⟩ ⟨T1, A, 4, 5⟩ ⟨T2 start⟩ ⟨T2, B, 1, 2⟩ ⟨checkpoint⟩ ⟨T2 commit⟩ ⟨T3 start⟩ ⟨T3, A, 5, 9⟩ — crash. Which are needed?
- (A) Redo T2
- (B) Undo T3
- (C) Undo T1
- (D) Redo T1
✓Answer Vault
Reveal answers when you’re ready
Q1 Answer: (D) · 1 mark(s)
Program logic.
- (A) is wrong: Recovery manager.
- (B) is wrong: Recovery manager.
- (C) is wrong: Concurrency control.
Re-read: Lesson 6.1.1 — Transaction basics: read/write, commit/abort, ACID, transaction states
Q2 Answer: (D) · 1 mark(s)
Read of uncommitted data that was rolled back.
- (A) is wrong: No.
- (B) is wrong: No.
- (C) is wrong: No double write.
Re-read: Lesson 6.2.1 — Concurrency problems: lost update, dirty read, unrepeatable read, phantom
Q3 Answer: 33 · 2 mark(s)
7!/(4!3!) = 35; minus 2.
Re-read: Lesson 6.3.1 — Schedules: serial vs concurrent; counting possible schedules
Q4 Answer: 6 · 1 mark(s)
24/4.
Re-read: Lesson 6.4.1 — Directed graph primer: cycles, topological order
Q5 Answer: (A) · 2 mark(s)
R1(A)–W2(A): T1 → T2; W2(A)–R3(A): T2 → T3; W1(B)–R2(B): T1 → T2; W1(B)–W3(B): T1 → T3; R2(B)–W3(B): T2 → T3. Order T1, T2, T3.
- (B) is wrong: T1 → T2 exists.
- (C) is wrong: Acyclic.
- (D) is wrong: T2 → T3 exists.
Re-read: Lesson 6.4.2 — Conflict serializability: conflicting ops, precedence graph, equivalent serial orders
Q6 Answer: (C) · 2 mark(s)
T1 reads initial X; T4 reads from T3; final writer T3. Serial T1, T2, T3, T4 matches. Not CS (T1 ⇄ T2 cycle).
- (A) is wrong: T4 must read from T3.
- (B) is wrong: Cycle between T1 and T2.
- (D) is wrong: It is VS.
Re-read: Lesson 6.4.3 — View serializability; blind writes; relation to conflict serializability
Q7 Answer: (B) · 1 mark(s)
T2 reads from T1 and commits first.
- (A) is wrong: No.
- (C) is wrong: No.
- (D) is wrong: No.
Re-read: Lesson 6.5.1 — Recoverable, cascadeless and strict schedules; how they nest
Q8 Answer: (A) (B) (D) · 2 mark(s)
Recoverability and serializability are independent.
- (C) is wrong: Independent.
Re-read: Lesson 6.5.1 — Recoverable, cascadeless and strict schedules; how they nest
Q9 Answer: (D) · 1 mark(s)
Only S.
- (A) is wrong: X is not.
- (B) is wrong: Compatibility does not depend on 2PL.
- (C) is wrong: S is compatible.
Re-read: Lesson 6.6.1 — Shared/exclusive locks; compatibility matrix
Q10 Answer: (B) · 2 mark(s)
All locks before the first unlock.
- (A) is wrong: Locks after unlocking.
- (C) is wrong: Locks after unlocking.
- (D) is wrong: Locks after unlocking.
Re-read: Lesson 6.6.2 — Two-phase locking: growing/shrinking, lock point, guarantees
Q11 Answer: (C) · 1 mark(s)
X locks held until commit.
- (A) is wrong: Can release early.
- (B) is wrong: Not recoverable automatically.
- (D) is wrong: Can cascade.
Re-read: Lesson 6.6.3 — Strict, rigorous and conservative 2PL
Q12 Answer: 2 · 2 mark(s)
T1 older than T3: waits. T3 younger than T2: dies. T2 younger than T1: dies.
Re-read: Lesson 6.6.4 — Deadlocks: wait-for graph, wait-die, wound-wait, starvation
Q13 Answer: 4 · 2 mark(s)
R1(A), R2(A), W2(A) ok; W1(A): 1 < RTS 2 → T1 aborts; R2(B) ok.
Re-read: Lesson 6.7.1 — Timestamp ordering protocol; Thomas write rule
Q14 Answer: (B) · 1 mark(s)
S on the table plus intention to write below.
- (A) is wrong: Only reads below.
- (C) is wrong: Does not read the whole table.
- (D) is wrong: Cannot update rows.
Re-read: Lesson 6.8.1 — Multiple granularity, validation-based protocol, log-based recovery
Q15 Answer: (A) (B) (C) · 2 mark(s)
T1 never committed: undo. T2 committed after the checkpoint: redo. T3 never committed: undo.
- (D) is wrong: T1 did not commit.
Re-read: Lesson 6.8.1 — Multiple granularity, validation-based protocol, log-based recovery