Q: 1 ACID properties of a database transaction include:
Atomicity
Durability
Consistency and Isolation
All of the above
[ Option D ]
ACID is a set of properties that ensure reliable processing of database transactions:
| PROPERTY | MEANING | EXAMPLE |
|---|---|---|
| Atomicity | A transaction is treated as a single unit, either all operations happen or none happen. | Money is debited and credited together, or not at all. |
| Consistency | A transaction brings the database from one valid state to another, maintaining all rules and constraints. | Account balance never becomes negative after a transaction. |
| Isolation | Multiple transactions do not affect each other while executing simultaneously. | Two users updating different accounts do not see incomplete data. |
| Durability | Once a transaction is committed, changes are permanent even after system failure. | After power failure, committed balance remains saved. |
Q: 2 In context of transactions in DBMS, S is a schedule having T1, T2, T3 and T4 as participant transactions. A precedence graph (G) is constructed from S to determine its conflict serializability. Consider the following facts:
I. T1 executes write(Q) before T2 executes read(Q).
II. T2 executes read(Q) before T3 executes write(Q).
III. T3 executes write(Q) before T4 executes write(Q).
Which of the following statements is not true?
The graph G contains a directed edge from T1 to T2.
The graph G contains a directed edge from T2 to T3.
The graph G contains a directed edge from T3 to T4.
The schedule S is not conflict serializable
[ Option D ]
In the given schedule, we have the following operations, T1 writes Q before T2 reads Q, T2 reads Q before T3 writes Q, and T3 writes Q before T4 writes Q. These create directed edges T1 → T2, T2 → T3, and T3 → T4 in the precedence graph. Since this graph has no cycles (acyclic), the schedule is conflict serializable and equivalent to the serial order T1 → T2 → T3 → T4.
Q: 3 In a particular database system, it is estimated that on an average (across many system crashes) the number of committed transactions is almost 5 times the number of uncommitted transactions in the log at the time of restart after the crash. In which of the following logging mechanisms, the recovery manager attends to the least number of transactions, after being given control after a crash?
REDO
UNDO
UNDO-REDO
Equal in all logging mechanisms
[ Option B ]
The number of uncommitted transactions is the smallest, the UNDO mechanism requires the recovery manager to attend to the least number of transactions.
Q: 4 Which one of the following is NOT a part of the ACID properties of database transaction?
Applicability
Consistency
Isolation
Durability
[ Option A ]
The ACID properties define the key characteristics that ensure reliable database transactions. ACID stands for Atomicity, Consistency, Isolation, and Durability.
| PROPERTY | MEANING | EXAMPLE |
|---|---|---|
| Atomicity | A transaction is treated as a single unit, either all operations happen or none happen. | Money is debited and credited together, or not at all. |
| Consistency | A transaction brings the database from one valid state to another, maintaining all rules and constraints. | Account balance never becomes negative after a transaction. |
| Isolation | Multiple transactions do not affect each other while executing simultaneously. | Two users updating different accounts do not see incomplete data. |
| Durability | Once a transaction is committed, changes are permanent even after system failure. | After power failure, committed balance remains saved. |
Q: 5 The concept of performing a sequence of steps / operations executed to completion as single step is called
Single Step
Monotonicity
Atomicity
Periodicity
[ Option C ]
Atomicity refers to the concept where a sequence of operations is executed as a single indivisible unit. This means either all operations are completed successfully or none are executed at all.
It is an important property in Transactions and Concurrent systems, ensuring consistency and preventing partial execution.
Q: 6 The property of a transaction in which all actions are executed completely, or in case of failure all partial effects are undone, is called:
Durability
Atomicity
Consistency
Isolation
[ Option B ]
Atomicity ensures that a transaction is treated as a single, indivisible unit. This means either all operations of the transaction are performed, or none of them are applied if a failure occurs.
For example, during a fund transfer, if money is debited from one account but crediting fails, atomicity ensures the debit is rolled back.
Q: 7 In context of transactions in DBMS, choose a valid statement about deadlock prevention schemes.
wait-die is a nonpreemptive and wound-wait is a preemptive technique.
wait-die is a preemptive and wound-wait is a nonpreemptive technique.
Both wait-die and wound-wait schemes are nonpreemptive techniques.
Both wait-die and wound-wait schemes are preemptive techniques.
[ Option A ]
Deadlock prevention schemes in databases use timestamp ordering to avoid cyclic waiting. Two popular timestamp-based methods are wait-die and wound-wait schemes.
In the wait-die scheme (non-preemptive), if an older transaction requests a resource held by a younger one, it is allowed to wait, otherwise, the younger transaction is rolled back.
The wound-wait scheme (preemptive) allows the older transaction to “wound” the younger one by forcing it to roll back immediately and release the resource. Because wait-die involves waiting (non-preemptive) and wound-wait involves forced rollback (preemptive).
Q: 8 Consider following schedule with a sequence of operations on a data object Q having the initial value of 500:
| T1 | T2 |
|---|---|
| Read (Q) | |
| Read (Q) | |
| Q = Q + 100 | |
| Q = Q + 100 | |
| Write (Q) | |
| Write (Q) |
What will be the final value of Q after the last operation is completed?
600
700
550
500
[ Option A ]
The data item Q initially = 500.
Schedule Step by Step:
Because both transactions read the original value 500 and each computed 600, the second write simply overwrites the first with the same value. The final value of Q after the last operation is 600.
Q: 9 A database transaction ends when which of the following events occurs?
COMMIT or ROLLBACK is issued
DDL or DCL statement executed
The user exits or the session ends abnormally
All of the above
[ Option D ]
A transaction in DBMS is a logical unit of work that ends when its changes are either made permanent or undone, or when it is implicitly terminated.
Q: 10 Consider the schedule S:
Which of the following statements is correct regarding S?
S : w1(A); w1(B); w2(A); r2(B); c2; c1;
Serializable but not recoverable
Both Serializable and Recoverable
Recoverable but not Serializable
Neither Serializable nor Recoverable
[ Option A ]
The schedule S: w1(A); w1(B); w2(A); r2(B); c2; c1; involves two transactions T1 and T2. Checking for Recoverability, T2 reads data written by T1 and commits before T1 commits, which violates recoverable schedule rules. Hence, the schedule is Not Recoverable.
For Serializability, analyzing conflicting operations shows that T1’s writes on A and B conflict with T2’s operations, resulting in a precedence graph with a single edge from T1 to T2. Since the graph is acyclic, the schedule is conflict serializable. Therefore, the schedule is serializable but not recoverable.
Q: 11 Which statement(s) is/are correct from the following?
S1: If multiple transactions are allowed to execute concurrently, then shadow-paging technique is not applicable.
S2: Log-based techniques can be used, if multiple transactions are allowed to execute concurrently.
S1 only
S2 only
Both S1 and S2
Neither S1 nor S2
[ Option C ]
Shadow Paging keeps a copy of the old page table and replaces it at commit, which makes it incompatible with multiple concurrent transactions because changes cannot be merged safely.
On the other hand, Log-Based Techniques maintain a log of all changes and can safely support multiple concurrent transactions, providing both undo and redo capabilities during recovery.
Q: 12 Consider table bank_accounts = (account_id, balance). Assume two account with account_id as A and B. Also assume that initially both accounts have a balance Rs. 5,000 each. Two transactions T1 and T2 are executed concurrently, both under REPEATABLE READ isolation level. Database uses standard locking mechanism.
T1: Transfers Rs. 1,000 from A to B.
DB operations sequence is as follows:
BEGIN; READ(A); READ(B); WRITE(A); WRITE(B); END.
T2: Transfer Rs. 1,000 from B to A.
DB operations sequence is as follows:
BEGIN; READ(B); READ(A); WRITE(B); WRITE(A); END.
Both transaction read the corresponding account balances, deducts Rs. 1,000 from one account, then adds Rs. 1,000 to the other account and results are written back.
Assuming that all interleaving of execution of T1 and T2 are possible and that there are no extraneous factors, which of the following will never occur?
A’s account balance shows Rs. 5,000 and B’s account balance shows Rs. 5,000
Deadlock is detected and T1 will be rolled back to recover
Deadlock is detected and T2 will be rolled back to recover
A’s account balance shows Rs. 4,000 and that of B will have Rs. 6,000
[ Option D ]
Both transactions run under REPEATABLE READ isolation level using a standard locking mechanism. When a transaction reads a row, it acquires a shared lock, and when it writes to a row, it upgrades to an exclusive lock. If two transactions try to lock resources in different orders, a deadlock may occur.
Here, T1 reads A then B, while T2 reads B then A. This opposite order can cause deadlock, so options (b) and (c) are possible because the system may resolve the deadlock by rolling back either transaction.
It is also possible that transactions execute sequentially or one waits for the other, resulting in the net transfer cancelling out, leaving both balances Rs. 5,000, making option (a) possible.
However, the state A = 4,000 and B = 6,000 would occur only if T1 completes without the effect of T2 being applied, which contradicts the assumption that both transactions are executed and controlled by locking under the REPEATABLE READ isolation level. Therefore, this situation will never occur.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.