Assignment 3 DBMS JUL 2022
Assignment 3 DBMS JUL 2022
Total Marks : 20
June 8, 2022
Question 1
Consider the following instance of the relation Gardens(Name, Location, OpensAt, ClosesAt,
KnownFor)
Gardens
Name Location OpensAt ClosesAt KnownFor
Bageecha Delhi 10am 6pm Orchids
FloralParadise Delhi 10am 7.30pm Sunflower
TreeLand Mumbai 1pm 10pm Anthuriums
TreeLand Mumbai 1pm 10pm Hyacinths
FloralParadise Pune 8am 11pm Celosia
Answer: b)
Explanation: Option (a) and (c) are incorrect as the common attributes for the Natural Join
do not have a common value for any tuple produced by R1 and R2. Option (d) is incorrect as
the it produces the tuple FloralParadise Sunflower Pune . Hence, option (b) is correct.
1
Question 2
Consider the following instance of the relation Gardens(Name, Location, OpensAt, ClosesAt,
KnownFor)
Gardens
Name Location OpensAt ClosesAt KnownFor
Bageecha Delhi 10am 6pm Orchids
FloralParadise Delhi 10am 7.30pm Sunflower
TreeLand Mumbai 1pm 10pm Anthuriums
TreeLand Mumbai 1pm 10pm Hyacinths
FloralParadise Pune 8am 11pm Celosia
R1=ΠName,Location (Gardens)
R2=((ΠLocation (σClosesAt=‘7.30pm’ (Gardens)))∪(ΠLocation (σOpensAt=‘8am’ (Gardens))))
a) TreeLand
b) TreeLand, Bageecha
c) Bageecha, FloralParadise
d) FloralParadise
Answer: d)
Explanation: R2 produces Delhi, Pune. The only Garden present in both these cities is
FloralParadise. Hence, option (d) is correct.
2
Question 3
A C program, with embedded SQL allows the users to enter their ticket number which is stored
in the variables tno. With the help of an embedded SQL query, the program then displays
the corresponding travel date and destination from a database with the following schema:
TravelReg(TicketNo, Destination, TravelDate, ReservationName). Select the correct
Embedded SQL query that should be present in this C program. Marks: 2 MCQ
a) EXEC SQL
declare c cursor for
SELECT *
FROM TravelReg
WHERE tno=TicketNo
END EXEC
b) EXEC SQL
declare c cursor for
SELECT TravelDate, Destination
FROM TravelReg
WHERE tno=:TicketNo
END EXEC
c) EXEC SQL
declare c cursor for
SELECT *
FROM TravelReg
WHERE TicketNo=tno
END EXEC
d) EXEC SQL
declare c cursor for
SELECT TravelDate, Destination
FROM TravelReg
WHERE TicketNo=:tno
END EXEC
Answer: d)
Explanation: As per the syntax and semantics of embedded SQL queries (Refer to slide
11.15). Hence, option (d) is correct.
3
Question 4
Consider the following instance of the relation Gardens(Name, Location, OpensAt, ClosesAt,
KnownFor)
Gardens
Name Location OpensAt ClosesAt KnownFor
Bageecha Delhi 10am 6pm Orchids
FloralParadise Delhi 10am 7.30pm Sunflower
TreeLand Mumbai 1pm 10pm Anthuriums
TreeLand Mumbai 1pm 10pm Hyacinths
FloralParadise Pune 8am 11pm Celosia
a) TreeLand
Mumbai Anthuriums
b)
Mumbai Hyacinths
Anthuriums
d)
Hyacinths
Answer: d)
Explanation: According to the syntax and semantics of Tuple Relational Calculus, option
(d) is correct.
4
Question 5
Consider the following Entity Relationship Diagram:
b) The primary key in the relational schema for Receipt is {Name, ItemName, ProductNo}.
c) The primary key in the relational schema for Receipt will be {Name, ItemName, AgentPin}.
Answer: a), b)
Explanation: Total participation is identifies by a double line. The primary key of a weak
entity set contains the primary key of its identifying entity set. Hence, options (a) and (b) are
correct.
5
Question 6
Consider the relation Planets(pname, rank, satellites, diameter)
What is the Domain Relational Calculus expression equivalent to the statement
“Select the names of those Planets which have a diameter of more than 50,000 kms”?
Marks: 2 MCQ
Answer: b)
Explanation: Options (a) and (d) are ruled out as <> are not present. Option (c) is syntac-
tically incorrect (Refer to slide 12.28). Option (b) is syntactically and semantically correct.
6
Question 7
Consider the following scenario:
A Natural resource management company keeps a record of different forests, identified by their
names. A forest is associated with its location that contains the Country and area in which the
forest is present. In each forest, there are different types of trees that are also recorded by the
company.
Which of the following schema correctly represents the Forest entity set? Marks: 2 MCQ
Answer: b)
Explanation: Refer to slide 14.23 for details.
In the schema of option (a), the location is not properly explained.
In the schema of option (c), the attribute Name cannot be primary key in the Forest relation.
In the schema of option (d), the attribute Name cannot be primary key in the Forest trees
relation.
The schema in option (b) specifies the location correctly and captures the tree information in
a forest as well.
Hence, option (b) is correct.
7
Question 8
Consider the following Entity Relationship Diagram:
Answer: b)
Explanation: According to the syntax of Crows feet notation, the following can be concluded.
One Author may write many Books.
One Author may be related to zero or more Publisher. So, the participation of Author in
the relation Auth pub is partial.
A Publisher may have one or more Authors. So, the participation of Publisher in the
relation Auth pub is total.
Hence, option (b) is correct.
8
Question 9
Consider the instance of the relational schema Gallery(PaintingID, Artist, Theme) and
Price(PaintingID, Cost):
Gallery Price
PaintingID Artist Theme PaintingID Cost
A12 J.Ray Landscape A12 124000
A187 J.Ray Portrait A187 239876
B3 KatieP Abstract B3 1000000
H23 L.Houston Landscape H23 50000
How many tuples will be generated by the following Tuple Relational Calculus expression?
{t|∃p ∈ Gallery ∃q ∈ Price(t[PaintingID] = p[PaintingID] ∧ t[Artist] = p[Artist] ∧
t[Theme] = p[Theme] ∧ t[Cost] = q[Cost] ∧ p[PaintingID] = q[PaintingID])}
Marks: 2 MCQ
a) 3
b) 4
c) 8
d) 10
Answer: b)
Explanation: According to slide 12.33, the given Tuple Relational Calculus expression is
equivalent to
Gallery on Price in Relational Algenra.
Hence, option (b) is correct.
9
Question 10
Consider the instance of the relational schema Gallery(PaintingID, Artist, Theme):
Gallery
PaintingID Artist Theme
A12 J.Ray Landscape
A187 J.Ray Portrait
B3 KatieP Abstract
H23 L.Houston Landscape
Which of the following Relational Algebra expressions produce(s) exactly the same tuples as
present in this instance of Gallery? Marks: 2 MSQ
a) ΠPaintingID,Artist (Gallery) o
n ΠPaintingID,Theme (Gallery)
b) ΠPaintingID,Artist (Gallery) o
n ΠArtist,Theme (Gallery)
c) ΠPaintingID,Theme (Gallery) o
n ΠPaintingID,Theme (Gallery)
d) ΠPaintingID,Theme,Artist (Gallery) o
n ΠTheme (Gallery)
Answer: a), d)
Explanation: Option (c) is incorrect as Artist will not be present in the output. Option (b)
is incorrect as it produces 2 extra tuples due to the redundant value J. Ray in the common
attribute.
Options (a) and (d) are correct.
10