0% found this document useful (0 votes)
50 views49 pages

Advanced DBMS 2023

Uploaded by

vajid371ak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views49 pages

Advanced DBMS 2023

Uploaded by

vajid371ak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

GATE Computer Science & IT

ADVANCED
DATABASE
MANAGEMENT
SYSTEM

Practice Questions
Booklet
ANALYSIS OF DATABASE MANAGEMENT SYSTEM IN GATE PAPER

Years Marks
2015 6
2016 5
2017 8
2018 6
2019 4
2020 7
2021Set-1 10
2021Set-2 7

DATABASE MANAGEMENT SYSTEM GATE SYLLABUS


 Overview: Introduction of Relational Database Management System concepts.
 SQL: Overview of the structured query language, Basic Structure of SQL Queries, Set
Operations, Null values, Aggregate Functions, Nested Sub Queries, Views, Join Expressions,
Insert ,Delete, Update Statements in SQL etc.
 Other Relational Languages: Tuple Relational Calculus, Domain Relational Calculus etc.
 Normalization: Functional Dependencies, Multivalued Dependencies Decomposition Using
Functional Dependencies, Normal Form, 1NF 2NF, 3NF, BCNF, 4NF, etc.
 Hashing and Indexing: Basic Concepts, Ordered Indices, B, B+Tree, Static Hashing, Dynamic
Hashing etc.
 Transaction and Serializability: Transaction Concept, Transaction State, ACID Property,
Recoverability, Concurrency Control etc.
 Entity Relationship Model: Entity Relationship Diagrams, Constraints, Entity Types, Entity
Sets, Attributes and keys, Relational Database Design Using ER-to-Relational Mapping etc.

DBMS REFERENCE BOOKS


 Fundamentals of Database Systems by Shamkant B. Navathe.
 Database System Concepts by Henry F. Korth.
SQL and RA
SQL and RA
Data for the next 10 questions, consider the following database schemas:
 Flights(flno:integer, from:string, to:string, distance:integer)
 Aircraft(aid: integer, aname: string, cruisingrange: integer)
 Certified(eid: integer, aid: integer)
 Employees(eid: integer, ename: string, salary: integer)

And the snapshots of database:


Flights
Flno From To Distance Departs Arrive
Price

Aircraft Certified
Aid Aname Cruisingrange
Eid
Aid

Employees
Eid Ename Salary

Answer the following question based on the above database schema and snapshot.

ADVANCED DATABASE MANAGEMENT SYSTEM - 20231


Q1. Consider the following SQL query on the above database:
SELECT C.eid, MAX(A.cruisingrange)
FROM Certified C, Aircraft A
WHERE C.aid = A.aid
GROUP BY C.eid
HAVING COUNT (*) > 3
The number of rows return by the above query is___________

Q2. Consider the following SQL query on the above database:


SELECT DISTINCT E.ename
FROM Employees E, Certified C, Aircraft A
WHERE E.eid = C.eid AND C.aid = A.aid AND A.aname LIKE ‘Boeing%’
The number of rows return by the above query is___________

Q3. Consider the following SQL query on the above database:


SELECT A.aid
FROM Aircraft A
WHERE A.cruisingrange> (SELECT MIN (F.distance)
FROM Flights F
WHERE F.from = ‘Bangalore’
AND F.to = ‘Delhi’)
The number of rows return by the above query is___________

Q4. Consider the following SQL query on the above database:


SELECT a.aid,a.aname,AVG(e.salary)
FROM Aircraft a, Certified c, Employees e
WHERE a.aid=c.aid
AND c.eid=e.eid
AND a.cruisingrange>1000
GROUP BY a.aid,a.aname
The number of rows return by the above query is___________

Q5. Consider the following SQL query on the above database:


SELECT DISTINCT e.ename
FROM employees e
WHERE e.salary<(SELECT MIN(f.price)
FROM flight f
WHERE f.from='Bangalore'
AND f.too='Frankfurt');
The number of rows return by the above query is___________

ADVANCED DATABASE MANAGEMENT SYSTEM - 20232


Q6. Consider the following SQL query on the above database:
SELECT Temp1.avg - Temp2.avg
FROM (SELECT AVG (E.salary) AS avg
FROM Employees E
WHERE E.eid IN (SELECT DISTINCT C.eid
FROM Certified C)) AS Temp1,
(SELECT AVG (E1.salary) AS avg
FROM Employees E1) AS Temp2
The value display by the above query is___________

Q7. Consider the following SQL query on the above database:


SELECT E.ename
FROM Employees E, Certified C, Aircraft A
WHERE C.aid = A.aid AND E.eid = C.eid
GROUP BY E.eid, E.ename
HAVING EVERY (A.cruisingrange> 1000)
The number of rows return by the above query is___________

Q8. Consider the following SQL query on the above database:


SELECT E.ename
FROM Employees E, Certified C, Aircraft A
WHERE C.aid = A.aid AND E.eid = C.eid
GROUP BY E.eid, E.ename
HAVING EVERY (A.cruisingrange> 1000)
AND ANY (A.anameLIKE ’Boeing%’)
The number of rows return by the above query is___________

Q9. Consider the following SQL query on the above database:


SELECT E.ename
FROM Employees E, Certified C, Aircraft A
WHERE C.aid = A.aid AND E.eid = C.eid
GROUP BY E.eid, E.ename
HAVING EVERY (A.cruisingrange> 1000) AND COUNT (*) > 1
The SQL query finds the
(a) names of employees who are certified on some aircrafts with cruising range
longer than 1000 miles, but on at least one such aircrafts.
(b) names of employees who are certified only on aircrafts with cruising range
longer than 1000 miles, but on at least one such aircrafts.
(c) names of employees who are certified on some aircrafts with cruising range
longer than 1000 miles, but on at least two such aircrafts.
(d) names of employees who are certified only on aircrafts with cruising range
longer than 1000 miles, but on at least two such aircrafts.

ADVANCED DATABASE MANAGEMENT SYSTEM - 20233


Q10. Consider the following SQL query on the above database:
SELECT DISTINCT A.aname
FROM Aircraft A
WHERE A.Aid IN (SELECT C.aid
FROM Certified C, Employees E
WHERE C.eid = E.eid AND
NOT EXISTS (SELECT * FROM Employees E1
WHERE E1.eid = E.eid
AND E1.salary < 80000))
The SQL query finds the
(a) names of aircraft such that all pilots certified to operate them earn less than
80,000.
(b) names of aircraft such that some pilots certified to operate them earn less
than 80,000.
(c) names of aircraft such that all pilots certified to operate them earn more than
80,000.
(d) names of aircraft such that some pilots certified to operate them earn more
than 80,000.
Q11. Consider the following database of student enrollment in courses & books
adopted for each course.
Student (regno:string, name: string, major: string, bdate:date)
Course (courseno:int, cname:string, dept:string)
Enroll (regno:string, courseno:int, sem:int, marks:int)
Text (book-ISBN:int, book-title:string, publisher:string, author:string)
Book_adoption (courseno:int, sem:int, book-ISBN:int)
And the snapshot of the database:
Student Course

Text

ADVANCED DATABASE MANAGEMENT SYSTEM - 20234


Enroll Book_adoption

Consider the following SQL query on the above database:


SELECT c.courseno,t.book_isbn,t.book_title
FROM course c,book_adoptionba,text t
WHERE c.courseno=ba.courseno
AND ba.book_isbn=t.book_isbn
AND c.dept='CSE'
AND 2<(SELECTCOUNT(book_isbn)
FROM book_adoption b
WHERE c.courseno=b.courseno)
ORDER BY t.book_title;
The number of rows return by the above query is___________
Data for the next 4 questions, the following relations keep track of students, their

enrollment for classes along with faculty information.

Student (snum: integer, sname: string, major: string, level: string, age: integer)

Class (name: string, meets_at: string, room: string, fid: integer)

Enrolled (snum: integer, cname: string)

Faculty (fid: integer, fname: string, deptid: integer)

Consider the following snapshot of the above relations:

Student Faculty

ADVANCED DATABASE MANAGEMENT SYSTEM - 20235


Class Enrolled

The meaning of these relations is straight forward.For example, Enrolled has one
record per student-class pair such that the student is enrolled in the class. Level is a
two-character code with 4 different values (example: Junior: JR etc).
Q12. Which of the following SQL query find the names of all juniors (level=Jr) who are
enrolled for class taught by professor Harshith?
(a) SELECT DISTINCT s.sname
FROM student s,class c,faculty f,enrolled e
WHERE s.snum = e.snum ANDe.cname=c.cname
ANDs.level='jr'ANDf.fname='Harshith'
(b) SELECT DISTINCT s.sname
FROM student s, class c, faculty f, enrolled e
WHERE s.snum = e.snum AND e.cname = c.cname AND
s.level='jr'AND f.fname='Harshith' AND f.fid=c.fid;
(c) SELECT DISTINCT s.sname
FROM student s, class c, enrolled e
WHERE s.snum = e.snum AND e.cname = c.cname AND
s.level='jr'AND f.fname= (Select fname form faculty
wheref.fname='Harshith')
(d) SELECT DISTINCT s.sname
FROM student Natural Join class Natural Join enrolled
WHERE level='jr'AND fid= (Select fid form faculty
wheref.fname='Harshith')
Q13. Consider the following SQL query on the above database:
SELECT DISTINCT s.sname
FROM student s
WHERE s.snum IN (SELECT e1.snum
FROM enrolled e1,enrolled e2,class c1,class c2
WHERE e1.snum=e2.snum
ANDe1.cname<>e2.cname
ANDe1.cname=c1.cname
ANDe2.cname=c2.cname
ANDc1.meets_at=c2.meets_at);
The number of rows return by the above query is___________

ADVANCED DATABASE MANAGEMENT SYSTEM - 20236


Q14. Consider the following SQL query on the above database:
SELECT DISTINCT cname
FROM class
WHERE room='room128'
OR cname IN (SELECT e.cname
FROM enrolled e
GROUP BY e.cname
HAVING COUNT(*)>=5);
The number of rows return by the above query is___________

