Module Quiz
Complete this quiz after finishing all concept and practice pages. Save your answers before opening separate quiz calibration.
Current Module Questions
Question 1: ACID Property Mapping
Which of A, C, I, D is most directly supported by each mechanism: (a) the write-ahead log; (b) a foreign-key constraint; (c) row-level write locks; (d) an fsync on COMMIT; (e) a CHECK constraint?
Question 2: ARIES Recovery
During recovery from this log, what does ARIES redo and undo?
10 T1 BEGIN
11 T1 UPDATE x: 5 -> 7
12 CHECKPOINT (active: T1; data file x=5)
13 T2 BEGIN
14 T2 UPDATE y: 2 -> 4
15 T1 COMMIT
16 T3 BEGIN
17 T3 UPDATE z: 8 -> 9
-- crash --
Question 3: Anomaly Identification
A transaction T_total reads account A (balance 500), then account B (balance 200), and returns the sum. Concurrently, T_xfer transfers 100 from A to B. T_total returns 600 when the true sum should be 700. Name the anomaly and the weakest isolation level that prevents it.
Question 4: Anomaly Identification
Two concurrent transactions each execute:
SELECT COUNT(*) FROM doctors WHERE on_call; -- both return 2
UPDATE doctors SET on_call = FALSE WHERE name = 'self';
Both commit under PostgreSQL REPEATABLE READ. The "at least one on-call" invariant is now violated. Name the anomaly and the weakest prevention.
Question 5: Isolation-Level Choice
A workflow reads a user's current profile, validates a change, and writes the new version. Two admins sometimes edit the same profile concurrently. Choose the weakest PostgreSQL isolation level that prevents lost updates without over-serializing, and name an alternative primitive.
Question 6: Anomaly Identification
An inventory system sold the last item twice because two checkouts both read quantity = 1, both decremented, and both committed. Name the anomaly and give two distinct preventions.
Question 7: Anomaly Identification
Two users sign up simultaneously with the same email. Each transaction ran SELECT 1 FROM users WHERE email = ? (no row), then INSERT INTO users (email, ...). Both succeeded under READ COMMITTED. Name the anomaly and two preventions.
Question 8: Isolation-Level Choice
A dashboard issues a read-only query computing totals, revenue, and counts across many tables. Latency matters; stale-by-a-few-seconds is fine. Choose the right isolation/read strategy on PostgreSQL.
Question 9: 2PL vs SI Pick
For a workload of 80% short writes, 20% long reads, which concurrency-control scheme reduces contention: 2PL or SI/MVCC? Why?
Question 10: 2PC Failure Mode
In 2PC, a participant has replied PREPARED and the coordinator then crashes before sending COMMIT or ABORT. What must the participant do, and why can it not unilaterally abort?
Question 11: Saga Design
For a travel-booking workflow (reserve flight, reserve hotel, charge card), write the compensations for each step and identify any that resist compensation.
Question 12: Linearizability Analysis
Is this history linearizable? C1: write(x, 1) (t=1-2); C2: read(x) -> 0 (t=3-4); C3: read(x) -> 1 (t=5-6); C4: read(x) -> 0 (t=7-8).
Question 13: Causal vs Eventual
Give a concrete anomaly that causal consistency prevents but eventual consistency allows.
Question 14: CAP and PACELC
A vendor says "we provide strong consistency and high availability." Apply CAP and PACELC honestly. What question do you ask to force clarity?
Question 15: Isolation-Level Choice
An audit job reads the entire transactions table once and writes an aggregated report to another table. Concurrent writers are constantly inserting new transactions. What isolation level produces a consistent snapshot without aborting the audit, and what is the cost?
Interleaved Review Questions
Prior Module Question 1 (S6 Module 3: Replication)
What is the difference between synchronous and asynchronous replication, and which ACID property is most affected by the choice?
Prior Module Question 2 (S6 Module 2: Storage Engines)
Why is a log-structured merge-tree (LSM) write-optimized compared to a B-tree?
Prior Module Question 3 (S6 Module 1: SQL)
Explain why declarative UPDATE counter SET n = n + 1 WHERE id = $id is usually better than SELECT n ... / UPDATE n = $computed for concurrency.
Prior Module Question 4 (S5 Module 3: OS memory)
Why does an fsync on a database commit not fully guarantee durability in the presence of a hardware write cache?
Prior Module Question 5 (S5 Module 4: Networks)
In a data-center network, why is "message delay is unbounded" a more accurate assumption than "message delay is bounded with high probability"?
Self-Assessment and Remediation
Mastery Level (90-100% correct):
- Ready for Module 5 (distributed systems fundamentals) with confidence.
Proficient Level (75-89% correct):
- Review missed concepts, redo one practice lab for each missed area.
Developing Level (60-74% correct):
- Redo Practice 1 (anomalies lab) end to end. The gap is almost always in the anomaly-recognition reflex.
Insufficient Level (<60% correct):
- Restart with Cluster 2 (anomalies). Most likely issue: pattern-matching isolation levels without simulating the interleaving. Work every anomaly by hand on paper before touching code.
Progression boundary
Quiz performance calibrates retrieval and reasoning. It does not replace runnable work, changed-case transfer, the module assessment or required semester evidence. Consult practice calibration for the additional independent cases.