DBMS GATE(2015-2026) pyq Transactions and Concurrency Control ques(5.21-5.41)

[GATE 2015 (Set-3) : 2 M]
5.21: Consider the following partial Schedule S involving two transactions T1 and T2. Only the read and the write operations have been shown. The read operation on data item P is denoted by read(P) and the write operation on data item P is denoted by write(P).Schedule:
Time instance 1: T1 – read(A)
Time instance 2: T1 – write(A)
Time instance 3: T2 – read(C)
Time instance 4: T2 – write(C)
Time instance 5: T2 – read(B)
Time instance 6: T2 – write(B)
Time instance 7: T2 – read(A)
Time instance 8: T2 – commit
Time instance 9: T1 – read(B)Suppose that the transaction T1 fails immediately after time instance 9. Which one of the following statements is correct?(a) T2 must be aborted and then both T1 and T2 must be restarted to ensure transaction atomicity
(b) Schedule S is nonrecoverable and cannot ensure transaction atomicity
(c) Only T2 must be aborted and then restarted to ensure transaction atomicity
(d) Schedule S is recoverable and can ensure atomicity and nothing else needs to be doneSolution:
Answer: (b) Schedule S is nonrecoverable and cannot ensure transaction atomicity
Explanation: T2 ne A ko time 7 par read kiya, jo T1 ne time 2 par write kiya tha, lekin T1 ne abhi tak commit nahi kiya tha. Iske baad T2 commit ho gaya time 8 par. Ab T1 fail ho gaya time 9 par, to T2 ko bhi abort karna padega kyunki usne uncommitted data padha tha, lekin T2 already commit ho chuka hai. Ye Irrecoverable / Nonrecoverable schedule hai.

[GATE 2016 (Set-1) : 1 M]
5.22: Consider the following directed graph:
a -> b, a -> d, b -> c, d -> e, c -> f, e -> f The number of different topological ordering of the vertices of the graph is ______Solution:
Answer: 6
Explanation: Graph ke 2 independent chains hain: b->c aur d->e, dono a ke baad aur f se pehle. Inke interleavings 6 tarah se ho sakte hain: bcde, bdec, bdec… total 6 topological orders.

[GATE 2016 (Set-1) : 1 M]
5.23: Which one of the following is NOT a part of the ACID properties of database transactions?
(a) Atomicity
(b) Consistency
(c) Isolation
(d) Deadlock-freedomSolution:
Answer: (d) Deadlock-freedom
Explanation: ACID = Atomicity, Consistency, Isolation, Durability. Deadlock-freedom ACID ka part nahi hai.

[GATE 2016 (Set-1) : 2 M]
5.24: Consider the following two phase locking protocol. Suppose a transaction T accesses (for read or write operations), a certain set of objects (O1,…,Ok). This is done in the following manner:
Step 1. T acquires exclusive locks to O1,…,Ok in increasing order of their addresses.
Step 2. The required operations are performed.
Step 3. All locks are released.
This protocol will
(a) guarantee serializability and deadlock-freedom
(b) guarantee neither serializability nor deadlock-freedom
(c) guarantee serializability but not deadlock-freedom
(d) guarantee deadlock-freedom but not serializabilitySolution:
Answer: (a) guarantee serializability and deadlock-freedom
Explanation: Sare locks shuru me le liye (Growing phase), fir kaam kiya, fir sare release (Shrinking phase) – ye 2PL hai to serializability guarantee hai. Aur locks address ke increasing order me liye ja rahe hain, to deadlock ka cycle kabhi nahi banega – deadlock freedom bhi hai.

[GATE 2016 (Set-2) : 1 M]
5.25: Suppose a database schedule S involves transactions T1,…,Tn. Construct the precedence graph of S with vertices representing the transactions and edges representing the conflicts. If S is serializable, which one of the following orderings of the vertices of the precedence graph is guaranteed to yield a serial schedule?
(a) Topological order
(b) Depth-first order
(c) Breadth-first order
(d) Ascending order of transaction indicesSolution:
Answer: (a) Topological order
Explanation: Precedence graph acyclic hai (kyunki serializable hai), to uska topological sort hi serial schedule dega.

[GATE 2016 (Set-2) : 2 M]
5.26: Consider the following database schedule with two transactions, T1 and T2:
S = r2(X); r1(X); r2(Y); w1(X); r1(Y); w2(X); a1; a2
where r_i(Z) denotes a read operation by transaction Ti on a variable Z, w_i(Z) denotes a write operation by Ti on a variable Z and a_i denotes an abort by transaction Ti.
Which one of the following statements about the above schedule is TRUE?
(a) S is non-recoverable
(b) S is recoverable, but has a cascading abort
(c) S does not have a cascading abort
(d) S is strictSolution:
Answer: (c) S does not have a cascading abort
Explanation: T1 ne X ko w1(X) kiya, lekin r2(X) pehle ho chuka tha, to T1 ka write, T2 ke read ke baad hai – koi dirty read nahi.T2 ne w2(X) kiya jab T1 abhi active tha, lekin T1 ne uske baad X ko read nahi kiya. Y par bhi koi dirty read nahi hai.
Schedule recoverable hai, strict nahi hai, lekin cascading abort nahi hai kyunki kisi ne abort hui transaction ka likha hua data read nahi kiya hai.

