Transaction Management and Concurrency Control - ACID properties, serializability, lock-based concurrency control (2PL, deadlocks), time-stamping methods, optimistic methods - Question Bank

1. In timestamp ordering, if a transaction T attempts to write a data item X, and T's timestamp is less than RTS(X), what is the outcome?
A) The write is performed, and RTS(X) is updated to T's timestamp.
B) The write is rejected, and T is aborted.
C) The write is delayed until T's timestamp is greater than RTS(X).
D) The write is performed, but a warning is logged.
2. What is the primary disadvantage of using Strict 2PL compared to basic 2PL?
A) It can lead to more deadlocks
B) It reduces concurrency by holding locks longer
C) It requires more complex lock management
D) It is not serializable
3. Which lock mode prevents any other transaction from reading or writing the data item?
A) Shared Lock (S-lock)
B) Exclusive Lock (X-lock)
C) Update Lock (U-lock)
D) Intent Lock (I-lock)
4. The concept of 'serializability' is crucial for ensuring:
A) Data backup
B) Database security
C) Data integrity in concurrent environments
D) Network connectivity
5. Which isolation level allows dirty reads?
A) Read Committed
B) Repeatable Read
C) Serializable
D) Read Uncommitted
6. What is a 'dirty read' phenomenon?
A) A transaction reads data that has been modified by another transaction but not yet committed
B) A transaction reads data that has been deleted by another transaction
C) A transaction reads data that it has previously read
D) A transaction reads uncommitted data
7. Which of the following is a key consideration when choosing a concurrency control method?
A) The number of available disk drives
B) The expected frequency of conflicts
C) The programming language used
D) The operating system version
8. What is the purpose of a 'commit record' in transaction logging?
A) To indicate that a transaction has failed
B) To mark the successful completion of a transaction
C) To store the initial state of data items
D) To record read operations
9. In write-ahead logging, before modifying a data item on disk, the change must first be written to:
A) The transaction's private workspace
B) The transaction log
C) A temporary file
D) The database buffer cache
10. What is a 'write-ahead logging' (WAL) technique primarily used for?
A) To speed up read operations
B) To ensure durability and atomicity of transactions
C) To improve concurrency
D) To detect deadlocks
11. Which method is used to detect if a transaction has been waiting for a lock for an excessively long time, potentially indicating a deadlock?
A) Timestamp ordering
B) Lock timeout
C) Validation
D) Wait-for graph analysis
12. Starvation in concurrency control refers to:
A) A transaction being repeatedly rolled back
B) A transaction being permanently prevented from executing or committing
C) A deadlock situation
D) A successful transaction completion
13. Which of the following is a common technique to prevent deadlocks by breaking cycles in the wait-for graph?
A) Preemption
B) Rollback
C) Starvation
D) Timeout
14. What is the strongest isolation level, guaranteeing that concurrent transactions produce the same result as some serial execution?
A) Repeatable Read
B) Read Committed
C) Serializable
D) Read Uncommitted
15. Which isolation level ensures that if a transaction reads a data item, subsequent reads of the same data item within that transaction will return the same value?
A) Read Committed
B) Repeatable Read
C) Serializable
D) Read Uncommitted
16. What is the weakest isolation level, allowing transactions to read uncommitted data from other transactions?
A) Read Committed
B) Repeatable Read
C) Read Uncommitted
D) Serializable
17. Which isolation level guarantees that a transaction will see only committed data?
A) Read Uncommitted
B) Read Committed
C) Repeatable Read
D) Serializable
18. Which isolation level would prevent phantom reads?
A) Read Uncommitted
B) Read Committed
C) Repeatable Read
D) Serializable
19. What problem does the 'phantom read' phenomenon refer to?
A) A transaction reading a data item that has been deleted
B) A transaction reading a data item that has been modified
C) A transaction re-executing a query and finding new rows that match the query criteria
D) A transaction failing to read a data item
20. In MVCC, when a transaction reads a data item, which version does it typically access?
A) The latest version
B) The version that was current when the transaction started
C) The version that was last written by a committed transaction
D) The version that is currently being written
21. Which type of concurrency control method creates multiple versions of data items?
A) Lock-based
B) Time-stamping
C) Optimistic
D) Multiversion Concurrency Control (MVCC)
22. What is a potential drawback of optimistic concurrency control?
A) It can lead to deadlocks
B) It can cause frequent rollbacks if conflicts are high
C) It requires extensive locking
D) It is always slower than lock-based methods
23. If a transaction fails validation in an optimistic concurrency control system, what typically happens?
A) It is immediately committed
B) It is rolled back
C) It is put into a waiting state
D) It is allowed to proceed with its updates
24. During the validation phase of optimistic concurrency control, what is checked?
A) If the transaction acquired all necessary locks
B) If the transaction's operations conflict with other concurrently committed transactions
C) If the transaction has enough resources
D) If the transaction has completed within the time limit
25. Optimistic concurrency control methods typically involve three phases:
A) Read, Write, Commit
B) Read, Validate, Write
C) Read, Validate, Update
D) Read, Write, Rollback
26. What is the core idea behind optimistic concurrency control methods?
A) Assume conflicts are rare and check for them only at commit time
B) Assume conflicts are frequent and use locks extensively
C) Assume transactions will always succeed
D) Assume serial execution is always possible
27. What is the main advantage of time-stamping methods over basic 2PL?
A) They are simpler to implement
B) They avoid deadlocks
C) They require fewer locks
D) They provide stronger isolation
28. If a transaction T tries to write a data item X, and T's timestamp is less than RTS(X), what action is typically taken?
A) The write is allowed
B) The write is rejected, and T is aborted
C) The write is allowed, but RTS(X) is updated
D) The transaction waits until RTS(X) is updated
29. If a transaction T tries to read a data item X, and T's timestamp is less than WTS(X), what action is typically taken?
A) The read is allowed
B) The read is rejected, and T is aborted
C) The read is allowed, but WTS(X) is updated
D) The transaction waits until WTS(X) is updated
30. In time-stamping methods, what is the 'write timestamp' (WTS) of a data item?
A) The timestamp of the transaction that last read the data item
B) The timestamp of the transaction that last wrote the data item
C) The timestamp of the transaction that is currently reading the data item
D) The timestamp of the transaction that is currently writing the data item
31. In time-stamping methods, what is the 'read timestamp' (RTS) of a data item?
A) The timestamp of the transaction that last wrote the data item
B) The timestamp of the transaction that last read the data item
C) The timestamp of the transaction that is currently writing the data item
D) The timestamp of the transaction that is currently reading the data item
32. Which timestamp-based concurrency control method assigns a unique timestamp to each transaction?
A) Locking
B) Validation
C) Time-stamping
D) Multiversion Concurrency Control
33. A cycle in the wait-for graph indicates:
A) No deadlock
B) A deadlock
C) A transaction failure
D) A successful commit
34. What is the 'wait-for graph' used for in deadlock detection?
A) To track transaction start times
B) To visualize dependencies between transactions waiting for resources
C) To measure transaction throughput
D) To estimate transaction completion time
35. Which of the following is a common strategy for handling deadlocks?
A) Lock timeout
B) Transaction rollback
C) Ignoring the situation
D) Increasing transaction priority
36. What is a deadlock in the context of concurrency control?
A) A situation where a transaction finishes successfully
B) A situation where two or more transactions are waiting indefinitely for each other to release locks
C) A situation where a transaction violates ACID properties
D) A situation where the database system crashes
37. In Strict Two-Phase Locking (Strict 2PL), when are all locks released by a transaction?
A) As soon as they are no longer needed
B) At the end of the transaction's growing phase
C) At the commit or abort point of the transaction
D) When another transaction requests a conflicting lock
38. What is the primary purpose of Two-Phase Locking (2PL)?
A) To maximize concurrency
B) To ensure serializability
C) To minimize lock overhead
D) To prevent deadlocks
39. Which of the following lock modes are compatible with each other? (S-lock with S-lock, S-lock with X-lock, X-lock with X-lock)
A) S-lock with S-lock
B) S-lock with X-lock
C) X-lock with X-lock
D) None of the above
40. What type of lock is acquired when a transaction wants to modify a data item?
A) Shared lock (S-lock)
B) Exclusive lock (X-lock)
C) Update lock (U-lock)
D) Null lock
41. In lock-based concurrency control, what type of lock is acquired when a transaction wants to read a data item?
A) Exclusive lock (X-lock)
B) Shared lock (S-lock)
C) Update lock (U-lock)
D) Intent lock (I-lock)
42. Two transactions T1 and T2 are in conflict if they access the same data item and at least one of the accesses is a write operation.
A) True
B) False
C) Only if both accesses are writes
D) Only if one is a read and the other is a write
43. Which type of serializability guarantees that the result is equivalent to *some* serial order of execution?
A) Conflict Serializability
B) View Serializability
C) Schedule Serializability
D) Transaction Serializability
44. What is the primary goal of serializability in transaction management?
A) To maximize transaction throughput
B) To ensure that concurrent execution of transactions produces the same result as some serial execution
C) To minimize the number of locks acquired
D) To reduce disk I/O operations
45. Which ACID property ensures that concurrent transactions do not interfere with each other's execution?
A) Atomicity
B) Consistency
C) Isolation
D) Durability
46. If a transaction fails after committing some of its operations, which ACID property guarantees that the changes are permanent?
A) Atomicity
B) Consistency
C) Isolation
D) Durability
47. The Consistency property of ACID ensures that a transaction brings the database from one valid state to another.
A) True
B) False
C) Depends on the transaction type
D) Only applies to read operations
48. Which ACID property ensures that a transaction is treated as a single, indivisible unit of work?
A) Consistency
B) Isolation
C) Durability
D) Atomicity
49. What does the 'A' in ACID properties stand for?
A) Availability
B) Atomicity
C) Access
D) Alignment