Set Operations and Cartesian Product MCQs: 12 Solved Relational Algebra Questions
Solve 12 relational algebra MCQs on Cartesian products, set difference, identities, referential integrity, aggregation and division. Each answer shows the decisive reasoning step.
KnowledgeGate Team
Exam prep & CS education

Cartesian product questions test two different counts: degree adds columns, while cardinality multiplies rows. Set-difference questions test operand direction and identities, and later questions connect those rules to foreign keys and SQL. Attempt all 12 before reading the derivations so each miss points to a specific operator rule.
Use one four-check routine before solving
Check four things first:
Ask whether the result concerns rows or columns.
Test union compatibility before applying union, intersection, or difference.
Read a difference from left to right.
For a Cartesian product, add the degrees and multiply the cardinalities.
Relational algebra uses set semantics here. Projection and set operators remove duplicates unless stated otherwise. NULL matters only in Question 10.
Cartesian product: calculate degree and cardinality first
Question 1: EMRS 2026, degree 9 and cardinality 20
Stem: In a Relational Database Management System (RDBMS), consider two tables: ‘FIRST’ with 3 columns and 5 rows, and ‘SECOND’ with 6 columns and 4 rows. What will be the degree and cardinality of the table resulting from the Cartesian Product (FIRST x SECOND)?
Options:
A. Degree = 9, Cardinality = 9
B. Degree = 9, Cardinality = 20
C. Degree = 18, Cardinality = 9
D. Degree = 18, Cardinality = 20
Answer: B.
Degree = 3 + 6 = 9
Cardinality = 5 x 4 = 20
The product keeps all columns. Multiplying their counts to get 18 is the trap; only row counts multiply.
Question 2: RPSC 2024, four tuples times three tuples
Stem: Relation X contains (100, A), (200, B), (300, B), and (400, C). Relation Y contains (A, 5), (B, 6), and (C, 3). How many tuples does X x Y contain?
Options:
A. 12
B. 7
C. 4
D. 3
Answer: A. X has four tuples, including both B rows, and Y has three. Thus, |X x Y| = 4 x 3 = 12. Values do not matter because every X tuple pairs with every Y tuple.
Question 3: UGC NET 2021, STUDENT x COURSE
Stem: STUDENT(Rollno, Name, Courseno) has 5 tuples; COURSE(Courseno, Coursename, Capacity) has 3. Rollno and COURSE.Courseno are primary keys, STUDENT.Courseno refers to COURSE.Courseno, and Coursename is unique. For R = STUDENT x COURSE, match A. degree of R; B. cardinality of R; C. foreign key of STUDENT; D. foreign key of COURSE, to I. 15; II. NIL; III. 6; IV. Courseno.
Options:
A. A -III , B -I , C -IV , D - II
B. A -I , B -III , C -IV , D - II
C. A -I , B -III , C -IV , D - II
D. A -I , B -III, C -II , D - IV
Answer: A. Degree = 3 + 3 = 6. Cardinality = 5 x 3 = 15. STUDENT.Courseno is the foreign key; COURSE has none. Thus, A-III, B-I, C-IV, D-II.
Cartesian product as a reasoning tool, not only a row-count rule
Question 4: GATE 2024, minimum self-products for three residents
Stem: The relation schema, Person(pid,city), describes the city of residence for every person uniquely identified by pid. The following relational algebra operators are available: selection, projection, cross product, and rename. To find the list of cities where at least 3 persons reside, using the above operators, the minimum number of cross product operations that must be used is
Options:
A. 1
B. 2
C. 3
D. 4
Answer: B. Rename Person as P1, P2, and P3. Form (P1 x P2) x P3, then select equal cities and distinct pids before projecting city. Two binary products create the three renamed copies; one product can compare only two copies.
Question 5: ISRO 2016, aggregation is outside basic relational algebra
Stem: Given employee(name, salary, dept-no) and department(dept-no, dept-name, address), which query cannot be expressed using selection, projection, product, difference, union, and rename?
Options:
A. Department address of every employee
B. Employees whose name is the same as their department name
C. The sum of all employees’ salaries
D. All employees of a given department
Answer: C. The basic operators can construct the other results, including a join as selection over a product. SUM is an aggregate, so it needs extended relational algebra beyond the operator set in the stem.
Set difference: direction, identities, and algebraic properties
Question 6: IBPS 2025, read the operands from left to right
Stem: Which set operation represents rows that are in R1 but not in R2?
Options:
A. R1 UNION R2
B. R1 INTERSECT R2
C. R2 - R1
D. R1 - R2
E. None of the above
Answer: D. Start with R1 and remove tuples also in R2. If R1 = {1, 2} and R2 = {2, 3}, then R1 - R2 = {1}, while R2 - R1 = {3}.
Question 7: Difference is neither commutative nor associative
Stem: The difference (-) operation removes common tuples from the first relation. This operation is
Options:
A. commutative and associative
B. non-commutative and associative
C. commutative and non-associative
D. non-commutative and non-associative
Answer: D. For R = {1, 2} and S = {2, 3}, R - S = {1}, but S - R = {3}, disproving commutativity. For R = {1, 2, 3}, S = {2}, and T = {3}, (R - S) - T = {1}, while R - (S - T) = {1, 3}, disproving associativity.
Question 8: The two directional differences are disjoint
Stem: In context of databases consider set operations on relation R and S, and select a true statement:
Options:
A. (R - S) UNION (S - R) = empty set
B. (R - S) UNION (S - R) = R INTERSECT S
C. (R - S) INTERSECT (S - R) = empty set
D. (R - S) UNION (S - R) = R UNION S
Answer: C. A tuple in R - S cannot also be in S - R, so their intersection is empty. Their union is the symmetric difference, which excludes R INTERSECT S and need not equal R UNION S.
Set identities meet referential integrity
Question 9: RPSC 2024, identify two equivalent expressions
Stem: For the Student and Faculty instances below, compare: (a) Student - Faculty; (b) (Student INTERSECT Faculty) UNION (Faculty INTERSECT Student); (c) (Student UNION Faculty) - (Student INTERSECT Faculty); and (d) Student INTERSECT Faculty. Which expressions produce the same result?
Student = {CS-900, IT-500, Cyber-300, ME-1000, CIVIL-2000}
Faculty = {EE-2000, ECE-5000, Cyber-300, DS-100, CIVIL-2000}
Options:
A. b, c, d
B. b, d
C. a, b
D. b, c
Answer: B. Student INTERSECT Faculty = {Cyber-300, CIVIL-2000}. Expression (b) unions this set with itself, so it equals (d). Expression (a) is {CS-900, IT-500, ME-1000}; (c) is {CS-900, IT-500, ME-1000, EE-2000, ECE-5000, DS-100}. Neither matches.
Question 10: GATE 2012, foreign-key values form a subset
Stem: Suppose R1(A, B) and R2(C, D) are two relation schemas. Let r1 and r2 be the corresponding relation instances. B is a foreign key that refers to C in R2. If data in r1 and r2 satisfy referential integrity constraints, which of the following is ALWAYS TRUE?
Options:
A. pi_B(r1) - pi_C(r2) = empty set
B. pi_C(r2) - pi_B(r1) = empty set
C. pi_B(r1) = pi_C(r2)
D. pi_B(r1) - pi_C(r2) is not empty
Answer: A. Referential integrity makes the non-NULL values in pi_B(r1) a subset of pi_C(r2), so pi_B(r1) - pi_C(r2) is empty. The reverse difference can contain parent keys that no child references, so equality is not required. Child/parent placement and cascade behaviour require a separate constraint trace; this question uses only the set-containment consequence.
Know which operations come from set theory and where SQL stops being direct
Question 11: UGC NET 2019, set-theoretic operations in relational algebra
Stem: With respect to relational algebra, which operations come from mathematical set theory? (a) Join; (b) Intersection; (c) Cartesian product; (d) Projection.
Options:
A. (a) and (d)
B. (b) and (c)
C. (c) and (d)
D. (b) and (d)
Answer: B. Intersection and Cartesian product are set-theoretic. Projection is relational, while join is derived from product plus selection. See Set Theory and Relations for the wider connection.
Question 12: Cognizant 2023 and Capgemini 2024, division in SQL
Stem: Which of the following relational algebra operators cannot be implemented directly in SQL?
Options:
A. Union
B. Intersection
C. Division
D. Minus
Answer: C. SQL directly supports union, intersection, and difference through UNION, INTERSECT, and EXCEPT or MINUS, depending on the database. Division has no single keyword and needs a pattern such as nested NOT EXISTS or GROUP BY with HAVING. Division expresses 'for every' queries and requires longer traces; this question tests only its absence as a direct SQL operator. Review the SQL implementation patterns in SQL Queries and Joins in DBMS.
Exam traps, score check, and next step
Use this six-line check before submitting an answer:
Product means rows multiply and columns add.
Union, intersection, and difference need union-compatible schemas.
Difference reads from left to right.
Union and intersection are commutative, but difference is not.
Join can be built from product plus selection.
Aggregate functions require extended relational algebra.
Record your total, then classify every miss by rule:
Questions 1-4: product degree, cardinality, and renamed self-products.
Questions 5, 11, and 12: basic versus extended operators and the SQL boundary.
Questions 6-9: difference direction and set identities.
Questions 3 and 10: foreign-key direction and subset reasoning.
Retry only the groups in which you missed a question, and explain each answer in one sentence before checking it again. Use the GATE Test Series for timed mixed practice. For a broader DBMS sequence, return to GATE Guidance or browse the GATE CS category.
Keep learning

Safety of Expressions & Power MCQs: 10 Solved Relational Calculus Questions
Practise the active-domain test, De Morgan rewrites and the equivalence of relational algebra, safe TRC and safe DRC through ten fully explained questions.

Introduction to Query Languages MCQs: 8 Solved MCQs and 2 Concept Checks
Attempt eight published query-language MCQs, check each answer with a focused explanation, then use two written prompts to test recall of relational algebra.

Functional Dependencies and Armstrong's Axioms MCQs: 12 Solved Questions with Explanations
Solve 12 functional-dependency questions with exact options, step-by-step closure checks, Armstrong rule proofs, counterexamples and a useful-FD count.

SQL Datatypes, Operators and NULL MCQs: 12 Solved Questions with Explanations
Solve 12 SQL questions on datatypes, operators and NULL, then use one three-row trace to see exactly how TRUE, FALSE and UNKNOWN affect a WHERE clause.