# Data Base Management System | Week 3

Session: JAN-APR 2024

Course Name: Data Base Management System

#### Q1. Consider the following instances:Consider the Relational Algebra on these given instances:IIName, Branch, Capacity (University)÷(IIBranch, Capacity (@Fees<=200000 University) n IIBranch, Capacity (@Capacity 2000 University))What is the output of the Relational Algebra?a) JFTT.b) KSSL.c) LKUniversity.d) No row will be selected.

Q2. Consider the following instances:
How many tuples are returned by the following Relational Algebra?
IIDips.Name(Dips n (Dips <>(@Dips1.Rating <5V Dips1.Price<=80(PDips1 (Dips)))))

a) 1
b) 2
c) 3
d) 4

These are Data Base Management System Week 3 Assignment Answers

Q3. Consider the relational schema Sensor (SensorID, Battery, BaseStationID, Range). Choose the correct Tuple Relational Calculus that represents the following statement “Display all the SensorIDs associated with BaseStationID BS1.”
a) {s|t < t [BaseStationID]=^BS1′>}
b) {|3s € Sensor (p[BaseStationID]=^BS1′) }
c) {t|3s € Sensor (t [SensorID]=s [BaseStationID] ^ t [BaseStationID]=’BS1′)}
d) {t|3s € Sensor (t [SensorID]=s [SensorID] ^ s [BaseStationID]=’BS1′) }

Answer: d) {t|3s € Sensor (t [SensorID]=s [SensorID] ^ s [BaseStationID]=’BS1′) }

Q4. Consider the relational schema Sensor (SensorID, Battery, BaseStationID, Range). Choose the correct Domain Relational Calculus equivalent to the following SQL query
SELECT Range FROM Sensor WHERE Battery=’500′

a) {sl3c, d, i (c, d, i, s € Sensor ^ Battery=’500′)}
b) {<s>13c, d, i (<c, d, i, s› € Sensor A d=’500′)}
c) {<s>|]c, d, i (<c, d, i> € s A Battery=’500′)}
d) {sl3<c, d, i> (c, d, i, s E Sensor ^ d=’500′)}

Answer: b) {<s>13c, d, i (<c, d, i, s› € Sensor A d=’500′)}

These are Data Base Management System Week 3 Assignment Answers

Q5. A C program, with embedded SQL query allows the users to enter their Year of Birth and Country which are stored in variables yob and cou respectively. The SQL command returns the counts of those all other people born in the same year and country from Person(id, Birth, Country).
Which of the following SQL queries is correct for the purpose?

a) EXEC SQL
DECLARE C CURSOR AS SELECT id
FROM Person
WHERE Birth==yob AND Country==cou
END_EXEC
b) EXEC SQL
DECLARE C CURSOR FOR
SELECT count(id)
FROM Person
WHERE :Birth: yob & Country=:cou
END_EXEC
c) EXEC SQL
DECLARE C CURSOR AS
SELECT id
FROM Person
WHERE :Birth==yob & Country==cou
END_EXEC
d) EXEC SQL
DECLARE C CURSOR FOR
SELECT count(id)
FROM Person
WHERE Birth: yob AND Country=:cou
END_EXEC

These are Data Base Management System Week 3 Assignment Answers

Q6. A company maintains a schema of Reports where each report is identified by a Heading. The reports are also associated with corresponding a Date and Length. Moreover, each report can be written by multiple Authors. Which of the following schema correctly represents the Reports entity set?

These are Data Base Management System Week 3 Assignment Answers

Q7. Consider the Entity Relationship Diagram
Which of the following is true?

a) The schema for the Device entity will be Device (Model_ID, Color) and DeviceSensor (Model_ID, SensorName).
b) The schema for the Dev_Owner will be Dev_Owner (Model_ID, OID).
c) The schema for the Owner will be Owner (OID, Model ID, Name, Address).
d) The schema for the Device entity will be Device (Model_ID) and DeviceSensor (SensorName, Color).

Answer: b) The schema for the Dev_Owner will be Dev_Owner (Model_ID, OID).

These are Data Base Management System Week 3 Assignment Answers

Q8. Consider the Entity Relationship Diagram
Which of the following is true?

a) Participation of College in University is total.
b) Participation of College in Enrolled is total.
c) Participation of Student in University is partial.
d) Participation of Uni_Stu in Student is partial.

Answer: b) Participation of College in Enrolled is total.

These are Data Base Management System Week 3 Assignment Answers

Q9. Consider the Entity Relationship Diagram
Which of the following is false?

a) The schema of University is University (UName, Area, Location).
b) The schema of University is University (UName, Area, Location, Departments, Employees).
c) The schema of Technical is Technical (UName, Departments, Employees).
d) The schema of Technical are Technicali (UName, Departments) and Technical2(UName, Employees).

