Relational Algebra and Tuple Calculus · Database Management and Warehousing
5 questions · asked in 3 of 3 years (2024–2026)
MCQ 3 · NAT 21-mark 2 · 2-mark 3
Questions 1–5 of 5
X
Y
Z
Consider the relational algebra expression
where denotes natural join operation.
Which of the following options is the correct output for the given expression?
Answer: (D)
Now apply : row fails both conditions, so it is left out. Row satisfies , so it is kept. Result: , which is one row.
Step 2: Find (natural join on ): matches two times ( and ). matches one time (). ( and do not have matches in both tables.)
Now apply : it keeps and (both have ). It drops (because , which is not ).
Step 3: Join the two filtered results (common attributes ): the first filtered set has . The second set has and . None of the combinations match across the two sets, since the values are all different. So the final join gives no rows at all.
Answer: Zero rows
Consider that the following tuple relational calculus expression is evaluated.
The number of tuples that will be returned is ________. (Answer in integer )
Answer: 2 to 3
Given: and .
Now check each for a matching with :
- : has rows with (both ). This is a match, so the tuple is included.
- : has row with . This is a match, so the tuple is included.
- : the only row with has , which is not . There is no match, so the tuple is excluded.
Answer: 2
A tuple in represents a specific car of a given , made in a given , with a serial number and a color. A tuple in specifies that a company makes cars of a certain model. A tuple in specifies that an owns the car with a given number. Keys are underlined; () together form the key for ( denotes natural join)
Which one of the following options describes what the above expression computes?
Answer: (C)
1. keeps the models made by ABC.
2. joins on , so it gives the cars of those models.
3. keeps only the red ones. These are the red cars made by ABC.
4. joins on , so it gives the owners of those same cars.
5. keeps just the owner names.
Both conditions (red and made by ABC) apply to the same car, so the result is the owners of a red car made by ABC.
Why the other options are wrong: (A) uses "or", but the conditions are joined by "and". (B) asks for owners of more than one car, but one qualifying car is enough. (D) gives cars, but the final projection is on owner.
Answer: (C)
Query:
where denotes natural join. The number of tuples returned by the above relational algebra query is ________ (Answer in integer)
Answer: 1
Karteek has loans in all four branches (Banjara Hills through L11, Kondapur through L14, SR Nagar through L22, Balanagar through L23). Each of the other customers (Anand, Ankita, Gopal, Sunil) is linked to only to branches, so none of them covers all four.
We have , which gives distinct branches. The division operation then returns only those customer names linked to each of these branches. Only Karteek qualifies.
Answer: 1
Defender(name, rating, side, goals)
Forward(name, rating, assists, goals)
Team(name, club, price)
Which ONE of the following relational algebra expressions checks that every name occurring in Team appears in either Defender or Forward, where denotes the empty set?
Answer: (C)
Checking each option -
is the set difference operator. It gives all tuples that are in set A but not in set B.
If the result is , then every element (tuple) of A is also present in B.
Option A
(Team) picks out the names from the Team table. - (i)
(Defender) (Forward) gives all the names that are in both the Defender and Forward tables. - (ii)
(i) (ii) gives only those names that are in the Team table but not in both the Defender and Forward tables.
If this is equal to , then we can say it checks that every name in the Team table is also in both the Defender and Forward tables.
Option B
This does the same kind of operation as Option A. The only difference is that it does (ii) (i).
(ii) (i) gives only those names that are in both the Defender and Forward tables but not in the Team table.
If this is equal to , then we can say it checks that every name in both the Defender and Forward tables is also in the Team table.
Option C
(Defender) (Forward) gives all the names that are in the Defender or the Forward table. - (iii)
(i) (iii) gives only those names that are in the Team table but not in the Defender or the Forward table.
If this is equal to , then we can say it checks that every name in the Team table is also in the Defender or the Forward table.
So C is the required answer.
The same method on Option D shows that it checks that all names in the Defender or Forward table are also in the Team table.
Keep practising