Assignment_3_NPTEL_DBMS_January_2025
Assignment_3_NPTEL_DBMS_January_2025
Question 1
An organization, collecting car renters’ information, considers the following relations:
Renter(Renter ID, Contact)
Renting(Renter ID, Car Number)
Car(Car Number, Model).
What will the following relational algebra expression return to the organization?
a) The Contacts of those Renters who are Renting at most one Car at that instance.
b) The Contacts of those Renters who are Renting every Car at that instance.
c) The Contacts of those Renters who are Renting at least one Car at that instance.
d) The Contacts of those Renters who are not Renting any Car at that instance.
Answer: d)
Explanation: ΠContact (Renter) returns all the Contacts from the enlisted Renters.
ΠContact (Renter 1 Renting) returns the Contacts of those Renters whose IDs have matched with
some ID in Renting i.e. the Contacts of those Renters who are Renting some Car at that instance.
Therefore, the (Contacts of all Renters − the Contacts of those Renters renting some Car) gives
the Contacts of those Renters who are not Renting any Car.
Hence, option d) is correct.
1
Question 2
An institute, maintaining a biological information system, designs an entity Species having the at-
tributes ID, Name, and Tags. ID is unique and cannot be NULL. The Name is composed of Generic
and Specific names. Tags can have multiple values. Which of the following ER notation represents
the entity Species correctly?
a)
b)
c)
d)
Answer: b)
Explanation: From the given problem, the ID should be the key attribute, denoted by underline,
Name should be a composite attribute where the sub-atrributes Generic, Specific should be denoted
with an indentation and Tags is a multivalued attribute enclosed by {}.
Hence, option b) is correct.
2
Question 3
Consider 2 instances:
Chapter
PageNo Topic Length
Paragraph
1 Introduction 5
PageNo Topic
2 SQL 6
2 SQL
3 RA 7
3 RA
4 FD 8
3 ERD 2
Which of the following operations return the 2 tuples that are present in Paragraph?
a) (Chapter)-(ΠPageNo,Topic (Chapter)-Paragraph)
Answer: c)
Explanation: Option (a) results in invalid − operation as the “arity” of Chapter and
(ΠPageNo,Topic (Chapter)-Paragraph) are not same.
Option (b) is incorrect as the ∩ operation has relations with incompatible domains of attributes on
L.H.S and R.H.S.
Option (c) is correct. As Paragraph ⊂ Chapter, ΠPageNo,Topic (Chapter) ∪ Paragraph results in
all the values of PageNo, Topic in Chapter and the ∩ selects the ones in Paragraph only.
Option (d) is incorrect as the outermost projection operation results in ambiguity.
3
Question 4
Consider the relations Temp India(Place, Celsius) and Temp France(Place, Celsius) and the
following instances:
Temp India
Temp France
Place Celsius
Place Celsius
Ahmedabad 29
Nice 20
Jaipur 22
Paris 18
Roorkee 22
Dijon 11
Kolkata 21
a) Temp India
b) Temp France
Answer: a)
Explanation: ((Temp India ∪ Temp France)) produces all tuples from both relations.
(Temp India - Temp France) = Temp India.
Thus, ((Temp India ∪ Temp France)-(Temp India - Temp France)) = Temp France
and Temp India-((Temp India ∪ Temp France)-(Temp India - Temp France)) = Temp India.
Hence, option (a) is correct.
4
Question 5
Consider the relational schema Photography(Photographer, Camera, Theme, Location).
Choose the correct Tuple Relational Calculus that represents the following statement
“Display all photographers who clicked photographs with a DSLR camera in Darjeeling.”
Answer: d)
Explanation: The tuple to be selected is represented by ‘t’ and the selection conditions are written
with ∧ as per the given question. According to the projection and selection operations shown in
lecture slides 12.26 - 12.28, option (d) shows the correct syntax and semantics of the Tuple Relational
Calculus.
5
Question 6
Consider the following instance of the relation CakeShop(Owner, Name):
CakeShop
Owner Name
Peter BakeCake
Viola CakeStop
John Cherry
Peter SweetTooth
Peter FudgePalace
Viola Desserted
Which of the following relational algebra expression does generate names of those Owners who owns
two or more CakeShops?
Answer: b)
Explanation: The Cartesian product between the renamed tables will generate 36 tuples and the
condition σC1.Owner=C2.Owner∧C1.N ame̸=C2.N ame selects the following tuples out of the 36 tuples:
6
Question 7
Consider the relational schema FormulaBook(Page, Sl, Formula).
An embedded SQL query is written with C as host language to derive some Formula entered in the
FormulaBook according to the following conditions
EXEC SQL
DECLARE c CURSOR FOR
SELECT Formula
FROM FormulaBook
WHERE Page> :PageGiven AND Sl=:SLGiven
END EXEC
Select the correct option for declaring the variables PageGiven and SLGiven.
a) EXEC-SQL BEGIN
int :PageGiven ;
int :SLGiven ;
EXEC-SQL END;
d) EXEC-SQL BEGIN
int PageGiven ;
int SLGiven ;
EXEC-SQL END;
Answer: b)
Explanation: The declaration of the variables are enclosed within
EXEC-SQL BEGIN DECLARE SECTION
EXEC-SQL END DECLARE SECTION;
The variable declaration follow the host language syntax. Hence, option (b) is correct.
7
Question 8
In a printing company, a Book is printed by multiple Employees and an Employee prints multiple
Books. The Books are identified by their unique Title. A Book also has an Edition and multiple
values of the attribute Author. An Employee has a unique ID. Assuming there is a Prints relation
between Book and Employee, what will be the correct schema for Prints and Book?
a) Prints(Title, ID)
Book(Title, Edition, Author)
b) Prints(ID)
Book(Title Edition)
Book author(Title, Author)
c) Prints(Title, ID)
Book(Title, Edition)
Book author(Title, Author)
Answer: c)
Explanation: The following represents the ER diagram of the given case.
In many-to-many relation, the relation Prints should have the primary keys of the participating
entities and since Author is multivalued, a separate schema has to be created named Book author.
Hence, option (c) is correct.
8
Question 9
Consider the Entity Relationship Diagram:
a)
b)
c)
d)
Answer: a)
Explanation: As per the alternate ER notation shown in lecture slide 15.27.
9
Question 10
Consider the Entity Relationship Diagram:
Answer: c), d)
Explanation: Option (a) and (b) are true as per the ER Diagram notations. Age is a derived attribute
of Owner. DOB is not a component attribute of Address. Hence, options (c) and (d) are not true.
10