Advanced DBMS 2023
Advanced DBMS 2023
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
Aircraft Certified
Aid Aname Cruisingrange
Eid
Aid
Employees
Eid Ename Salary
Answer the following question based on the above database schema and snapshot.
Text
Student (snum: integer, sname: string, major: string, level: string, age: integer)
Student Faculty
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___________
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;
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;
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
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))
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.
(d)πactor1, actor2[σactor1 <> actor2 (ρactor → actor1 (πtitle, actor(movie))⨝𝑡𝑖𝑡𝑙𝑒 = 𝑡𝑖𝑡𝑙𝑒 2 ρactor → actor2, title → title2 (πtitle,
actor(movie)))]
(d) Assume R(A, B) and S(C, D). Then. R⋈B = cS = B = C(R × S).
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.
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.
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:
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
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]
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
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?
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? _________
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.
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
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?
_________
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
(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)
Q103. Which of the following key could be the first key inserted?
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
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
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.
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
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.
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.
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.
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
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}
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
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.
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:
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
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.