[GATE 2017 (Set-1) : 2 M]
5.27:In a database system, unique timestamps are assigned to each transaction using Lamport’s clock. Let TS(T1) and TS(T2) be the timestamps of transactions T1 and T2 respectively. Besides, T1 holds a lock on the resource R and T2 has requested a conflicting lock on the same resource R. The following algorithm is used to prevent deadlocks in the database system assuming that a killed transaction is restarted with the same timestamp.
if TS(T2) < TS(T1) then T1 is killed else T2 waits Assume any transaction that is not killed terminates eventually. Which of the following is TRUE about the database system that uses the above algorithm to prevent deadlocks?(a) The database system is both deadlock-free and starvation-free. (b) The database system is deadlock-free, but not starvation-free. (c) The database system is starvation-free, but not deadlock-free. (d) The database system is neither deadlock-free nor starvation-free.Solution: Answer: (a) The database system is both deadlock-free and starvation-free. Explanation: Ye Wound-Wait scheme hai. Older transaction (chhota timestamp) wound karta hai younger ko. Isme deadlock kabhi nahi banta aur starvation bhi nahi hota kyunki older ko hamesha priority milti hai.

[GATE 2017 (Set-2) : 2 M]

5.28: Two transactions T1 and T2 are given as T1: r1(X) w1(X) r1(Y) w1(Y) T2: r2(Y) w2(Y) r2(Z) w2(Z) where r_i(V) denotes a read operation by transaction T_i on a variable V and w_i(V) denotes a write operation by transaction T_i on a variable V. The total number of conflict serializable schedules that can be formed by T1 and T2 is ______Solution: Answer: 54 Explanation: T1 ke 4 operations aur T2 ke 4 operations = total 8 operations, total interleavings = 8! / (4! * 4!) = 70. Conflict sirf Y par hai: T1 ke Y wale operations (r1(Y), w1(Y)) aur T2 ke Y wale operations (r2(Y), w2(Y)) me conflict hai. Non-serializable tab hoga jab T1(Y) -> T2(Y) -> T1(Y) ya T2(Y) -> T1(Y) -> T2(Y) type ka mix ho, jisme cycle bane.
70 me se 16 schedules me cycle banta hai. Isliye conflict serializable = 70 – 16 = 54.

[GATE 2019 : 1 M]
5.29: Consider the following two statements about database transaction schedules:
I. Strict two-phase locking protocol generates conflict serializable schedules that are also recoverable.
II. Timestamp-ordering concurrency control protocol with Thomas’ Write Rule can generate view serializable schedules that are not conflict serializable.
Which of the above statements is/are TRUE?(a) Neither I nor II
(b) I only
(c) II only
(d) Both I and IISolution:
Answer: (d) Both I and II
Explanation:
I. TRUE – Strict 2PL me lock commit ke baad hi release hota hai, isliye recoverable hota hai aur 2PL hamesha conflict serializable hota hai.
II. TRUE – Thomas Write Rule kuch obsolete writes ko ignore kar deta hai, jisse schedule view serializable to rehta hai lekin conflict serializable nahi rehta.

[GATE 2020 : 2 M]
5.30: Consider a schedule of transactions T1 and T2:
T1: RA RC WD WB Commit
T2: RB WB RD WC Commit
Here, RX stands for “Read(X)” and WX stands for “Write(X)”. Which one of the following schedules is conflict equivalent to the above schedule?Original Schedule Table:
T1: RA | | RC | | WD | | WB | Commit
T2: | RB | WB | RD | | WC | | | CommitOptions:
(a) T1: RA RC WD WB Commit / T2: RB WB RD WC Commit
(b) T1: RA RC WD WB Commit / T2: RB WB RD WC Commit
(c) T1: RA RC WD WB Commit / T2: RB WB RD WC Commit
(d) T1: RA RC WD WB Commit / T2: RB WB RD WC CommitSolution:
Answer: (b)
Explanation: Original me conflict order hai:B par: RB(T2) -> WB(T1) and WB(T2) -> WB(T1) = T2 -> T1D par: RD(T2) -> WD(T1)? aur C par: RC(T1) -> WC(T2) = T1 -> T2
Is cycle ko check karne par sirf option (b) me same conflict order maintain hota hai. Isliye (b) conflict equivalent hai.Q [GATE 2021 (Set-1) : 1 M]
5.31: Suppose a database system crashes again while recovering from a previous crash. Assume checkpointing is not done by the database either during the transactions or during recovery.
Which of the following statements is/are correct?
(a) The same undo and redo list will be used while recovering again.
(b) The system cannot recover any further.
(c) The database will become inconsistent.
(d) All the transactions that are already undone and redone will not be redone again.Solution:
Answer: (a) The same undo and redo list will be used while recovering again.
Explanation: ARIES recovery idempotent hota hai. Agar recovery ke beech me crash ho jaye, to dubara same log se same undo/redo list se recovery hogi. Database inconsistent nahi hoga.

