CS FundamentalsModerateGATE CS (PYQ pattern)
R(A, B) and S(B) are relations. Which relational-algebra expression computes the division R ÷ S (the A-values that are paired in R with every B-value of S)?
- A. π_A(R) − π_A(R ⋈ S)
- B. π_A(R ⋈ S) − π_A((π_A(R) × S) ∩ R)
- C. π_A(R) − π_A((π_A(R) × S) − R)
- D. π_A(R) − π_A(R − (π_A(R) × S))
Correct answer: C. π_A(R) − π_A((π_A(R) × S) − R)
(π_A(R) × S) − R lists the (A, B) pairs that should exist but are missing; projecting on A gives the disqualified A-values, and subtracting them from π_A(R) leaves exactly the division result.
More DBMS and SQL questions
- R(A, B): (1,x), (2,y), (3,z), (4,NULL). S(B, C): (x,10), (x,11), (y,20), (w,30), (NULL,40). How many rows does SELECT FROM R FULL OUTER…
- R(A, B) = {(1,2), (1,3), (2,3), (3,4), (4,1)} is a graph's edge set. How many tuples are in the relation π{A,D}(ρ(R) ⋈{R.B = R2.A} ρ(R2))…
- 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…
- 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…