CS FundamentalsHardGATE CS · Amazon/Microsoft SDE MCQ
R(a) = {1, 2, 3} and S(a) = {2, 3, 3, 4} (S is a bag). How many rows does SELECT * FROM R FULL OUTER JOIN S ON R.a = S.a return? (Checked in SQLite 3.39+, which supports FULL OUTER JOIN.)
- A. 4
- B. 6
- C. 5
- D. 3
Correct answer: C. 5
Matches: 2 pairs with one 2, and 3 pairs with both 3s, giving 3 rows. Unmatched R row 1 and unmatched S row 4 add one NULL-padded row each: 5. Forgetting the duplicate 3 gives 4.
More DBMS and SQL questions
- A relation has 6 attributes. What is the largest possible number of candidate keys it can have under some set of functional dependencies?
- In multiple-granularity locking, how many of these lock-mode pairs (held, requested) on the same node are compatible? IS–IX, IX–IX, S–IX…
- Which statement correctly states the write-ahead logging (WAL) rule?
- Which statement about compensation log records (CLRs) in ARIES is correct?
- Which locking scheme guarantees BOTH freedom from deadlock and schedules without cascading rollback?
- Table T has 7 rows. What does SELECT COUNT() FROM T HAVING COUNT() > 10; return? (Standard SQL; SQLite accepts HAVING without GROUP BY…