Q15. Consider the following SQL query on the above database:


SELECT f.fname,f.fid
FROM faculty f
WHERE f.fid in (SELECT fid FROM class
GROUP BY fid
HAVING COUNT(*) =(SELECT COUNT(DISTINCT room) FROM class));
The number of rows return by the above query is___________

Q16. Consider the following SQL query on the above database:


SELECT DISTINCT f.fname
FROM faculty f
WHERE f.fid IN (SELECT c.fid
FROM class c, enrolled e
WHERE c.cname = e.cname
GROUP BY c.cname HAVING COUNT(c.cname)< 5);
The number of rows return by the above query is___________

Data for the next three question, consider the following database schemas:
Product (pid, name, brand, price, color)
Sales (pid, buyer, store, date)
Assume that Sales.pid is a foreign key referring to Product.pid.
Q17. Consider the following SQL query Q:
SELECT brand
FROM Product
WHERE color = 'green'
GROUP BY brand
HAVING COUNT(*) < 3
Which of the following query(s) is/are equivalent to the SQL query Q?
Q1: SELECT DISTINCT brand
FROM Product p
WHERE(SELECT COUNT(*)
FROM Product q
WHERE q.brand = p.brand
AND q.color = 'green') < 3;

ADVANCED DATABASE MANAGEMENT SYSTEM - 20237


Q2: SELECT brand
FROM Product p
WHERE color = 'green' AND (SELECT COUNT(*)
FROM Product q
WHERE q.brand = p.brand
AND q.color = 'green') < 3;
(a) Q1 only (b) Q2 only
(c) Both Q1 and Q2 (d) Neither Q1 nor Q2

Q18. Consider the following SQL query Q:

Which of the following query(s) is/are equivalent to the SQL query Q?


Q1:

Q2:

(a) Q1 only (b) Q2 only


(c) Both Q1 and Q2 (d) Neither Q1 nor Q2

Q19. [MSQ]
Which of the following statement(s) is/are TRUE?
(a) The following SQL query does not return any tuples where price is NULL.
SELECT * FROM Product WHERE price C <> 100;
(b) Suppose that we define the schema of Sales in SQL as follows:
CREATE TABLE Sales
(pid INTEGER,
buyer CHAR(20),
seller CHAR(20),
date DATE,
FOREIGN KEY (pid) REFERENCES Product(pid) ON UPDATE CASCADE);
When we update the pid of a product in Sales, the database will update
the pid in the Product table.
(c) The following two queries are equivalent:
1. SELECT pid FROM Product ORDER BY price DESC LIMIT 1;
2. SELECT pid FROM Product WHERE price = (SELECT MAX (price)
FROM Product);
(d) The following is not a valid SQL query:
SELECT brand, MAX (price) FROM Product GROUP BY brand HAVING
price > 100;

ADVANCED DATABASE MANAGEMENT SYSTEM - 20238


Q20. Consider the following Employee table:

And the following SQL query:


SELECT E1.Emp_name, E1.dep_id, E1.salary
FROM Employers E1
WHERE 1 = (SELECT COUNT(DISTINCT salary)
FROM Employers E2
WHERE E2.salary > E1.salary AND E1.dep_id = E2.dep_id)
GROUP BY E.dep_id
The query finds the
(a) first highest salary of employee
(b) second highest salary of employee
(c) first highest salary of employee in each department
(d) second highest salary of employee in each department

Data for the next two questions, Consider the table created by the following SQL
statement:
CREATE TABLE G ( -- G is short for Grades
ssn INT, -- ssn of student
class CHAR(5), -- department and number of course
grade INT, -- final grade between 0 and 100
PRIMARY KEY(ssn,class)
)
Fill in the blanks to produce valid SQL queries to answer the following questions.
Q21. Find the SSNs of students who received the maximum score in CS123without
usingMAX.
SELECT ssn FROM G
WHERE class='CS123' AND grade _________ (SELECT grade FROM G);
Which of the following statement is used to complete the above query?
(a) >= ANY
(b) IN
(c) >= ALL
(d) MAX

ADVANCED DATABASE MANAGEMENT SYSTEM - 20239


Q22. Find the SSNs of all students who have received grades of 85or above in at least
3 classes.
SELECT ssn FROM G
WHERE __________
GROUP BY ssn
HAVING __________;
Which of the following must be the valid condition in the WHERE and HAVING
clause respectively to complete the above query?
(a) grade >= 85, COUNT(grade) > 3 (b) COUNT(*) > 3, grade >= 85
(c) grade >= 85, COUNT(*) >= 3 (d) COUNT(*) > 3, grade > 85

Q23. Consider the following relation schemas:


Department (departmentID, Dname)
Employee (Eid, Ename, DID, Salary)
Sales (Purchase_No, Date_of_purchase, Eid, DID, Amount, ItemID)
And the following SQL query:
SELECT Department
FROM Employee NATURAL JOIN Sales, Department
WHERE departmentID = DID
GROUP BY Department HAVING ________________;
How many of the following can go in the blank space shown? _________
1. max(salary) < 100000 2.count(department) > 5
3. department = 26 4. amount > 500000
5. sum(amount) > 50000 6.Department.Dname like "Marketing%"

Q24. Consider the following three SQL schema declarations. Assume that all
attributes have the same type, which has been omitted for clarity.
Schema 1: Create Table T1 (A Primary Key, B)
Create Table T2 (C, D References T1(A))

Schema 2: Create Table T1 (A Primary Key, B)


Create Table T2 (C, D Check(D In (Select A From T1)))

Schema 3: Create Table T1 (A Primary Key, B)


Create Table T2 (C, D)
Create Assertion A Check(
Not Exists (Select * From T2 Where D Not In (Select A From T1)))
Which of the following statements is true?
(a) All three schemas are equivalent in the database states and operations they
permit
(b) Schemas 1 and 2 are equivalent but Schema 3 is different
(c) Schemas 1 and 3 are equivalent but Schema 2 is different
(d) None of the three schemas are equivalent

ADVANCED DATABASE MANAGEMENT SYSTEM - 202310


Q25. Consider the following relational schema:
Customer(ID, name, phone) // ID is a key, <name,phone> is a key
Account(Num, custID, type, balance) // Num is the only key
Suppose we wish to find the names and phone numbers of customers who have
a checking or savings account with a negative balance. Each of the following five
queries attempts to achieve this goal.

Two queries are equivalent if they are guaranteed to produce the same result
over every database conforming to the schema. Which one of the following four
options is TRUE?
(a) All five queries are equivalent.
(b) Four of the queries are equivalent to each other and one is not equivalent to
those four.
(c) Three of the queries are equivalent to each other, and two of the queries are
not equivalent to those three but are equivalent to each other.
(d) Three of the queries are equivalent to each other, and two of the queries are
not equivalent to those three and are not equivalent to each other either.

ADVANCED DATABASE MANAGEMENT SYSTEM - 202311


Q26. Consider the database consisting of one relation:
Movie (title, director, actor)
Which of the following query find all pairs of distinct actors who act together in
at least one movie? ⍴a1→a2 represents renaming of an attribute a1 to a2.

(d)πactor1, actor2[σactor1 <> actor2 (ρactor → actor1 (πtitle, actor(movie))⨝𝑡𝑖𝑡𝑙𝑒 = 𝑡𝑖𝑡𝑙𝑒 2 ρactor → actor2, title → title2 (πtitle,

actor(movie)))]

Q27. Consider the database consisting of one relation:


Movie (title, director, actor)
Which of the following query find the directors such that every actor is cast in
one of his/her movies?

Q28. Consider the following schema:


