Common data questions
Common Data for Questions 50 and 51:
Consider the following relations A, B and C:
Relation A:
| Id | Name | Age |
|---|---|---|
| 12 | Arun | 60 |
| 15 | Shreya | 24 |
| 99 | Rohit | 11 |
Relation B:
| Id | Name | Age |
|---|---|---|
| 15 | Shreya | 24 |
| 25 | Hari | 40 |
| 98 | Rohit | 20 |
| 99 | Rohit | 11 |
Relation C:
| Id | Phone | Area |
|---|---|---|
| 10 | 2200 | 02 |
| 99 | 2100 | 01 |
Shared with question 51.
Question
How many tuples does the result of the following relational algebra expression contain? Assume that the schema of is the same as that of .
Official answer and solution
- Official answer
- A
- From
- Official GATE 2012 answer key
Solution
Compute the relation union A U B, then evaluate the theta-join condition (A.Id > 40 OR C.Id < 15) with relation C.
- Relation union (set union removes duplicate rows):
- Tuples in :
(12, Arun, 60),(15, Shreya, 24),(99, Rohit, 11) - Tuples in :
(15, Shreya, 24),(25, Hari, 40),(98, Rohit, 20),(99, Rohit, 11) - Distinct tuples in (5 tuples):
(12, Arun, 60)(15, Shreya, 24)(25, Hari, 40)(98, Rohit, 20)(99, Rohit, 11)
- Relation contains 2 tuples:
- with
- with
- Evaluating join condition for each pair:
- For tuple (): Since is TRUE, the disjunction is TRUE for all 5 tuples of . Yields 5 tuples.
- For tuple (): is FALSE. The condition holds only if . In , tuples with are
(98, Rohit, 20)and(99, Rohit, 11). Yields 2 tuples.
- Total result tuples:
- This matches option (A).
Final answer
A
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2012 Computer Science and Information Technology (CS)
- Question
- 50 of 65, printed as CS Q.50
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.