Identify the correct operation which produces the below given output based on…
2022
Identify the correct operation which produces the below given output based on two relations R1 and R2.
R1
Name | Class |
a1 | 9 |
b1 | 5 |
c1 | 6 |
d1 | 11 |
R2
Name | Class |
b1 | 5 |
f1 | 8 |
Output:
Name | Class |
b1 | 5 |
Answer: D. Both R1∩R2 and R1−(R1−R2) — Concept: R1∩R2 (intersection) returns only the tuples common to both relations. Intersection and set difference are both defined only for union-compatible…
- A.
R1∩R2
- B.
R1−R2
- C.
R1−(R1−R2)
- D.
Both R1∩R2 and R1−(R1−R2)
Attempted by 400 students.
Show answer & explanation
Correct answer: D
Concept: R1∩R2 (intersection) returns only the tuples common to both relations. Intersection and set difference are both defined only for union-compatible relations — the same number of attributes over matching domains, which R1 and R2 satisfy here. Set difference is the more fundamental of the two: for any two union-compatible relations A and B, the identity A − (A − B) = A ∩ B always holds — subtracting from A everything that is not in B leaves exactly what A shares with B. So an expression written using only "−" can still compute an intersection.
Application:
R1 holds the tuples (a1, 9), (b1, 5), (c1, 6), and (d1, 11).
R2 holds the tuples (b1, 5) and (f1, 8).
Computing R1∩R2 directly: the only tuple lying in both lists is (b1, 5), so R1∩R2 = {(b1, 5)}, which is exactly the output shown in the question.
Evaluating R1−(R1−R2) step by step: the inner R1−R2 removes every R1 tuple that also lies in R2, leaving the unshared tuples (a1, 9), (c1, 6) and (d1, 11), so R1−R2 = {(a1, 9), (c1, 6), (d1, 11)}.
Subtracting that three-tuple result from R1 again removes exactly those three tuples, so R1−(R1−R2) = {(b1, 5)} — the same relation the intersection produced, exactly as the identity A − (A − B) = A ∩ B predicts.
Cross-check — weighing the other choices:
R1−R2 = {(a1, 9), (c1, 6), (d1, 11)} — three tuples rather than the single-tuple output, so that expression alone cannot produce what the question shows.
Choosing R1∩R2 by itself, or R1−(R1−R2) by itself, leaves the answer half-stated: each of them independently evaluates to {(b1, 5)}, so neither expression is the one and only way to produce the output.
Result: R1∩R2 and R1−(R1−R2) are two different-looking ways of writing the very same operation, and each independently evaluates to {(b1, 5)} — precisely the output shown. Because the output can be produced by either expression, the answer that recognises both of them together is the complete one.
A video solution is available for this question — log in and enroll to watch it.