CS FundamentalsHardGATE CS (PYQ pattern)
Multiple-granularity locking (modes IS, IX, S, SIX, X with the standard compatibility matrix). T1 holds IX on table TB and S on row r1 of TB. Each of the following transactions, judged separately against this state only, asks for its locks: T2 wants SIX on TB; T3 wants IX on TB and then X on row r2; T4 wants S on TB; T5 wants IS on TB and then S on r1. Which of T2..T5 get all their locks immediately?
- A. T2, T3 and T5
- B. T3 only
- C. T3, T4 and T5
- D. T3 and T5 only
Correct answer: D. T3 and T5 only
IX is compatible with IX and IS but not with S or SIX, so T2 (SIX) and T4 (S) must wait. T3: IX on TB is fine and r2 is unlocked, so X on r2 is granted. T5: IS on TB is fine and S on r1 is compatible with T1's S. Hence T3 and T5.
More DBMS and SQL questions
- Snapshot isolation with first-committer-wins: a transaction aborts at commit time if some other transaction that committed after it…
- In a wait-for graph over transactions T1..T7 the edges (Ti waits for Tj) are T1→T2, T2→T3, T3→T1, T3→T4, T4→T5, T5→T4, T6→T3, T2→T7…
- Under strict two-phase locking (shared locks for reads, exclusive for writes, all locks held until commit; a transaction whose lock…
- A B+ tree has leaf nodes holding at most 3 keys. Keys are inserted in the order 50, 20, 80, 10, 30, 60, 90, 70, 40, 25, 35, 5, 65, 75, 95…
- A query joins 5 relations R1..R5 and the optimiser considers every possible join tree, including bushy trees, with every distinct…
- R occupies 1000 pages with 100 tuples per page. S has a B+ tree index on the join attribute (3 levels, so 3 page reads to reach a leaf…