[GATE 2021 (Set-1) : 2 M]
5.32: Let r_i(z) and w_i(z) denote read and write operations respectively on a data item z by a transaction T_i. Consider the following two schedules:
S1: r1(x) r1(y) r2(x) r2(y) w2(y) w1(x)
S2: r1(x) r2(x) r2(y) w2(y) r1(y) w1(x)
Which one of the following options is correct?
(a) S1 is not conflict serializable, and S2 is conflict serializable.
(b) Neither S1 nor S2 is conflict serializable.
(c) Both S1 and S2 are conflict serializable.
(d) S1 is conflict serializable, and S2 is not conflict serializable.Solution:
Answer: (a) S1 is not conflict serializable, and S2 is conflict serializable.
Explanation:
S1 me: X par r1->w2? Actually r1(x) before r2(x) and w1(x) after w2(y). Cycle banta hai T1->T2 aur T2->T1.
S2 me: Saare conflicts T1->T2 ek hi direction me hain, no cycle. Isliye S2 serializable hai.

[GATE 2021 (Set-2) : 2 M]
5.33: Let S be the following schedule of operations of three transactions T1, T2 and T3 in a relational database system:
R1(Y), R2(X), R3(Z), R1(Y), W1(X), R2(Z), W2(Y), R3(X), W3(Z)
Consider the statements P and Q below:
P: S is conflict-serializable.
Q: If T3 commits before T1 finishes, then S is recoverable.
Which one of the following choices is correct?
(a) P is true and Q is false
(b) Both P and Q are false
(c) Both P and Q are true
(d) P is false and Q is trueSolution:
Answer: (a) P is true and Q is false
Explanation:
P: Precedence graph me T1->T2, T2->T3, T1->T3, no cycle = conflict serializable TRUE.
Q: T1 ne Y read kiya, T2 ne Y write kiya, T1 ka commit T3 se pehle hona chahiye tha recoverable ke liye, lekin yahan ulta ho raha hai, isliye recoverable nahi hai. Q FALSE.

[GATE 2022 : 2 M]
5.34: Let R_i(z) and W_i(z) denote read and write operations on a data element z by a transaction T_i, respectively. Consider the schedule S with four transactions.
S: R4(X), R4(Y), R3(X), R3(Y), R1(X), R1(Y), W1(Y), W3(X), W2(X), R2(Y), W2(Y)
Which one of the following serial schedules is conflict equivalent to S?
(a) T1 -> T3 -> T4 -> T2
(b) T1 -> T4 -> T3 -> T2
(c) T4 -> T1 -> T2 -> T3
(d) T3 -> T1 -> T4 -> T2Solution:
Answer: (a) T1 -> T3 -> T4 -> T2 is conflict equivalent? Actually correct is T3->T1->T4->T2 type – As per MADE EASY key, answer is (a) T1 -> T3 -> T4 -> T2?
Explanation: Precedence graph banao: W1(Y) before R2(Y), W3(X) before W2(X) etc. Topological sort karne par T3 -> T1 -> T4 -> T2 jaisa order aata hai, jo option (a) ke equivalent hai

[GATE 2024 (Set-1) : 2 M]
5.35: Consider the following read-write schedule S over three transactions T1, T2 and T3, where the subscripts in the schedule indicate transaction IDs:
S: r1(z); w1(z); r2(x); r3(y); w3(y); r2(y); w2(x); w2(y);
Which of the following transaction schedules is/are conflict equivalent to S?
(a) T3 T1 T2
(b) T1 T2 T3
(c) T2 T3 T1
(d) T1 T3 T2

Solution:
Answer: (a) T3 T1 T2, (c) T2 T3 T1? Actually correct as per GATE 2024 is (a) T3 T1 T2, (d) T1 T3 T2 and also T3 T2 T1 — Book me tick (a) T3 T1 T2 aur (c) T2 T3 T1 aur (d) T1 T3 T2 par hai. Final Answer: T1 T3 T2, T3 T1 T2, T3 T2 T1
Explanation: Conflict sirf Y par hai T3->T2. Z par sirf T1 hai, X par T2. Isliye T1 aur T3 independent hain. Koi cycle nahi hai, 3 serial orders possible hain jo Y ka order T3->T2 maintain karte hain.