These are Data Base Management System Week 3 Assignment Answers

Q10. 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? ICar Number (Car) – Car-Number (Renter Renting)

a) The Car Number of those Cars that are rented by at most one Renter.
b) The Car_Number of those Cars that are rented by at least one Renter.
c) The Car Number of those Cars that are rented by all Renters.
d) The Car Number of those Cars that are not rented by any Renter.

Answer: d) The Car Number of those Cars that are not rented by any Renter.

These are Data Base Management System Week 3 Assignment Answers

Course Name: Data Base Management System

#### Q1. Consider the following instance of the relation MovieBooking (MovieName, TheatrID, HallNo, Glasses 3D, MLanguage, Showtime ID, ShowDay)

Which of the following MovieNames are produced by the Relational Algebra expression given below?
IlMovieName (HallNo>2^MLanguage English’ (MovieBooking))
IlMovie Name (Glasses3D-‘Yes’ (MovieBooking))

a) The Martian
b) Interstellar
c) Gravity
d) Inception

These are Data Base Management System Week 3 Assignment Answers

Q2. 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 “?
a) {13 p,t Employee (t [Salary] =p [Dept] v p [Experience] =10)}
b) {t13p = Employee (t [EID] =p [EID] ^ p [Experience] >10)}
c) {t13 p,t Employee (t [Salary] =p [EID] ^ p [EID]>10)}
d) {13p = Employee (t [EID] =p [EID] ^ p [Employee] >10)}

Answer: b) {t13p = Employee (t [EID] =p [EID] ^ p [Experience] >10)}

These are Data Base Management System Week 3 Assignment Answers

Q3. Consider the following Entity Relationship Diagram :

If n [Payment] is the number of attributes present in the relational schema of Payment, n[In_Cash] is the number of attributes present in the relational schema of In-Cash and n[In Cheque] is the number of attributes present in the relational schema of In_Cheque, which of the following options can NOT be true?
a) n[Payment] = 6
b) n[In Cheque] = 6
c) n[In_Cash] = 4
d) n[In_Cheque] = 3

These are Data Base Management System Week 3 Assignment Answers

Q4. Consider the Entity Relationship diagram:

Which attribute will not be present in the schema of ManagedBy?
a) cnumber
b) id
c) experience
d) Enrolment

These are Data Base Management System Week 3 Assignment Answers

Q5. 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 Building Locations of those Buildings whose BuildingColor is “Gray”?
a) {plan,t,c ( € Building ^c=”Gray”)}
b) {plan,t,c (n,t,c € Building ^c=”Gray”) }
c) {n,t,c (p,n,t,c € Building V c=”Gray”)}
d) {ln,t,c ( € Building ^ c=”Gray”)}

Answer: d) {ln,t,c ( € Building ^ c=”Gray”)}

Q6. Consider the Entity Relationship diagram : Which of the following statement (s) is/are TRUE?

a) DOGS inherit the attributes of CARNIVORES but not of ANIMALS.
b) DOGS inherit the attributes of CARNIVORES and ANIMALS.
c) CARNIVORES inherit the attributes of DOGS but not of OMNIVORES.
d) ANIMALS inherit the attributes of CARNIVORES, OMNIVORES, HERBIVORES and DOGS.

Answer: c) CARNIVORES inherit the attributes of DOGS but not of OMNIVORES.

These are Data Base Management System Week 3 Assignment Answers

Q7. 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?
a) Creates (Tag, ID)
Handicraft (Tag, Material, Color)
b) Creates (ID)
Handicraft (Tag Material)
Handicraft_color (Tag, Color)
c) Creates (Tag, ID, Color)
Handicraft (Tag, Material)
d) Creates (Tag, ID)
Handicraft (Tag, Material)
Handicraft_color (Tag, Color)

Handicraft (Tag, Material)
Handicraft_color (Tag, Color)

These are Data Base Management System Week 3 Assignment Answers

Q8. Consider 2 instances:

Which PageNumber is not produced by the following Relational Algebra?
((IIpageNumber, Topic (Chapter) – Paragraph) x Paragraph) IIchapter.PageNumber
a) 11
b) 40
c) 20
d) 33

These are Data Base Management System Week 3 Assignment Answers

Q9. 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.

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

DECLARE C CURSOR
FOR SELECT ITEM
FROM PRODUCT
WHERE PRICE >: monthly_budget AND MONTH= : target_month
END EXEC

These are Data Base Management System Week 3 Assignment Answers

Q10. Consider the following instance of a relation Uniform :

How many tuples will be returned by the following Relational Algebra Query? Uniform) ÷ Ilcolor (Color=’Blue Uniform)) U ((School=’KidSys’vColor=’Blue IISchool (Color White/Uniform)
a) 1
b) 2
c) 3
d) 4