IAE Academy

GATE 2025 DA Q.17: solution and answer

GATE 2025 · DAQ.17 · 1 mark · MCQ

Consider the following three relations:

Car (model, year, serial, color)
Make (maker, model)
Own (owner, serial)

A tuple in Car represents a specific car of a given model, made in a given year, with a serial number and a color. A tuple in Make specifies that a maker company makes cars of a certain model. A tuple in Own specifies that an owner owns the car with a given serial number. Keys are underlined; (owner, serial) together form key for Own. (⋈ denotes natural join)

Which one of the following options describes what the above expression computes?

  1. (A)

    All owners of a red car, a car made by ABC, or a red car made by ABC

  2. (B)

    All owners of more than one car, where at least one car is red and made by ABC

  3. (C)

    All owners of a red car made by ABC

  4. (D)

    All red cars made by ABC

See the question in the paper

Answer and solution

ANSWER

The expression returns all owners of a red car made by ABC, so the answer is option (C).

Official answer: CSource: Official answer key, GATE 2025 DA (IIT Roorkee)

  1. Evaluate from the innermost part outward. keeps only the Make tuples whose maker is ABC. This is a relation listing the models that ABC makes.

  2. is a natural join. The only attribute common to and is model. The join therefore keeps exactly those cars whose model is made by ABC, and it attaches the maker column to them.

  3. is applied to that result, so it keeps only the red cars among the cars made by ABC. The two conditions are applied one after the other, so a car must satisfy both. The condition is an AND, not an OR. The result is the set of red cars made by ABC.

  4. is a natural join on the only common attribute, serial. Each Own tuple is paired with the car that has that serial number. Only owners of red cars made by ABC remain, with one tuple per (owner, car) pair.

  5. keeps just the owner column and removes duplicate rows. Each owner therefore appears once, however many such cars they own.

  6. So the expression returns the set of owners who own at least one red car made by ABC, which is option (C). Option (D) is wrong because the output has only the owner attribute, so it returns owners, not cars. Option (A) is wrong because it describes an OR of the two conditions, while the expression requires both. Option (B) is wrong because nothing in the expression requires an owner to hold more than one car.

KEY IDEA

Read a nested relational-algebra expression from the inside out. Nested selections compose as an AND, and a natural join pairs tuples on the common attributes (model for Car and Make, serial for Own and Car). The final projection onto owner returns owners, not cars.

WATCH OUT FOR

Choosing (D) because the red-and-ABC cars are what the inner part computes, and forgetting that the outer join with Own and the projection on owner turn the result into a set of owners. Another slip is reading the nested selections as an OR, which gives (A).

From the GATE 2025 DA paper. Every question of this paper · Download the full paper · All 5 Relational algebra questions, with notes

More Relational algebra questions