This section contains carefully selected MCQs and Previous Year Questions with explanations to help students understand concepts and prepare effectively for examinations, interviews, and competitive tests.
Q: 1ACID properties of a database transaction include:
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: 2In 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?
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: 3In 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?
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: 4Which one of the following is NOT a part of the ACID properties of database transaction?
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: 5The concept of performing a sequence of steps / operations executed to completion as single step is called
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: 6Which one of the following is NOT a part of the ACID properties of database transaction?
Option D
In Database Management System (DBMS), ACID properties are a set of rules that ensure reliable and accurate database transactions.
These properties help maintain data correctness even in case of system failure or multiple user access.
| Property | Meaning |
|---|---|
| Atomicity | A transaction is treated as a single unit. Either all operations are completed or none are performed. |
| Consistency | The database must remain in a valid state before and after the transaction. |
| Isolation | Multiple transactions should not interfere with each other. |
| Durability | Once a transaction is committed, the changes remain permanently stored even after power failure or crash. |
Q: 7The property of a transaction in which all actions are executed completely, or in case of failure all partial effects are undone, is called:
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: 8In context of transactions in DBMS, choose a valid statement about deadlock prevention schemes.
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: 9Consider 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?
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: 10A database transaction ends when which of the following events occurs?
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: 11Consider the schedule S:
Which of the following statements is correct regarding S?
S : w1(A); w1(B); w2(A); r2(B); c2; c1;
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: 12Which 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.
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: 13Consider 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?
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.
You have reached the end of this topic. Continue learning with the next topic below.
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.