GateAI
Relational Model and SQL

GATE CSE 2024 Set 2 · Q45

MCQ2 marksMedium

Time

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

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: B) 2

Relational Model and SQL

To find cities with at least 3 persons, we need to compare three distinct person records residing in the same city.

  1. Let P1,P2,P3P_1, P_2, P_3 be three renamed instances of the relation Person:

    P1=ρ(P1,Person),P2=ρ(P2,Person),P3=ρ(P3,Person)P_1 = \rho(P_1, \text{Person}), \quad P_2 = \rho(P_2, \text{Person}), \quad P_3 = \rho(P_3, \text{Person})
  2. To bring the three tuples together into a single relation, we perform cross products:

    (P1×P2)×P3(P_1 \times P_2) \times P_3

    Combining 3 instances of a relation requires 2 cross product operations.

  3. We then apply selection to ensure that all three tuples have the same city but distinct pids:

    σP1.city=P2.city ∧ P2.city=P3.city ∧ P1.pid≠P2.pid ∧ P2.pid≠P3.pid ∧ P1.pid≠P3.pid((P1×P2)×P3)\sigma_{P_1.city = P_2.city \,\land\, P_2.city = P_3.city \,\land\, P_1.pid \neq P_2.pid \,\land\, P_2.pid \neq P_3.pid \,\land\, P_1.pid \neq P_3.pid}\big((P_1 \times P_2) \times P_3\big)
  4. Finally, project on the city name:

    ΠP1.city(… )\Pi_{P_1.city}(\dots)

Therefore, the minimum number of cross product operations required is 2 (Option B).

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Relational Model and SQL previous year question is Q45 of the GATE CSE 2024 Set 2 paper. Find more GATE CSE PYQs on Relational Model and SQL in Databases, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Relational Model and SQL PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Relational Model and SQL in GATE CSE

Relational Model and SQL has 15 GATE CSE PYQs across 12 papers from 2011 to 2026. 8 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2024 Set 2.

How GATE tests Relational Model and SQL

More from GATE CSE 2024 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2024 Set 2 · Q45 · MCQ

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

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.