DBMS Solution 3
DBMS Solution 3
Total Marks : 20
Question 1
Consider the following instance of the relation MovieBooking(MovieName, TheatrID, HallNo,
Glasses3D, MLanguage, ShowtimeID, ShowDay)
MovieBooking
MovieName TheatrID HallNo Glasses3D MLanguage ShowtimeID ShowDay
The Martian Inx K 2 Yes English 12 Monday
Interstellar Iks B 4 Yes English 15 Wednsday
Gravity Bssr K 1 No Hindi 178 Wednesday
Gravity Bssr K 4 No English 24 Thursday
Inception Inx K 3 Yes English 13 Friday
Which of the following MovieNames are produced by the Relational Algebra expression given
below?
ΠMovieName (σHallNo>2∧MLanguage=0 English0 (MovieBooking)) ∩
ΠMovieName (σGlasses3D=0 Yes0 (MovieBooking))
Marks: 2 MSQ
a) The Martian
b) Interstellar
c) Gravity
d) Inception
Answer: b), d)
Explanation: ΠMovieName (σHallNo>2∧MLanguage=0 English0 (MovieBooking)) produces
Interstellar, Gravity, Inception. However, Gravity is not associated with 3D Glasses
in the instance. Hence, the intersection operation produces Interstellar and Inception.
Hence, options (b) and (d) are correct.
1
Question 2
Consider the relation Employee(EID, Dept, Experience, Salary).
What is the Tuple Relational Calculus expression equivalent to the statement
“Select those Employee IDs (EID) whose Experiences are more than 10 years ”?
Marks: 2 MCQ
Answer: b)
Explanation: According to the syntax and semantics of Tuple Relational Calculus. Hence,
option (b) is correct.
2
Question 3
Consider the following Entity Relationship Diagram:
a) n[Payment] = 6
b) n[In Cheque] = 6
c) n[In Cash] = 4
d) n[In Cheque] = 3
Answer: a), b)
Explanation: The relational schema can be designed as:
Method 1 (Refer to slide 15.10):
Payment(TransactionID, Amount, Paid By)
In Cash(TransactionID, ReceiptNo)
In Cheque(TransactionID, ChqNo, ChqDate)
3
Question 4
Consider the Entity Relationship diagram:
Which attribute will not be present in the schema of ManagedBy? Marks: 2 MCQ
a) cnumber
b) id
c) experience
d) Enrolment
Answer: d)
Explanation: In Aggregation, the schema representation contains the primary keys of the
relationship set, associated entity and any descriptive attribute that is present. Here, the
primary keys of the relationship set Enrolment are id and pnumber. That of the associated
entity ADMIN is cnumber and the descriptive attribute is experience. Hence, option d) is
correct.
4
Question 5
In a company, the Building relation maintains information about the BuildingLocation,
BuildingFloors, BuildingType and BuildingColor.
What will be the Domain Relational Calculus expression to obtain the BuildingLocations of
those Buildings whose BuildingColor is “Gray”? Marks: 2 MCQ
Answer: d)
Explanation: According to the syntax and semantics of Tuple Relational Calculus. Hence,
option (d) is correct.
5
Question 6
Consider the Entity Relationship diagram: Marks: 2 MCQ
Which of the following statement(s) is/are TRUE?
Answer: b)
6
Question 7
In a company, a Handicraft is made by multiple Artisans and an Artisan makes multiple
Handicrafts. The Handicrafts are identified by their unique Tags. A Handicraft is made of
a particular Material and is multi- Colored. An Artisan has a unique ID. Assuming there
is a Creates relation between Handicraft and Artisan, what will be the correct schema for
Creates and Handicraft? Marks: 2 MCQ
a) Creates(Tag, ID)
Handicraft(Tag, Material, Color)
b) Creates(ID)
Handicraft(Tag Material)
Handicraft color(Tag, Color)
d) Creates(Tag, ID)
Handicraft(Tag, Material)
Handicraft color(Tag, Color)
Answer: d)
Explanation: In many-to-many relation, the relation Creates should have the primary keys
of the participating entities and since Color is multivalued, a separate schema has to be created
named Handicraft color. Hence, option (d) is correct.
7
Question 8
Consider 2 instances:
Chapter
PageNumber Topic Length
Paragraph
11 Introduction 5
PageNumber Topic
20 SQL 136
20 SQL
33 RA 567
33 RA
40 FD 898
33 ERD 204
a) 11
b) 40
c) 20
d) 33
Answer: c)
Explanation: (ΠPageNumber,Topic (Chapter) − Paragraph) produces the following tuples:
Chapter.PageNumber Chapter.Topic
11 Introduction
40 FD
33 ERD
The Cartesian product of these tuples with Paragraph, followed by the projection produces
PageNumbers 11, 40 and 33. Hence, option(c) is correct.
8
Question 9
Consider the relation GROCERY(ITEM, PRICE, MONTH).
Select the SQL query from within a host language, to find those ITEMS whose PRICE has
exceeded the price stored in monthly budget in a specific MONTH defined in target month.
monthly budget and target month are declared in host language. Marks: 2 MCQ
a) EXEC SQL
DECLARE c CURSOR FOR
SELECT ITEM
FROM GROCERY
WHERE PRICE > monthly_budget AND MONTH= target_month
END_EXEC
b) EXEC SQL
DECLARE c CURSOR FOR
SELECT GROCERY
FROM GROCERY
WHERE PRICE > monthly_budget AND MONTH= :target_month
END_EXEC
c) EXEC SQL
DECLARE c CURSOR FOR
SELECT ITEM
FROM GROCERY
WHERE PRICE > :monthly_budget
END_EXEC
d) EXEC SQL
DECLARE c CURSOR FOR
SELECT ITEM
FROM PRODUCT
WHERE PRICE > :monthly_budget AND MONTH= :target_month
END_EXEC
Answer: d)
Explanation: The variables declared in host language must begin with : in the embedded
SQL query. Hence, option (d) is correct.
9
Question 10
Consider the following instance of a relation Uniform:
School Color
EduSys Red
APL Green
KidSys Green
GlobalEd Blue
LPInternational Blue
EduSys White
How many tuples will be returned by the following Relational Algebra Query?
((σSchool=0 KidSys0 ∨Color=0 Blue0 Uniform) ÷ ΠColor (σColor=0 Blue0 Uniform)) ∪
ΠSchool (σColor=0 White0 Uniform)
Marks: 2 MCQ
a) 1
b) 2
c) 3
d) 4
Answer: c)
Explanation: ((σSchool=0 KidSys0 ∨Color=0 Blue0 Uniform)÷ΠColor (σColor=0 Blue0 Uniform))
produces the names of those schools whose uniform colors are blue (2 tuples).
ΠSchool (σColor=0 White0 Uniform) produces the name of that school whose uniform color is
white (1 tuple). Hence, option (c) is correct.
10