Store(sid, store_name, parent_company).
Branch(sid, city, open24).
• sid is a foreign key to store
• open24 is a boolean. If true, the store is open 24 hours a day. If false, it is
open 7AM-10PM.
Has_Fruit(sid, city, fid, quantity, price).
• sid is a foreign key to store
• fid is a foreign key to fruit
• price is a floating point number representing the number of whole dollars
and whole cents of the price (for example, 3.00)
Fruit(fruit_id, name, calories)
Consider the following two attempt to find the store_names of all stores with
branches in Indore that are open at 2AM, have at least 5 pineapples, charge less
than Rs 30.00 per pineapple, and have parent company “WFM”
I. πstore_name (σparent_company='WFM' (Store) ⨝σcity='Indore' AND open24 (Branch)
⨝σquantity>= 5 AND price < 30.00(Has_Fruit) ⨝fruit_id=fidσname='pineapple' (Fruit))
II. {X | ∃s ∃b ∃h ∃f (s ∈ Store ∧ b ∈ Branch ∧ h ∈Has_Fruit
∧ f ∈ Fruit∧s.sid = b.sid∧s.sid = h.sid
∧b.city = h.city∧h.fid = f.fruit_id∧b.city = "Indore"
∧b.open24 ∧f.name = "pineapple" ∧h.quantity>= 5
∧h.price< 30.00 ∧s.parent_company = "WFM"
∧x.store_name = s.store_name}
Which of the following is/are correct?
(a) I only (b) II only
(c) Both I and II only (d) Neither I and II

ADVANCED DATABASE MANAGEMENT SYSTEM - 202312


Q29. Which of the following statement(s) is/are TRUE?
(a) A Theta-join is a natural join followed by selection operation.
(b) If R(A,B) and S(A,B) are any two relations, then πA(R ∪S) = πA(R) ∪πA(S).
(c) If R(A,B) and S(A,B) are any two relations, then πA(R ∩S) = πA(R) ∩πA(S).
(d) If R(A,B) and S(A,B) are any two relations, then πA(R -S) = πA(R) -πA(S).

Q30. Which of the following statement(s) is/are TRUE?


(a) The Union operation (∪) can be performed between any two relations.
(b) In relational algebra selection () operates on the columns or attributes of a
relation and projection (π) operates on the rows or tuples of a relation.
(c) The cardinality of a natural join between two relations A and B with no
common attributes between them, is equal to the cardinality of A plus the
cardinality of B.

(d) Assume R(A, B) and S(C, D). Then. R⋈B = cS = B = C(R × S).

Q31. Which of the following statement(s) is/are TRUE?


(a) Let R(A, B, C, D) and S(C, D). Then the result of R/S (R divided by S) will be a
relation T with schema T(A, B).
(b) In SQL, attributes declared UNIQUE cannot have NULL values.
(c) In SQL, a relation may have multiple foreign keys.
(d) In SQL, "DELETE FROM XYZ" will delete only tuples from table XYZ, but not
its schema.

Data for the next three questions, consider the following three schemas:
Books: bid INTEGER,
title TEXT,
library REFERENCES Library,
genre TEXT,
PRIMARY KEY (bid)
Library: lid INTEGER,
lname TEXT,
PRIMARY KEY (lid)
Checkouts: book INTEGER REFERENCES Books,
day DATETIME,
PRIMARY KEY (book, date)
For each of the following questions, select all the statements that result in the correct
output.

ADVANCED DATABASE MANAGEMENT SYSTEM - 202313


Q32. [MSQ]
Which of the following query(s) return the distinct combination of bid and genre
of each book that has ever been checked out?
(a) SELECT b.bid, b.genre
FROM Books b, Checkouts c
WHERE b.bid = c.book
(b) SELECT b.bid, b.genre
FROM Books b, Checkouts c
WHERE b.library = c.library
(c) SELECT DISTINCT b.bid, b.genre
FROM Books b, Checkouts c
WHERE b.bid = c.book
(d) None of the above

Q33. [MSQ]
Which of the following query(s) find all of the fantasy book titles that have been
checked out and the date when they were checked out? If a book hasn‟t been
checked out, the output should read (title, NULL).
(a) SELECT title, day
FROM Books b LEFT OUTER JOIN Checkouts c
ON c.book = b.bid
WHERE b.genre = 'Fantasy';
(b) SELECT title, day
FROM Books b RIGHT OUTER JOIN Checkouts c
ON c.book = b.bid
WHERE b.genre = 'Fantasy';
(c) SELECT title, day
FROM Checkouts c RIGHT OUTER JOIN Books b
ON c.book = b.bid
WHERE b.genre = 'Fantasy';
(d) None of the above
Q34. [MSQ]
Consider the following two schemas:
Library(Lid, Lname, Lplace) and Book(Bid, Bname, Library)
Which of the following query(s) select the name of all of the pairs of libraries that
have books with matching titles? Include the name of both libraries and the title
of the book. There should be no duplicate rows, and no two rows that are the
same except the libraries are in opposite order (e.g. („East‟, „West‟, „Of Mice and
Men‟) and („West‟, „East‟, „Of Mice and Men‟)). To ensure this, the first library
name should be alphabetically less than the second library name.

ADVANCED DATABASE MANAGEMENT SYSTEM - 202314


(a) SELECT DISTINCT l.lname, l.lname, b.title
FROM Library l, Books b
WHERE l.lname = b.library
AND b.library = l.lid
ORDER BY l.lname;
(b) SELECT DISTINCT l1.lname, l2.lname, b1.title
FROM Library l1, Library l2, Books b1, Books b2
WHERE l1.lname < l2.lname AND b1.title = b2.title
AND b1.library = l1.lid AND b2.library = l2.lid
(c) SELECT DISTINCT first.l1, second.l2, b1;
FROM
(SELECT lname l1, title b1
FROM Library l, Books b
WHERE b.library = l.lid) as first,
(SELECT lname l2, title b2
FROM Library l, Books b
WHERE b.library = l.lid) as second
WHERE first.l1 < second.l2
AND first.b1 = second.b2;
(d) None of the above
Q35. [MSQ]
Which of the following query(s) selects the name of the book that has been
checked out the most times and the corresponding checked out count? You can
assume that each book was checked out a unique number of times.
(a) SELECT title, count(*) AS cnt
FROM Books b, Checkouts c
WHERE b.bid = c.book AND NOT EXISTS
(SELECT count(*) AS cnt2
FROM Books b, Checkouts c
WHERE b.bid = c.book AND count(*) >cnt);
(b) SELECT title, count(*) AS cnt
FROM Books b, Checkouts c
WHERE b.bid = c.book
GROUP BY b.title
HAVING COUNT(*) >= ALL
(SELECT count(*) FROM Books b2, Checkouts c2
WHERE b2.bid = c2.book
GROUP BY b2.title);
(c) SELECT title, count(*) as cnt
FROM Books b, Checkouts c
WHERE b.bid = c.book
GROUP BY b.title
ORDER BY cnt DESC
LIMIT 1;
(d) None of the above

ADVANCED DATABASE MANAGEMENT SYSTEM - 202315


Q36. What isthe English-language meaningof thefollowingrelational algebraquery?
ΠCS.segmentNo, distance, description (courseName='NeylandDr' RaceCourse⋈CourseSegment)
(a) Print information about each course segment on the Neyland Dr. race course.
(b) Print information about each course segment named Neyland Dr.
(c) Print information about each course segment whose start or finish line is on
Neyland Dr.
(d) Print information about each course segment that has been part of a race
named “NeylandDr”.
Q37. What is the English-language meaning of the following relational algebra query?
ΠProfessor.name((σcourseNo='ECE351'Section) ⋈ Professor ⋈ (σbuilding='Min Kao'Room))
(a) List all professors who are both teaching sections of ECE351 and who have
offices in Min Kao.
(b) List all professors who are either teaching sections of ECE351 or whose office
is in Min Kao.
(c) List all professors who are teaching sections of ECE351 in Min Kao
(d) List professors whose only set of classes are ECE351 sections in Min Kao (i.e.,
to appear on this list they must not teach any courses other than ECE 351
and they must not teach in any other building)
Q38. Consider the following relational calculus query:
{t|t∈ R ∧ t[A] = 5 ∧∃x (x ∈ S ∧ (t[B] = x[D] ∨ t[C] = x[D]))}
on relations schemas R(A, B, C) and S(D, E). Which one of the following
relational algebra queries is equivalent to above calculus query?
(a) ΠA,B,C((σA=5∧ (B=D∨C=D) R × S))
(b) ΠA,B,C((σA=5∧ B=D R × S) ∪ (σA=5∧ C =D R × S))
(c) ΠA,B,C((σA=5 (R) ⋈B=D S) ∩ (σA=5(R) ⋈ C=D S))
(d) ΠA,B,C((σA=5 (R) ⋈B=D S) − (σA=5(R) ⋈ C=D S))
Data for the next two questions, consider the following relational schemas:
Suppliers(supplier_id, supplier_name, address)
Parts(part_id, part_name, color)
Catalog(supplier_id, part_id, cost)
Catalog.supplier_id refers to Suppliers.supplier_id and Catalog.part_id refers to
Part.part_id. Answer the following two questions.
Q39. [MSQ]
Which of the following query(s) can find the supplier_id‟s of the suppliers who
supply some „red‟ or „green‟ part?
(a) Πsupplier_id (catalog ⋈Πpart_id (σcolor = „red‟ ∧ color = „green‟ (parts)))
(b) {t | ∃c ∈ catalog (∃p ∈ parts ((p[color] = „red‟ ∧ p[color] = „green‟)
∧ c[part_id] = p[part_id]) ∧ t[supplier_id] = c[supplier_id])}
(c) {<s> | ∃p, c, c1 (<s, p, c>∈ catalog ∧<p, n, c1>∈ parts
∧ cl = „red‟ ∨ cl = „green‟)}
(d) None of the above

ADVANCED DATABASE MANAGEMENT SYSTEM - 202316


Q40. [MSQ]
Which of the following query(s) can find the part_id‟s of all parts that are
supplied by at least two suppliers?
(a) Πpart_id (σcatalog.part_id = c2.part_id ∨catalog.supplier_id<> c2.supplier_id (catalog × ρc2(catalog)))
(b) {t | ∃ c ∈ catalog (∃ c1 ∈ catalog (c[part_id] = c1[part_id]
∧ c[supplier_id] <> c1[supplier_id]) ∧ t[part_id] = c[part_id])}
(c) {<p> | ∃s, c, s1, c1 (<s, p, c>∈ catalog ∧<s1, p, c1>∈ catalog ∧ s <> s1)}
(d) None of the above
Data for the next two questions, consider the following relational schemas:
Person(SSN, name, address)
Car(license, year, model)
Accident(license, accident_date, driver, damage_amount)
Owns(SSN, license)
Primary keys are underlined. Note that the driver involved in a car accident may not
always be the owner of the car. Assume that accident_date is of type integer, and
represents a year (e.g. 1980). Year is also of type integer. We assume that a car cannot
get involved in more than one accident at a certain date.
Q41. [MSQ]
Which of the following query(s) can find the SSN of all persons who have had all
of their cars involved in an accident?
(a) SELECT O.SSN
FROM Owns O, Accident A
WHERE O.license=A.license
EXCEPT
SELECT O.SSN
FROM Owns O
WHERE O.license NOT IN (SELECT A.license FROM Accident A)
(b) ΠSSN, license(Owns ⋈ Accident) † Πlicense(Accident)
(c) {O | ∃O1∈ Owns(O1.SSN = O.SSN∧ ∀O2∈Owns(O1.SSN = O2.SSN⇒
∃A∈ Accident(O2.license = A.license)))}
(d) None of the above
Q42. [MSQ]
Which of the following query(s) can find the SSN of every person who owns one
or more cars, none of which has ever been involved in a car accident?
(a) SELECT O.SSN
FROM Owns O
WHERE O.license NOT IN (SELECT A.license FROM Accident A)
(b) ΠSSN(Owns) − ΠSSN(Owns ⋈ Accident)
(c) {O | ∃O1∈ Owns(O.SSN = O1.SSN∧ ¬∃A∈ Accident(O1.license = A.license))}
(d) None of the above

ADVANCED DATABASE MANAGEMENT SYSTEM - 202317


Q43. Consider the following relational schemas:
AutoWorkshop (WorkshopName, Address, Director)
Repair (WorkshopName, ReceiptNumber, AutoLicense, Type, Date, Cost)
Auto (AutoLicense, Owner)
Assume that Repair.AutoLicense is FK refers to Auto.AutoLicense and
Repair.WorkshopNameis FK refers to AutoWorkshop.WorkshopName
Which of the following statement(s) about the above relational schema is/are
correct?
(a) The same Auto can be repaired multiple times by the same AutoWorkshop in
the same day
(b) Two Auto Workshops can perform a repair having the same ReceiptNumber.
(c) Two identical Repairs performed by the same AutoWorkshop must have the
same cost.
(d) The Director of an AutoWorkshop cannot be the owner of an Auto repaired in
his/her own AutoWorkshop.
Normalization
Q44. [MSQ]
Consider the following table

Which of the following functional dependencies that are consistent with the
above table?
(a) A →D
(b) AB → D
(c) A → CD
(d) ABC → D
Q45. Consider the following table T:

and the set of functional dependencies F:


F = {A → B, C →B, D → ABC, AC → D}
Which of the following records can be added into table T without violating any of
functionaldependencies in F?
(a) (a5, b6, c7, d8)
(b) (a2, b2, c1, d8)
(c) (a3, b1, c4, d3)
(d) (a1, b1, c2, d5)

ADVANCED DATABASE MANAGEMENT SYSTEM - 202318


Q46. Consider a table T(A, B, C), namely, the table's name is T, and its attributes are
A, B, and C. It has 2 candidate keys: {A, B} and {B, C}. Which of the following
pairs of tuples co-exist in T, respectively?
(a) (a1, b1, c1) and (a1, b2, c2).
(b) (a1, b1, c1) and (a1, b2, c1).
(c) (a1, b1, c1) and (a2, b1, c1).
(d) (a1, b2, c1) and (a2, b2, c1)
Q47. Below is a relation about pets and owners.

Which functional dependencies is/are not obeyed?


(a) Pet → Species
(b) Species → Owner Phone
(c) Phone → Owner Phone
(d) Species → Pet
Q48. Consider the following relations:

The number of non-trivial multivalued dependencies that satisfied by the above


relation is___________
Q49. Consider the following table, which stores the details for different beds, one row
per bed model. The bed id is a primary key:

What can you say about this table?


(a) It is not even in 1NF
(b) It is in 1NF not in 2NF
(c) It is in 2NF not in 3NF
(d) It is in 3NF

ADVANCED DATABASE MANAGEMENT SYSTEM - 202319


Q50. [MSQ]
Consider a decomposition of tables as R1(A,B,D,E) and R2(A,B,C,F) based on the
attribute set R = ABCDEF and the functional dependency set F = {C → D, A → B,
B → EF, F → A}. Right now, this is not a lossless decomposition. Which of the
following changes (applied individually, not combined together) would make this
a lossless decomposition?
(a) Adding D → ABCDEF to the functional dependency set F
(b) Adding E → C to the functional dependency set F
(c) Adding B → D to the functional dependency set F
(d) Adding A → D to the functional dependency set F
Q51. Consider the following two statements:
S1: For all sets of functional dependencies F and G, F+∪ G+ = (F ∪ G)+.
S2: For all sets of functional dependencies F and G, F+∩ G+ = (F ∩ G)+
Which of the above statement(s) is/are TRUE?
(a) S1 only
(b) S2 only
(c) Both S1 and S2
(d) Neither S1 nor S2.
Q52. [MSQ]
Consider the relation R(T, U, V, W, X, Y) with the following set F of functional
dependencies: {T → UV, TV →WX, UX → Y }.
Which of the following statements is/are TRUE?
(a) The F+ contains T → XY.
(b) The candidate key of relation R is TV
(c) The super key of relation R is T
(d) The R is in BCNF
Q53. [MSQ]
Consider the relation R(T, U, V, W, X, Y) with the following set F of functional
dependencies: {T → UV, TV → WX, UX → Y }.
Which of the following is/are lossless-join decompositions of R into BCNF?
(a) R1(T,V,W) and R2(U,X,Y)
(b) R1(T,U) and R2(U,V,W,X,Y)
(c) R1(T,U,V,W,X) and R2(U,X,Y)
(d) R1(T,U,V,W,X) and R2(T,U,X,Y)
Q54. Consider the relation R(A, B, C, D, E, F) with the following set F of functional
dependencies: {AD → B, A → E, C → E, DEF → A, F → D}.
Which of the following statements is/are TRUE?
(a) The number of super keys in relation R is 16
(b) The R is in 3NF
(c) The BCNF decomposition of R is ABD, ADEF, DF, CE and CF
(d) The number of FDs in the canonical cover of R is 4.

ADVANCED DATABASE MANAGEMENT SYSTEM - 202320


Q55. Consider the relation R(A, B, C, D, E, F) with the following set F of functional
dependencies: {B → D, E → F, D → E, D → B, F → BD}. Which of the following
statement(s) is/are TRUE?
(a) The R is in 3NF.
(b) The decomposition R1(ABDE) and R2(BCDF) of R is lossless
(c) If we add FD B → C into F, then decomposition R1(ABDE) and R2(BCDF) of R
become lossless
(d) If we add FD B → A into F, then decomposition R1(ABDE) and R2(BCDF) of R
become lossless

Q56. [MSQ]
Consider the relation R(A, B, C, D, E) with the following set F of functional
dependencies: {A→B, A→C, B→C, C→A, D→E, E→D}.
Which of the following statements is/are TRUE?
(a) The number of candidate key in relation R is 5
(b) The canonical cover of F is {A→B, B→C, C→A, D→E, E→D}
(c) R is in BCNF
(d) R is in 3NF

Q57. Consider the relation R(A, B, C, D, E) with the following set F of functional
dependencies: {A→B, A→C, B→C, C→A, D→E, E→D}.
Which of the following statements is/are TRUE?
(a) The decomposition R1(A,B,C), R2(C,D) and R3(D,E) of R is dependency
preserving
(b) The decomposition R1(A,B) and R2(B,C,D,E) of R is dependency preserving
(c) The decomposition R1(A,B,C,D) and R2(D,E) of R is dependency preserving
(d) None of the above

Q58. Consider the relation R(A, B, C, D, E) with the following set F of functional
dependencies: {A→B, A→C, B→C, C→A, D→E, E→D}.
Which of the following statements is/are TRUE?
(a) The decomposition R1(A,B,C), R2(C,D) and R3(D,E) of R is lossless
(b) The decomposition R1(A,B) and R2(B,C,D,E) of R is lossless
(c) The decomposition R1(A,B,C,D) and R2(D,E) of R is lossless
(d) None of the above

Data for the next three questions,suppose you are given the following relation named

ADVANCED DATABASE MANAGEMENT SYSTEM - 202321


exam:

 The Date, TimeFrom, and Duration attributes give the dates and times on which an
exam is being administered.
 The AnswersDate and AnswersTime attributes give the date and time on which the
exam's solutions will be released.
 The other attributes should be self-explanatory
Assume that the table has the following functional dependencies:
 ExamId, Section → Date
 ExamId → Duration, AnswersDate, AnswersTime
 Section → RoomId, TimeFrom
 RoomId → RoomNo
You may not assume that any other functional dependencies exist. Answer the following
questions about this relation.
Q59. [MSQ]
This table is susceptible to various types of anomalies. Which of the
following anomalies that apply?
(a) You cannot insert a new exam unless you have a section that is taking the
exam
(b) If you insert a section of an exam, you must simultaneously insert all sections
of the exam or you will have an inconsistency
(c) You cannot insert an exam unless you have an answers date and an answers
time
(d) If you change the room for a certain section, you must change every instance
of the section's room in the relation or you will have an inconsistency
Q60. This table is susceptible to various types of anomalies. Which of the
following anomalies that apply?
(a) If you change an exam's answers date and answers time, you must change all
instances of the exam's answers date and answers time in the relation or you
will have an inconsistency
(b) If you change a section's id, you must change its room and timeFrom
attributes.
(c) If you delete the last tuple containing a section, you lose information about
the section
(d) If you delete one section of an exam, you must delete all sections of the exam
or you will have an inconsistency
Q61. [MSQ]

ADVANCED DATABASE MANAGEMENT SYSTEM - 202322


Assume that the primary key for this relation is (ExamId, Section). What
functional dependency(s) would you use to convert this relation from 1st to 2nd
normal form?
(a) ExamId, Section → Date
(b) ExamId → Duration, AnswersDate, AnswersTime
(c) Section → RoomId, TimeFrom
(d) RoomId → RoomNo
Q62. [MSQ]
Assume that the primary key for this relation is (ExamId, Section). What
functional dependency(s) would you use to convert this relation from 2nd normal
form to 3rd normal form?
(a) ExamId, Section → Date
(b) ExamId → Duration, AnswersDate, AnswersTime
(c) Section → RoomId, TimeFrom
(d) RoomId → RoomNo

Q63. [MSQ]
Consider the relation R(A, B, C, D, E) with the following set F of functional
dependencies: {AE→BC, AC→D, CD→BE, D→E}.
Which of the following statements is/are TRUE?
(a) The only candidate key of relation R areAE, AC and AD
(b) The canonical cover (Fc) is same as F
(c) The closure of F (i.e., F+) contains CD → AE
(d) The highest normal form satisfied by R is 2NF
Q64. [MSQ]
Consider the relation R(ABCDEFG) with the following set F of functional
dependencies: {AD → F, AE → G, DF → BC, E → C, G → E}. R is decomposed in
the three relations: R1(ADF), R2(EC) and R3(ABDEG). Which of the following
is/are TRUE about the decomposition?
(a) This decomposition is in BCNF
(b) This decomposition is in 3NF
(c) This decomposition is dependency preserving
(d) This decomposition is lossless
Q65. Consider the relation R(ABCDEFG) with the following set F of functional
dependencies: {AD → F, AE → G, DF → BC, E → C, G → E}. R is decomposed in
the four relations: R1(ADF), R2(EC), R3(EF) and R4(ABDG). Which of the following
is/are TRUE about the decomposition?
(a) This decomposition is in BCNF
(b) This decomposition is in 3NF
(c) This decomposition is dependency preserving
(d) This decomposition is lossless
Q66. Consider the relation R(P, Q, S, T, U, V) with the following set F of functional

ADVANCED DATABASE MANAGEMENT SYSTEM - 202323


dependencies: {PQ → S, PS → Q, PT → U, Q →T, QS → P, U → V}. Which of the
following statements is/are TRUE?
(a) Given FD set is a minimum cover.
(b) The decomposition {PQ, QS, PQTU, UV} lossless.
(c) The decomposition {PQ, QS, PQTU, UV} is not dependency preserving.
(d) The decomposition {PQS, PSTU, PTV} is dependency-preserving.

Q67. Consider the relation R(P, Q, S, T, U, V) with the following set F of functional
dependencies: {Q → ST, P → T, PS → T, QU → V}. Which of the following
statements is/are TRUE?
(a) The attribute closure {P}+ is {P,S,T}.
(b) The attribute closure {PQ}+ is {P,T,Q,S}.
(c) The dependency Q → S can be deduced from FDs.
(d) The only candidate keys of R are P and Q.

Q68. Consider the Instance of relation R below with the following MVDs:
{U}↠{W,Y}
{V}↠{X,Z}

What value should be present in place of X1, X2, X3, X4, X5?
(a) X1=1, X2=2, X3=0, X4=3, X5=5
(b) X1=5, X2=1, X3=0, X4=3, X5=5
(c) X1=5, X2=4, X3=0, X4=3, X5=6
(d) X1=5, X2=1, X3=0, X4=4, X5=6
Q69. A functional dependency (Y → X), between X and Y specifies a constraint on the
possible tuples that can form a relation instance r of R. The constraint states
that for any two tuples t1 and t2 in r such that
(a) t1[X] = t2[Y], then t1[Y] = t2[X]
(b) t1[Y] = t2[Y], then t1[X] = t2[X]
(c) t1[X] = t2[Y], then t1[X] = t2[Y]
(d) t1[X] = t2[X], then t1[Y] = t2[Y]
Q70. Consider the following two FD sets
F: {CD → AB, C → D, D → EH, AE → C, A → C, B → D}.
G: {B → D, CD → AE, CD →BE, D → EH, A → C, C → B}.
Which of the following relationships hold between two FD sets?
(a) F G (b) G F (c) F ≡ G (d) F ≠ G
Q71. Which of the following is/are TRUE?

ADVANCED DATABASE MANAGEMENT SYSTEM - 202324


(a) Every relation that‟s in BCNF is also in 3NF.
(b) Relations in 1NF only have atomic values in record fields.
(c)Decomposition of a 3NF relation into BCNF preserves functional dependencies.
(d) Decomposition of a 3NF relation into BCNF preserves lossless join

Data for the next two questions,consider a relation R with 2d attributes (d is an


integer ≥ 2) that are named A1, A2,..., A2d. There is a set F of 2d FDs on R: Ai → A1+(i+1)mod
2d, for i = 1 . . . 2d. For example, suppose d = 2, the attributes are A1, A2, A3, A4 and F =
{A1 → A3, A3 → A1, A2 → A4, A4 → A2}.
Q72. Suppose d> 2, What is the number of keys in R?
(a) d (b) d + 2 (c) 2d (d) d2
Q73. Suppose d = 2, which of the following is/are the lossless-join and dependency
preserving decomposition(s) of R to BCNF using the algorithm?
(a) R1(A1A3), R2(A2A4) and R3(A1A2)
(b) R1(A1A3) and R2(A2A4)
(c) R1(A1A2), R2(A3A4)
(d) R1(A1A2), R2(A3A4) and R3(A2A4)

Q74. In any possible lossless-join and dependency-preserving decomposition of R to


BCNF, what is the number of relations with no non-trivial FDs in the projection
of F+ on to it?
(a) 1 (b) 2 (c) 3 (d) d

Data for the next two questions,consider a relation university course:

Q75. Which of the following true MVDs is/are exist in this table?
(a) Course↠Book
(b) Course↠Lecturer
(c) Book↠Course
(d) Book↠Lecturer
Q76. If we add a book „Korth‟ to the course „AHA‟, then how many more tuple need to
be added in order to maintain multivalued dependency? _________

ADVANCED DATABASE MANAGEMENT SYSTEM - 202325


Q77. We say that a set of attributes X is closed (with respect to a given set of FDs) if
the closure of X is X itself. Consider a relation R (A, B, C, D) and an unknown set
of FDs. If we are told that all the sets of four Attributes are closed, what can you
conclude from this case?
(a) R is in 2 NF, but not in 3NF
(b) R is in 3 NF, but not in BCNF
(c) R is in BCNF
(d) No conclusion can be drawn.

Q78. Consider a relation CallCenter(OnCall, CallDuration, TargetSale, CustomerID).


Which set of functional dependency all CallCenter to be in 2NF but not in 3NF?
(a) CallDuration, TargetSale → OnCall
CustomerID → CallDuration
(b) CallDuration, → OnCall
CustomerID, TargetSale → CallDuration
(c) CallDuration, → OnCall, TargetSale, CustomerID
CustomerID → CallDuration
(d) CallDuration, → OnCall, CustomerID
CustomerID, OnCall → CallDuration, TargetSale,
Indexing
Q79. Which of the following statement is/are TRUE?
(a) Every unclustered index is dense.
(b) A clustered index may be either sparse or dense.
(c) Every B+tree Index is sparse.
(d) The second and higher levels of a multiple level index may either be sparse or
dense.

Q80. Consider a B+tree index with n = 50, in which n is the maximum number of keys
fitting in a block. Let the B+tree index be dense over 100,000 records. What is
the number of nodes in the tree that we need to examine when searching for a
record? ____________

Q81. Which one of the following cannot happen as a result of one record being
inserted in a B+ tree?
(a) The tree height does not change.
(b) The tree height increases by one.
(c) The same key is inserted in both the root node and a leaf node.
(d) The same key is inserted in both the root node and an interior node.

Q82. Consider the following B+tree with order n = 3.

ADVANCED DATABASE MANAGEMENT SYSTEM - 202326


After deleting key 25, which of the following statements is/are TRUE?
(a) The B+tree has six leaves, each of which contains at least 2 keys.
(b) The B+tree has two interior nodes, one of which contains 3 key and one
contains 1 key.
(c) The B+tree has one root node with 2 keys.
(d) The B+tree has one root node with 1 key.

Q83. Consider the following B+tree with order n = 3.

The order of a leaf node n in a B+-tree is the maximum number of data record
pointers it can hold and the order of a non-leaf noden in a B+-tree is the
maximum number of block pointer it can hold. How many keys we can insert
more in the above B+tree without increasing the height of the tree? ____________

Q84. Consider the relation schema Customers (CustomerID, Name, Age, Zipcode,
SSN) with primary key CustomerID and alternate key SSN. Which of the
following indexes is not a unique index?
(a) Clustered B+ tree index on (SSN, Name)
(b) Clustered B+tree index on (Age, CustomerID)
(c) Unclustered B+tree index on (Name, Age, SSN)
(d) Unclustered B+tree index on (Name, Age)

Data for the next four questions, consider a relation R(A, B, C, D, E) containing
10,000,000 records, where each data page of the relation holds 10 records. R is

ADVANCED DATABASE MANAGEMENT SYSTEM - 202327


organized is a clustered, sorted file with secondary indexes. Assume that R.A is a
candidate key for R, with values lying in the range 1 to 10,000,000, and that R is stored
in order according to R.A. Answer the following questions.
Q85. For the relational algebra query "A=500,000(R)", which of the following approach(es)
is/are most likely to be the cheapest (i.e., cost effective)?
(a) Access the sorted file for R directly.
(b) Use a (clustered) B+ tree index on attribute R.A.
(c) Use a hash index on attribute R.A.
(d) None of the above
Q86. For the relational algebra query "A<20,000(R)", which of the following approach(es)
is/are most likely to be the cheapest (i.e., cost effective)?
(a) Access the sorted file for R directly.
(b) Use a (clustered) B+ tree index on attribute R.A.
(c) Use a hash index on attribute R.A.
(d) None of the above

Q87. For the relational algebra query "A>20,000∧ A<25,000(R)", which of the following
approach(es) is/are most likely to be the cheapest (i.e., cost effective)?
(a) Access the sorted file for R directly.
(b) Use a (clustered) B+ tree index on attribute R.A.
(c) Use a hash index on attribute R.A.
(d) None of the above

Q88. For the relational algebra query "A≠500,000(R)", which of the following approach(es)
is/are most likely to be the cheapest (i.e., cost effective)?
(a) Access the sorted file for R directly.
(b) Use a (clustered) B+ tree index on attribute R.A.
(c) Use a hash index on attribute R.A.
(d) None of the above

Data for the next four questions, consider an indexed sequential file consisting of
10,000 blocks. Each block contains 10 fixed sized records. Each key value found in the
file is unique. For this problem, assume that:
 Pointers to blocks are 10 bytes long.
 Pointers to records are 20 bytes long.
 Index blocks are 5000 bytes (in addition to the header).
 Search keys for file records are 10 bytes long.
 File is sorted on the key field and the unspanned organization is used.
Answer the following questions.
Q89. How many blocks do we need to hold a sparse one-level, primary index?
_________

ADVANCED DATABASE MANAGEMENT SYSTEM - 202328


Q90. How many disks I/Os do we need to find and retrieve a record with a given key
at the worst case in a sparse one-level, primary index?

Q91. Suppose you now construct a one-level, dense secondary index. How many
blocks do we need to hold? _________

Q92. If the secondary index is built on the key field of the file, and a multi-level index
scheme is used to store the secondary index, the number total number blocks in
the multi-level index is __________________
Q93. Consider the B+tree with order n = 9, and the level of the index h = 4. What is
the maximum number of records indexes by the B+tree? Assume that root is at
level 0.
(a) 93 × 8 (b)94 × 8 (c)104 × 9 (d)103 × 9

Q94. Consider the B+tree with order n = 9, and the level of the index h = 4. What is
the minimum number of records indexes by the B+tree? Assume that root is at
level 0.
(a) 2 × 53 × 4 (b)2 × 44 × 3 (c)2 × 54 × 4 (d)2 × 43 × 3

Q95. [MSQ]
Assume that all searches are performed on thesame key that the sorted file is
sorted by. Which of the following statements is/are TRUE?
(a) Scanning all the records in a heap file is strictly faster than scanning all the
records in a sortedfile.
(b) Suppose we know there is exactly 1 match, because the search key is the
primary key of table.An equality search on a sorted file is always faster than
an equality search on a heap file.
(c) Assuming the number of records with the same value for the search key is
small, a range searchon a sorted file is typically faster than the same search
on a heap file.
(d) An insertion into a sorted file is typically faster than an insertion into a heap
file.
Q96. Assume that order d of B+tree is the minimum number of keys a node can have.
Which of the following statement is/are TRUE?
(a) The maximum fanout of a B+ tree is equal to 2d where d is its order.
(b) When an insertion into a B+ tree causes a node to split, the height of the tree
always increases.
(c) As the number of keys in a B+ tree increases, IO cost for searches grows
logarithmically with the number of keys.
(d) Clustered and unclustered B+ trees provide the same performance benefits
for all queries.
Q97. For the B+ trees below, which of the following trees is/are valid B+tree? Assume
that there were no deletes. Note, we follow the right branch when the split key

ADVANCED DATABASE MANAGEMENT SYSTEM - 202329


equals the search key.
(a)

(b)

(c)

(d)

Q98. Suppose we have an initially empty, order d=1 B+ tree, and the following set of
keys:
3, 9, 8, 7, 2, 1, 5, 10, 12
Assume that order d of B+tree is the minimum number of keys a node can have.
Which of the following is/are possible B+ trees after inserting all of the above
elements in some order? Again, we follow the right branch when the split key
equals the search key. When splitting a node with an odd number of keys,
assume the new right node receives one more key than the original left node.
(a)

(b)

(c)

(d) None of the above.


Q99. Consider the following B+tree:

ADVANCED DATABASE MANAGEMENT SYSTEM - 202330


What is the minimum number of keys that we can insert to change the height of
the tree? ___________
Q100. The order of a leaf node n in a B+-tree is the maximum number of data record
pointers it can hold and the order of a non-leaf nodem in a B+-tree is the
maximum number of block pointer it can hold. Given that the block size is 4000
bytes, data record pointer is 10 bytes long, the key field is 10 bytes long and a
block pointer is 8 bytes long, what is the value of n + m? __________
Q101. Assume that blocks can hold either 10 records or 99 keys and 100 pointers. Also
assume that the average B+ tree node is 70% full i.e., it will have 69 keys and 70
pointers. If database contains 1,000,000 records. Find the average number of
disk accesses to search a record given its search key and the B+ tree is used as
secondary index. __________
Q102. Assume that our table only contains information about undergraduates at DAVV
university, and we would like to eliminate duplicate students using hashing in
the Enrolled table:
Enrolled (firstname, lastname, address, sid, gender, year_of_birth)
We consider a hash function with less collisions (different records ending up in
the same bucket) to be “better”. Consider the following four function:
1. h(record) = record.year of birth % 10
2. h(record) = record.sid % 10
3. h(record) = to int(record.gender) % 10
4. h(record) = to int(record.firstname[0]) % 10
Arrange the above hash functions from best to worst for accomplishing this task.
(a) 2 → 4 → 1 → 3 (b)2 → 3 → 1 → 4
(c) 2 → 4 → 3 → 1 (d)4 → 2 → 1 → 3
Data for the next two questions, suppose that the keys A through H have the
following hash values:
Key A B C D E F G H I
hash value 5 6 0 8 5 6 7 8 9
Now suppose that the following table results from inserting these keys into an initially
empty table using hashing with linear probing.

Q103. Which of the following key could be the first key inserted?

(a) A (b) B (c) C (d) D


Q104. Which of the following key must have been last key inserted?

(a) A (b) B (c) C (d) D


Q105. Assuming inputs are all 3-digit numbers and d0 is the digit in the rightmost

ADVANCED DATABASE MANAGEMENT SYSTEM - 202331


position. (e.g., the three-digit number 456 has these digits: d2=4, d1=5, d0=6),
you are given 3 possible hash functions:
h1(x) = (d2 + d1 + d0) mod 10
h2(x) = (d2 + d1) mod 10
h3(x) = (d2)mod 10
For a table of size 10 and the following 6 inputs: 160, 610, 345, 254, 532 and
449, rank the 3 hash functions in order from best (least collisions) to worst
(most collisions) assuming linear probing is used to handle collision.
(a) h1, h2, h3 (b)h3, h1, h2 (c)h3, h2, h1 (d)h2, h1, h3

Q106. Consider a open addressing with quadratic probing scheme in which the hash
function is h(k) = k mod 10. Assume that the table size is 10 and the following
key are presented in the hash table:
Index 0 1 2 3 4 5 6 7 8 9
key 0 10 20 24 14 9
Then the address returned by probe 3 in the probe sequence (assume that the
probe sequence begins at probe 0) for key value k = 4 is __________ .

Q107. Consider a double hashing scheme in which the primary hash function is h1(k) =
k mod 23, and the secondary hash function is h2(k) = 1+(k mod 19). Assume
that the table size is 23. Then the address returned by probe 2 in the probe
sequence (assume that the probe sequence begins at probe 0) for key value k =
50 is ________ .

Q108. In an extensible hash indexing scheme with global depth d, what is the
minimum number of keys stored in a bucket with a local depth of l?
(a)2l (b)1 (c) 2l-d (d) 2d-1

Q109. In an extensible hash indexing scheme with global depth d, what is the
maximum number of bucket array elements pointing to a bucket with a local
depth of l?
(a)2l (b)1 (c) 2l-d (d) 2d-1
Q110. Consider the following extendible hash with 4slots per bucket.

What is the global depth after the following sequence of operations finish
successfully: insert 44 and insert 67?
(a)1 (b) 2 (c)3 (d) 4
Q111. Your company asks you to design a hashing mechanism to index old archive

ADVANCED DATABASE MANAGEMENT SYSTEM - 202332


data.You know that you will not performing insertion or deletions on the data,
but will be querying itfor equality searches on the search key. Which hashing
method is most appropriate?
(a) Static (b)Extendible
(c)Linear (d)All are equally good
Q112. Consider the Extendible Hashing structure below.

What is the maximum number ofkeys can you insert before the size of the
directory must double? _____________
Data for the next two questions, consider the join R ⋈R.a=S.b S, given the following
information about the relations to be joined. The cost metric is the minimum number of
page I/Os in the worst case, and the cost of writing out the result should be uniformly
ignored.
 Relation R contains 10,000 tuples and has 10 tuples per page.
 Relation S contains 2,000 tuples and also has 10 tuples per page.
 Attribute S.b is the primary key for S.
 Both relations are stored as simple heap files, and neither relation has any indexes.
 52 buffer pages are available.
Q113. What is the cost of joining R and S using a nested loops join with the most
appropriate choice of table to be used in outer loop? _________
Q114. What is the cost of joining R and S using a block nested loops join with the most
appropriate choice of table to be used in outer loop? _________
Transaction
Q115. Consider the following schedule:
(a) The schedule is serializable
(b) The schedule is conflict serializable
(c) The schedule is view serializable
(d) The schedule is not serializable

Which of the following is/are TRUE?

ADVANCED DATABASE MANAGEMENT SYSTEM - 202333


Q116. [MSQ]
Which of the following statement(s) is/are FALSE?
(a) Two Phase Locking must be used, or we cannot guarantee conflict
serializability.
(b) Two Phase Locking ensures that we do not have cascading aborts.
(c) Strict Two-Phase Locking ensures that we do not have deadlocks.
(d) Strict Two-Phase Locking requires that transactions acquire locks only at the
start of the transaction, and release all locks only at the end of the transaction.
Q117. [MSQ]
Consider the following schedule of three transactions. Commit abbreviated “com”
Operation.

The schedule is
(a) Conflict serializable (b) Avoid-cascade abort
(c) Recoverable (d) Strict
Q118. Consider the following schedule of three transactions. Commit abbreviated “com”
Operation.

Consider the following two statements:


S1: This schedule of read and write operations could be generated by a system
following the regular 2PL (two phase locking) protocol.
S2: This schedule of read and write operations could be generated by a system
following the Strict 2PL protocol.
Which of the above statement is/are TRUE?
(a) S1 only (b) S2only
(c) Both S1 and S2 (d) Neither S1 nor S2
Q119. [MSQ]
Which of the following statement(s) is/are FALSE?
(a) SIX locks cannot be escalated. (Lock Escalation is the process of converting
many fine-grained locks such as row/page locks into table locks.)
(b) IX locks are compatible with X locks.
(c) All conflict serializable schedules guarantee no cascading aborts if they are
created using Strict 2PL.
(d) All conflict serializable schedules are also view serializable.

ADVANCED DATABASE MANAGEMENT SYSTEM - 202334


Data for the next two questions, consider the following schedule.

Q120. [MSQ]
Which of the following schedules below are conflict equivalent to the schedule
above?
(a) T3, T1, T2, T4
(b) (b)T2, T3, T1, T4
(c) T4, T3, T1, T2
(c) T3, T2, T1, T4

Q121. Consider the following two statements:


S1: This schedule of read and write operations could be generated by a system
following the regular 2PL (two phase locking) protocol.
S2: This schedule of read and write operations could be generated by a system
following the Strict 2PL protocol.
Which of the above statement is/are TRUE?
(a) S1 only
(b) S2only
(c) Both S1 and S2
(d) Neither S1 nor S2

Q122. [MSQ]
Which of the following statement(s) is/are FALSE?
(a) In Strict 2PL, we can give up locks after aborting but before rollback is
complete.
(b) Some conflict serializable schedules cannot be produced when using 2PL.
(c) Schedules that are conflict serializable will not produce a cyclic dependency
graph.
(d) Both Strict 2PL and 2PL enforce conflict serializability.

ADVANCED DATABASE MANAGEMENT SYSTEM - 202335


Q123. [MSQ]
Which of the following statement(s) is/are TRUE?
(a) If only the last two operations out of many in a committed transaction do not
take effect, it is a violation of the Atomicity principle.
(b) All conflict serializable are also serial schedules.
(c) Transaction A reads from relation W, and Transaction B reads from relation W
concurrently. They may possibly read any or all of W. This is considered a conflict.
(d) Transaction A writes to relation W, and Transaction B writes to relation W
concurrently. They may possibly write to any or all of W. This is considered a
conflict.
Data for the next two questions, consider the following transaction

Assume both A and B have a value of 100 before T1 begins.


Q124. Suppose the T1 successfully commits. What is the final value of A and B,
respectively?
(a) 400, 500 (b) 600, 400 (c) 500, 400 (d) 400, 600
Q125. [MSQ]
Suppose T1 starts and its execution is not atomic. Which of the following are
possible final states of A?
(a) 100 (b) 200 (c) 300 (d) 400
Q126. [MSQ]
Consider the following schedule, with A = 90 and B = 90 at the start.

Which of the following statement(s) is/are TRUE?


(a) The schedule is serializable.
(b) The schedule is view serializable.
(c) The schedule is not conflict serializable
(d) The schedule is not view serializable
Q127. [MSQ]
Which of the following statements is/are TRUE?
(a) Under two-phase locking, once a transaction releases a lock, it can no longer
acquire any new locks.
(b) Schedules that are conflict serializable have to be produced by two-phase
locking.
(c) Schedules produced by two-phase locking are guaranteed to prevent cascading
aborts.
(d) Strict two-phase locking is both necessary and sufficient to guarantee conflict
serializability.

ADVANCED DATABASE MANAGEMENT SYSTEM - 202336


Q128. [MSQ]
Which of the following statements is/are TRUE?
(a) Wound-wait and wait-die algorithms are pessimistic deadlock avoidance
algorithms and can cause more transaction aborts than needed.
(b) Under multigranularity locking, locks should be acquired and released from the
top level to the bottom level.
(c) Under multigranularity locking, when a transaction T1 is holding an „IX‟ lock on
page A, it is possible for transaction T2 to hold a „S‟ lock on record B of page A.
(d) None of the above
Q129. [MSQ]
Consider the following schedule for three transactions:

R indicates a read of a page, W indicates a write of a page, and COM indicates a


commit. Which of the following statement(s) is/are TRUE?
(a) The schedule is conflict serializable
(b) The schedule is cascade Less
(c) The schedule is recoverable
(d) The schedule is strict
Q130. [MSQ]
Consider the following schedule for three transactions:

R indicates a read of a page, W indicates a write of a page, and COM indicates a


commit. Which of the following changes (independently) to the above schedule will
result in a schedule that is possible using strict two-phase locking?
(a) Make T1 abort instead of commit
(b) Make T2 abort instead of commit
(c) Remove R(A) from T1 and T3
(d) Remove T2 from the schedule
Q131. [MSQ]
Consider the following schedule. A, B, and C are positive integers. Each
transaction reads in two integers, adds them, and writes the result.

Which of the following statements is/are true?


(a) The schedule avoids cascading aborts
(b) The schedule is recoverable
(c) The schedule is conflict serializable
(d) The schedule is equivalent to some serial schedule

ADVANCED DATABASE MANAGEMENT SYSTEM - 202337


Q132. [MSQ]
Locking is the most popular concurrency control technique implemented by
commercial databasemanagement systems.Consider a database that is read-only
(i.e., no transactions change any data in the database,data may be loaded into the
database when the database is off-line). Suppose serializabilityneeds to be
supported. Which of the following statement(s) is/are correct statements?
(a) No locking is necessary.
(b) Only read locks are necessary and they need to be held until end of
transaction.
(c) Only read locks are necessary but they can be released as soon as the read
iscomplete.
(d) Both read and write locks are necessary and locking must be done in two
phases.
Q133. Consider the following database schema: STUDENT(name, sid, gpa, level, dept)
Suppose the following two transactions are executed concurrently:
T1: begin tran
update STUDENT set gpa = 4.0 where dept = 'CS'
commit tran

T2: begin tran


insert into STUDENT values ('Anil', 101, 3.9, 4, 'CS')
insert into STUDENT values ('Sunil', 102, 3.9, 3, 'CS')
commit tran
Assume Anil and Sunil were not in the STUDENT table before the start of T1 or
T2. Suppose read locks are released immediately after the read is done and write
locks are held until end of transaction. Consider the following two statements:
S1: After both T1 and T2 have committed, Anil and Sunilcan have different gpa
values.
S2: After both T1 and T2 have committed, Anil and Sunil can have same gpa
values.
Which of the above is/are TRUE?
(a) S1 only (b) S2 only
(c) Both S1 and S2 (d) cannot say
Data for the next three questions,consider the following two transactions operating
over two distinct data objects A and B.
T1: R(A), W(B), R(A), W(A), Commit
T2: W(A), W(B), Commit
Q134. [MSQ]
Which of the following schedules has a WW conflict?
(a) R1(A), W2(A), W1(B), W2(B), R1(A), W1(A), Commit2, Commit1
(b) W2(A), R1(A), W2(B), W1(B), R1(A), Commit2, W1(A), Commit1
(c) R1(A), W1(B), W2(A), W2(B), R1(A), W1(A), Commit1, Commit2

ADVANCED DATABASE MANAGEMENT SYSTEM - 202338


(d) W2(A), R1(A), W1(B), W2(B), R1(A), Commit2, W1(A), Commit1
Q135. [MSQ]
Which of the following schedules does not have an unrepeatable read conflict?
(a) R1(A), W2(A), W1(B), W2(B), R1(A), W1(A), Commit2, Commit1
(b) W2(A), R1(A), W2(B), W1(B), R1(A), Commit2, W1(A), Commit1
(c) R1(A), W1(B), W2(A), W2(B), R1(A), W1(A), Commit1, Commit2
(d) None of the above has an unrepeatable read conflict!

Q136. [MSQ]
Suppose we use strict 2-phase locking for concurrency control. A transaction
acquires an appropriate lock on a data object at the time it first needs to access
that data object. Assume a transaction can only get one kind of lock on a data
object (exclusive or shared). Which of the following schedules will lead to a
deadlock?
(a) R1(A), W2(A), W1(B), W2(B), R1(A), W1(A), Commit2, Commit1
(b) W2(A), R1(A), W2(B), W1(B), R1(A), Commit2, W1(A), Commit1
(c) R1(A), W1(B), W2(A), W2(B), R1(A), W1(A), Commit1, Commit2
(d) W2(A), R1(A), W1(B), W2(B), R1(A), Commit2, W1(A), Commit1

Q137. [MSQ]
Assume that the four transactions successfully committed under a timestamp
ordering TO scheduler resulting in the following schedule:
w1(y);w3(x);r2(x);r2(y);w0(v);w2(z);w1(v);
Where ri(z) and wi(z) denote read and write operations respectively on a data item z
by a transaction Ti. Assume that Thomas write rule was applied. For which of the
following set of time stamps, transactions could have committed?
(a) TS(T0) < TS(T3) < TS(T1) < TS(T2)
(b) TS(T0) < TS(T1) < TS(T2) < TS(T3)
(c) TS(T3) < TS(T2) < TS(T0) < TS(T1)
(d) TS(T0) < TS(T1) < TS(T3) < TS(T2)
Q138. [MSQ]
Checkpoint is a technique that can reduce recovery time after a crash. Which of
the following statement(s) is/are correct statements?
(a) After a soft crash (which does not affect data on hard drives), the log only needs
to be scanned back until the last checkpoint is found. The log beyond the last
checkpoint will not be read during the recovery process.
(b) In a simple recovery model,once a checkpoint is done, the log can be
truncated.
(c) Checkpoint is automatically performed after every transaction commit.
(d) Checkpoints should be done after every update to the database.

ADVANCED DATABASE MANAGEMENT SYSTEM - 202339


Q139. [MSQ]
This question deals with when updated data pages (dirty pages) must be written to
disk. Which of the following statement(s) is/are correct statements?
(a) Updated pages must be written to disk immediately after the update.
(b) Dirty pages must be written to disk at transaction commit time but before the
transaction log is written to disk.
(c) Dirty pages must be written to disk at transaction commit time but after the
transaction log is written to disk.
(d) A dirty page must be written to disk when it is replaced from the buffer pool.

Q140. [MSQ]
Consider the following transaction log from the start of the run of a database
system that is capable of running undo/redo logging with check point:
1. <START T1>
2. <T1, A, 50, 25>
3. <T1, B, 250, 25>
4. <START T2>
5. <T1, A, 75, 50>
6. <T2, C, 55, 25>
7. <COMMIT T1>
8. <START T3>
9. <START CKPT (T2,T3)>
10. <T3, E, 65, 25>
11. <T2, D, 35, 25>
12. <T2, C, 45, 55>
13. <START T4>
14. <T4, F, 120, 25>
15. <T4, F, 150, 120>
16. <COMMIT T4>
Assume the log entries are in the format <Tid, Item, New_value, Old_value>. If the
database crashes immediately after writing the above log entries, which of the
following statements is/are TRUE?
(a) During recovery, the transaction T2 will be redone.
(b) During recovery, the transaction T1 will be ignored.
(c) During recovery, the transaction T4 will be redone.
(d) During recovery, the transaction T3 will be undone.

Data for the next two questions, consider a database with two elements, X and Y. The
initial values of X and Y are both 0. We consider three transactions T1, T2 and T3 that
modify these elements concurrently:
• T1: X= 42
• T2: Y= 20, X= 10
• T3: X= 100, Z= 101
While the transactions execute, the database system crashes.

ADVANCED DATABASE MANAGEMENT SYSTEM - 202340


Q141. [MSQ]
Consider the following log entries in the format <Tid, Data_item, New_value>:
1. < START T2 >
2. < START T3 >
3. < T2, X, 10 >
4. < T2, Y, 20 >
5. < COMMIT T2 >
6. < START CKPT(T3) >
7. < T3, X, 100 >
8. < START T1 >
9. < T3, Z, 101 >
10. < T1, X, 42 >
11. < COMMIT T3 >
12. < COMMIT T1 >
If the system uses immediate modification technique and the database crashes
immediately after writing the above log entries, then subsequently performs
recovery, which of the following statements is true?
(a) After a successful recovery, the state of X is 100.
(b) At the time of crash, the state of X (on disk) must be 42.
(c) At the time of crash, the state of Y (on disk) must be 20.
(d) After a successful recovery, the state of Z is 0.

Q142. [MSQ]
Consider the following log entries in the format <Tid, Item, Old_value, New_value>:
1. < START T1 >
2. < START T2 >
3. < START T3 >
4. < T3, X, 0, 100 >
5. < T3, Z, 0, 101 >
6. < COMMIT T3 >
7. < T2, X, 100, 10 >
8. < START CKPT(T1, T2) >
9. < T2, Y, 0, 20 >
10. < COMMIT T2 >
11. < T1, X, 10, 42 >
If the system uses deferred modification technique and the database crashes
immediately after writing the above log entries, then subsequently performs
recovery, which of the following statements is true?
(a) During recovery, the log entry in line 4 will be redone.
(b) During recovery, the log entry in line 7 will be ignored.
(c) During recovery, the log entry in line 9 will be ignored.
(d) During recovery, the log entry in line 11 will be undone

ADVANCED DATABASE MANAGEMENT SYSTEM - 202341


Q143. Consider the following log entries in the format <Tid, Data_Item, Old_value>:

If the system uses pure undo logging and the database crashes immediately after
writing the above log entries, then subsequently performs recovery, what is the
value of X at the end of the recovery? _____________
Q144. Consider the following log entries in the format <Tid, Data_item, New_value>:
< START T1 >
< T1, A, 10 >
< START T2 >
< T2, B, 5 >
< T1, C, 7 >
< START T3 >
< T3, D, 12 >
< COMMIT T1 >
< START CKPT (T2, T3) >
< START T4 >
< T2, E, 5 >
< COMMIT T2 >
< T3, F, 1 >
< T4, G, 15 >
< END CKPT >
< COMMIT T3 >
< START T5 >
< T5, H, 3 >
< START CKPT (T4, T5) >
< COMMIT T5 >
If the system uses pure redo logging and the database crashes immediately after
writing the above log entries, then subsequently performs recovery, which of the
following data elements are recovered by the redo recovery manager?
(a) B, D and E only (b) A, B, D and E only
(c) B, D, E and F only (d) B, D, E, F and H only
ER Model
Q145. Consider the following E/R diagram:

The key of A is attribute A, the key of B is B , the key of C is C, and the key of D is
D. If we translate relationship set R into a relation, what are all the keys of ?
(a) {A} (b) {B}, {C} and {D}

ADVANCED DATABASE MANAGEMENT SYSTEM - 202342


(c) {B, C, D} (d) {A, B, C}, {A, B, D} and {A, C, D}
Questions 2–4 below refer to the following E/R design for a database that keeps track of
buildings, rooms, and in particular, conference rooms.

Q146. Suppose that we convert the above E/R diagram into relations using the E/R-style
translation for subclasses. What will we get for the ConferenceRooms entity set?
(a) ConferenceRoom(capacity)
(b) ConferenceRoom(room number, capacity)
(c) ConferenceRoom(building name, room number, capacity)
(d) ConferenceRoom(building name, room number, area, capacity)
Q147. Suppose that we convert the ER model into three relations Building, Room, and
ConferenceRoom. Suppose there are m rooms in the database, and among these, n
are conference rooms. How many tuples are in relations Room and
ConferenceRoom, respectively?
(a) m and n (b) m and n - m
(c) m – n and n (d) 0 and m
Q148. Which of the following statements are true according to the constraints encoded by
the E/R diagram above? Do not make any assumptions other than those encoded
by the E/R diagram.
I. The number of entities in the Rooms entity set must be greater than or equal to
the number of entities in the ConferenceRooms entity set
II. The number of entities in the Rooms entity set must be greater than or equal to
the number of entities in the Buildings entity set
(a) I only (b) II only
(c) Both I and II (d) Neither I nor II
Q149. Consider the following E/R diagram for database of museums, paintings, and
artists. Museums display paintings; paintings are the work of artists; some artists
are also museum directors.

If a relational model is derived from the above E/R diagram, then the number of
attributes in Paintings relation that would be generated if all the relations are in

ADVANCED DATABASE MANAGEMENT SYSTEM - 202343


3NF is ___________.
Q150. Consider the following E/R diagram:

For simplicity, we have not listed the attributes associated with the entity sets. Let
us assume that the keys corresponding to the three entity sets employee, projects,
and tools are ssn, proj#, and toolid respectively. Furthermore, the work
relationship has an attribute start-date. If we map the above ER diagram into the
relational model, what will be the relation scheme for the relationship set using
(a) using(ssn, toolid)
(b) using(toolid, start-date)
(c) using(ssn, toolid, proj#)
(d) none of the above
Q151. Consider the following two ER diagrams -- ER1 and ER2

The statement that the number of entities in entity set P must be greater than or
equal to the number of entities in entity set Q holds for:
(a) ER1 but not ER2
(b) ER2 but not ER1
(c) Both ER1 and ER2
(d) Neither ER1 nor ER2
Data for the next two questions, consider the following information:
1. Manufacturers have a name, which we may assume is unique, an address, and a
phone number.
2. Products have a model number and a type (e.g., television set). Each product is made
by one manufacturer, and different manufacturers may have different products with
the same model number. However, you may assume that no manufacturer would have
two products with the same model number.
3. Customers are identified by their unique social security number. They have email
addresses, and physical addresses. Several customers may live at the same (physical)
address, but we assume that no two customers have the same email address.
4. An order has a unique order number, and a date. An order is placed by one customer.
For each order, there are one or more products ordered, and there is a quantity for
each product on the order.

ADVANCED DATABASE MANAGEMENT SYSTEM - 202344


Q152. [MSQ]
Which of the following statement is/are TRUE if we draw an E/R diagram that
represents the above information?
(a) The Manufacture is the week entity set.
(b) The Product is the week entity set.
(c) The connectivity between customer and Order entity set is many to 1, many is
customer side and 1 is order side.
(d) The connectivity between Product and Order entity set is many to many.

Q153. If a relational model is derived from the E/R diagram result of previous question,
then the minimum number of relations that would be generated if all the relations
are in 3NF is ___________.

Q154. [MSQ]
Consider the following two alternative schemas that represent pet adoptions:

Which of the following assertions is/are TRUE?


(a) In schema 1, a family can adopt at most one pet.
(b) In schema 2, if there are k agencies, a family can adopt at most k times.
(c) In schema 2, there is no record of which pet was adopted by which family.
(d) In schema 1, a family can adopt a pet without an agency being involved.
Q155. [MSQ]
Consider schema that represent pet adoptions

To capture the ER Diagram above, we create three relations: Pet, Adopts and
Family. Which of the following assertions is/are TRUE?
(a) The Pet table‟s primary key includes the column fid.
(b) The Adopts table‟s primary key includes the column pname

ADVANCED DATABASE MANAGEMENT SYSTEM - 202345


(c) The Adopts table‟s primary key includes the column fid.
(d) The Adopts table‟s column fid can be declared NOT NULL.
Q156. Consider the following ER diagrams labelled i, ii, and iii.

Match the above ER diagrams to the corresponding SQL statements. Note that there
is exactly one correct matching.
S1: CREATE TABLE S(s INT, PRIMARY KEY (s));
CREATE TABLE R(r INT, s INT REFERENCES S, PRIMARY KEY (r));
S2: CREATE TABLE R(r INT, PRIMARY KEY (r));
CREATE TABLE S(s INT, PRIMARY KEY (s));
CREATE TABLE L(r INT REFERENCES R, s INT REFERENCES S);
S3: CREATE TABLE S(s INT, PRIMARY KEY (s));
CREATE TABLE R(r INT, s INT NOT NULL REFERENCES S, PRIMARY KEY (r));
(a) S1 - (ii), S2 - (i), S3 - (iii)
(b) S1 - (i), S2 - (iii), S3 - (ii)
(c) S1 - (iii), S2 - (i), S3 - (ii)
(d) S1 - (iii), S2 - (ii), S3 - (i)
Q157. [MSQ]
Which of the following statements is/are TRUE?
(a) A relationship in an E-R diagram always translates to a table in the relational
model.
(b) There may be multiple ways to translate an E-R diagram to a relational schema.
(c) The mathematical definition of a relationship in the E-R model is: If A and B are
sets, then a relationship is a subset of A x B.
(d) None of the above
Q158. [MSQ]
Which of the following statements is/are TRUE?
(a) A multi-way relationship in ER can always be converted to a set of binary
relationships.
(b) It is possible to translate both a weak entity set and an ISA hierarchy in the ER
model to the relational model.
(c) The ER model has no mechanisms to capture keys that are not primary keys.
(d) Given any ER diagram, there is always only one correct way to translate it to the
relational model.
Q159. [MSQ]
Which of the following statements is/are FALSE?
(a) Every relationship in an E/R diagram must have an attribute.
(b) An entity set can have any number of attributes.
(c) A relationship connects two or more entity sets.

ADVANCED DATABASE MANAGEMENT SYSTEM - 202346


(d) To indicate an attribute is a key in an E/R diagram, you circle it.

ADVANCED DATABASE MANAGEMENT SYSTEM - 202347

You might also like