[GATE 2024 (Set-2) : 1 M]
5.36: Once the DBMS informs the user that a transaction has been successfully completed, its effect should persist even if the system crashes before all its changes are reflected on disk. This property is called
(a) durability
(b) atomicity
(c) consistency
(d) isolationSolution:
Answer: (a) durability
Explanation: Commit ke baad data permanent hona hi Durability hai.

[GATE 2024 (Set-2) : 1 M]
5.37: Which of the following statements about the Two Phase Locking (2PL) protocol is/are TRUE?
(a) 2PL permits only serializable schedules
(b) With 2PL, a transaction always locks the data item being read or written just before every operation and always releases the lock just after the operation.
(c) With 2PL, once a lock is released on any data item inside a transaction, no more locks on any data item can be obtained inside that transaction.
(d) A deadlock is possible with 2PL.Solution:
Answer: (a), (c), (d)
Explanation:
(a) TRUE – 2PL hamesha conflict serializable schedule hi banata hai.
(b) FALSE – Ye to non-2PL hai, 2PL me lock pehle leke rakhna padta hai.
(c) TRUE – Ye hi 2PL ki definition hai – growing phase ke baad shrinking phase, wapas lock nahi le sakte.
(d) TRUE – 2PL me deadlock ho sakta hai, iske liye hi ordered locking ya wound-wait use hota hai.

[GATE 2025 (Set-1) : 1 M]
5.38: A schedule of three database transactions T1, T2, and T3 is shown. R(A) and W(A) denote read and write of data item A by transaction Ti, i = 1,2,3. The transaction T1 aborts at the end. Which other transaction(s) will be required to be rolled back?
R1(X) W1(Y) R2(X) R2(Y) R3(Y) ABORT(T1)
(a) Only T2
(b) Only T3
(c) Both T2 and T3
(d) Neither T2 nor T3Solution:
Answer: (c) Both T2 and T3
Explanation: T2 ne X read kiya jo T1 ne likha? Actually R1(X) W1(Y) ke baad R2(X) R2(Y) – T2 ne T1 ka dirty read kiya. T3 ne Y read kiya jo T1 ne likha tha. Isliye T1 abort hone par cascading abort hoga, T2 aur T3 dono ko rollback karna padega.

[GATE 2025 (Set-2) : 1 M]
5.39: An audit of a banking transactions system has found that on an earlier occasion, two joint holders of account A attempted simultaneous transfers of Rs. 10000 each from account A to account B. Both transactions read the same value, Rs. 11000, as the initial balance in A and were allowed to go through. B was credited Rs. 10000 twice. A was debited only once and ended up with a balance of Rs. 1000. Which of the following properties is/are certain to have been violated by the system?
(a) Atomicity
(b) Consistency
(c) Isolation
(d) DurabilitySolution:
Answer: (b) Consistency and (c) Isolation
Explanation: Isolation violate hua kyunki dono transactions ne concurrently same balance read kiya (dirty read nahi, lekin non-isolated). Consistency violate hua kyunki final balance galat hai – A me 1000 bachna chahiye tha -9000 hona chahiye tha, 20000 transfer hua B me lekin A se sirf 10000 kata. Total money consistent nahi raha

[GATE 2025 (Set-2) : 2 M]
5.40: Consider the database transactions T1 and T2, and data items X and Y. Which of the schedule(s) is/are conflict serializable?
Transaction T1: R1(X) W1(Y) R1(X) W1(X) COMMIT(T1)
Transaction T2: W2(X) W2(Y) COMMIT(T2)
(a) R1(X), W2(X), W1(Y), W2(Y), R1(X), W1(X), COMMIT(T2), COMMIT(T1)
(b) W2(X), R1(X), W2(Y), W1(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1)
(c) R1(X), W1(Y), W2(X), W2(Y), R1(X), W1(X), COMMIT(T1), COMMIT(T2)
(d) W2(X), R1(X), W1(Y), W2(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1)Solution:
Answer: (b)
Explanation: (b) me precedence graph acyclic hai, T2->T1. Baaki schedules me cycle ban raha hai X aur Y dono par.

[GATE 2026 (Set-2) : 1 M]
5.41: Consider concurrent execution of two transactions T1 and T2, both of which access a data object A. For these two transactions to not conflict on A, which one of the following statements must be true?
(a) Both T1 and T2 only read A
(b) T1 reads A and T2 writes A
(c) T1 writes A and T2 reads A
(d) Both T1 and T2 write ASolution:
Answer: (a) Both T1 and T2 only read A
Explanation: Conflict tab hota hai jab kam se kam ek write ho. No conflict ke liye dono ka sirf Read-Read hona chahiye.

Leave a Comment

Your email address will not be published. Required fields are marked *