CS FundamentalsVery hardGATE CS (PYQ pattern)
T1: W(A) W(B) and T2: W(B) W(A) run under strict 2PL (exclusive locks held until the transaction ends; a schedule counts only if no operation ever has to wait). Out of the 6 interleavings, how many are valid strict-2PL schedules?
- A. 2
- B. 0
- C. 1
- D. 4
Correct answer: A. 2
A valid schedule needs one transaction to finish both writes before the other touches either item, because each transaction holds both locks until its last operation. Only the two serial orders qualify.
More DBMS and SQL questions
- Table T(x) holds the values 1, 2, 3, NULL and table U(y) holds 2, NULL. Let Q1 = SELECT COUNT() FROM T WHERE x NOT IN (SELECT y FROM U)…
- DEPT(d, name) has rows (10,A), (20,B), (30,C), (40,D) and EMP(id, dept) has 3 employees in dept 10, 2 in dept 20, 1 in dept 30 and none in…
- EMP has salaries 300, 200, 200, 200, 150, 100 for six employees. Let QR select employees whose RANK() OVER (ORDER BY sal DESC) equals 3…
- R(A, B, C, D, E) has the functional dependencies A → B, BC → D, D → E and E → A. The number of candidate keys of R and its highest normal…
- Consider the schedule S: r1(A) r3(B) r2(C) w2(A) r4(C) w4(B) r1(D) r3(D), where ri/wi is a read/write by transaction Ti. How many distinct…
- A B+ tree on 8-byte keys uses 4096-byte blocks. An internal node holds p tree pointers (8 bytes each) and p − 1 keys. A leaf holds q (key…