CS FundamentalsVery hardGATE CS (PYQ pattern)
Relation R(A, B) has 6 tuples with 4 distinct values of A and 5 distinct values of B. What are the minimum and maximum possible cardinalities of π_A(R) ∪ π_B(R) when A and B draw from the same domain (the union is of the two single-column projections)?
- A. 5 and 9
- B. 4 and 9
- C. 5 and 10
- D. 4 and 6
Correct answer: A. 5 and 9
π_A has 4 values and π_B has 5, so the union has at least 5 (A-values inside the B-values) and at most 4 + 5 = 9 (disjoint).
More DBMS and SQL questions
- Relations R and S have 40 and 60 tuples (union-compatible). What are the minimum and maximum cardinalities of R ∪ S, R ∩ S and R − S (in…
- R(A, B) has 1000 tuples; S(B, C) has 500 tuples with B a key of S; T(C, D) has 200 tuples with C a key of T, and S.C is a NOT NULL foreign…
- The tuple calculus expression { t | ¬ Student(t) } over a database with a Student relation: is it safe, and why?
- A table is stored sorted on key K in 5000 pages (100 records each). Searching for one key with binary search over pages costs ceil(log2…
- A secondary dense index on a non-key attribute of a file with 1,000,000 records uses 4096-byte pages, 12-byte key + 8-byte pointer entries…
- A table of 1,000,000 rows (100 rows per page, 10,000 pages) is clustered on A, with a B+ tree whose leaves hold 200 entries each; reaching…