CS FundamentalsHardGATE CS (PYQ pattern)
A two-phase commit has 1 coordinator and 5 participants and uses the read-only optimisation. All 5 receive PREPARE. Three vote YES, one votes READ-ONLY (it did no updates, releases its locks and drops out of phase 2) and one votes NO (and aborts at once). The coordinator sends the decision to every participant still in doubt and each of them acknowledges. How many messages are exchanged in total?
- A. 20
- B. 18
- C. 16
- D. 14
Correct answer: C. 16
Phase 1: 5 PREPAREs + 5 votes = 10. The decision is ABORT; it goes only to the 3 YES voters (the NO voter already aborted, the read-only one left), and they send 3 ACKs: 10 + 3 + 3 = 16. Sending the decision and getting ACKs from all 5 gives 20; from 4 gives 18.
More DBMS and SQL questions
- A linear hashing file starts with 2 buckets (hash h0 = k mod 2, then h1 = k mod 4, h2 = k mod 8, ...), a bucket holds 2 keys before it…
- A B+ tree index is built on (a, b) in this order. For which of these predicates can a search descend directly to a contiguous range of…
- Which of the following relational-algebra identities are valid for union-compatible relations R and S? I. σ{A=1}(R ∪ S) = σ{A=1}(R) ∪…
- R(A, B) has 100 tuples; R.B is a foreign key to S(B), which is S's primary key, but R.B allows NULL and 10 tuples of R have B = NULL. S…
- Three transactions each run x = x + 10 as an unprotected read followed by a write of (value read + 10), on a shared x that starts at 0…
- R(A, B, C, D, E, F) has the functional dependencies B → E, F → A, BC → F, AF → D, C → B. What is the highest normal form of R (1NF, 2NF…