Advanced DBMS Sheet With Sloution_2022
Advanced DBMS Sheet With Sloution_2022
Advanced DBMS Sheet With Sloution_2022
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
Answer: (C)
Solution:
Answer: (B)
Solution:
It will print the name which has maximum score(i.e there not exist a score which is less
than the selected score)
Only Mehhboob Khan is printed.
Name
Mehboob Khan
Answer:B
Mehboob Khan
Satyajit Roy
R Asif
Vijayanand
R Mukharjee
Answer: 5
minus
2nd query return. (Brand name and Count with shoes color ≠ white)
Brand Count
name
Puma 2
Rebook 1
Munich 1
Gusci 1
output will be
Data for the next five question. Consider the following definition of tables and snapshot of
the tables:
Definition of tables:
CREATE TABLE EMPLOYEE (EMP_ID NUMBER, EMP_NAME VARCHAR2(20),
JOBVARCHAR2(20), MANG_ID NUMBER, SALARY NUMBER, DEPT_ID VARCHAR2(20),
PRIMARY KEY (EMP_ID), FOREIGN KEY MANG_ID) REFERENCES EMPLOYEE
(EMP_ID));
Q12. [MSQ]
Which of following query display name of the employees with second highest salary in
their department?
(a) SELECT Emp_Name FROM Employee
WHERE (dept_id, Salary) = Any (SELECT e1.dept_id, MAX(e1.salary) FROM
employee e1 WHERE salary < (SELECT MAX(salary) FROM employee e2 WHERE
e2.dept_id = e1.dept_id) GROUP BY e1.dept_Id);
(b) SELECT Emp_Name FROM Employee
WHERE (dept_id, Salary) IN (SELECT dept_id, max(salary) FROM employee
WHERE salary NOT IN (SELECT max(salary) FROM employee GROUP BY
dept_id) GROUP BY dept_id);
(c) SELECT salary, dept_id FROM employee e1
Q13. [MSQ]
Write a query to display the employee number, name and salary for all employees
who earn more than the average salary and who work in a department with any
employee with a 'J' in their name.
(a) SELECT Emp_id, EMp_Name , salary FROM employee WHERE salary > (SELECT
AVG (salary) FROM employee) OR dept_id IN (SELECT dept_ID FROM employee
WHERE Emp_Name LIKE '%J%');
(b) SELECT Emp_id, EMp_Name , salary FROM employee WHERE salary > (SELECT
AVG (salary) FROM employee) AND dept_id IN (SELECT dept_ID FROM
employee WHERE Emp_Name LIKE '%J%');
(c) SELECT Emp_id, EMp_Name , salary FROM employee WHERE salary > AVG
(salary) AND dept_id IN (SELECT dept_ID FROM employee WHERE Emp_Name
LIKE '%J%');
(d) SELECT Emp_id, EMp_Name , salary FROM employee WHERE salary > AVG
(salary) AND Emp_Name LIKE '%J%';
Answer: (b)
Solution:
query(a) return information of employee whose salary is greater than average salary or
information where employee work in a dept with any employee with „J‟.
query(b)will return info of employee whose salary is greater as well as having deptno
with any employee with „J‟ in their name.
Q14. Which of following query display the name and job of all employees whose salary is
smaller than any salary of employees whose job is Manager.
(a) SELECT Emp_name, Job FROM employee WHERE Salary < Any (SELECT salary
FROM employee WHERE job = 'MANAGER');
(b) SELECT Emp_name, Job FROM employee e1 WHERE Exists (SELECT * FROM
employee e2 WHERE e2.job = 'MANAGER' and e1.salary < e2.salary);
(c) SELECT Emp_name, Job FROM employee WHERE Salary < Any (SELECT salary
FROM employee WHERE job = 'MANAGER') and Job <> 'MANAGER';
(d) None of the above
Answer: (a), (b)
Solution:
query (a) inner query will select salary of employee where job= manager and outer
query return name, job from employee where salary is less than return by inner query.
Query
(b) inner query will return information where job is manager and compare salary
of outer query with inner e2 at every row if there exist a single salary e2 which is
smaller than e1 exist will become true and print that salary‟s corresponding
information.
(c) Select salary of job manager but print those employee who are not manger, salary
<any of salary return of inner query.
Answer: (a) and (b)
Data for the next five questions. Consider the following relations and their snapshot:
Student (snum:integer, sname:string, major:string, level:string, age:integer)
Snum Sname Major Level Age
051135593, Maria White, English, SR, 21
060839453, Charles Harris, Architecture, SR, 22
099354543, Susan Martin, Law, JR, 20
112348546, Joseph Thompson, Computer Science, SO, 19
115987938, Christopher Garcia, Computer Science, JR, 20
132977562, Angela Martinez, History, SR, 20
Answer: 5
Solution:
Hint: The above query finds For each age value that appears in Students, find the level
value that appears most often. For example, if there are more FR level students aged 18
than SR, JR, or SO students aged 18, you should print the pair (18, FR).
Age Level Count
18 FR 4
18 SO 1
18 JR 1
19 SO 3
19 JR 1
19 SR 1
20 JR 4
20 SR 1
ADVANCED DATABASE MANAGEMENT SYSTEM Page 18
21 SR 1
22 SR 1
The output of the above query is highlighted row:
S.age S.level
21 SR
22 SR
20 JR
19 SO
18 FR
Data for the next five questions. Consider the following relations and their snapshot:
Flights(flno:integer, from:string, to:string, distance:integer)
Flno From To Distance
99, Los Angeles, Washington D.C., 2308,
13, Los Angeles, Chicago, 1749,
346, Los Angeles, Dallas, 1251,
387, Los Angeles, Boston, 2606,
7, Los Angeles, Sydney, 7487,
2, Los Angeles, Tokyo, 5478,
33, Los Angeles, Honolulu, 2551,
34, Los Angeles, Honolulu, 2551,
76, Chicago, Los Angeles, 1749,
68, Chicago, New York, 802,
7789, Madison, Detroit, 319,
701, Detroit, New York, 470,
702, Madison, New York, 789,
4884, Madison, Chicago, 84,
2223, Madison, Pittsburgh, 517,
5694, Madison, Minneapolis, 247,
304, Minneapolis, New York, 991,
149, Pittsburgh, New York, 303,
Aircraft(aid: integer, aname: string, Certified(eid: integer, aid: integer)
cruisingrange: integer) Eid Aid
141582651, 1
Aid Aname
567354612, 2
Cruisingrange
567354612, 10
1, Boeing 747-400, 8430
242518965, 9
2, Boeing 737-800, 3383
011564812, 7
3, Airbus A340-300, 7120
567354612, 6
4, British Aerospace Jet, 1502
242518965, 7
5, Embraer ERJ-145, 1530
567354612, 9
6, SAAB 340, 2128
141582651, 3
7, Piper Archer III, 520
567354612, 4
8, Tupolev 154, 4103
Solution:
Hint: The above query finds the routes that can be piloted by every pilot who makes
more than $100,000.
Q23. Consider the following SQL query on the above database:
Answer: 5
Solution
Q31. [MSQ]
Consider the following SQL query on the above schema:
SELECT b.Book_Title, b.Book_Author
FROM Book b, (SELECT Book_Author, count(ISBN) AS num
FROM Book GROUP BY Book_Author) Book_Count
WHERE b.Book_Author = Book_Count.Book_Author AND num ≥ 2
ORDER BY b.Book_Author, b.Book_Title;
Which of the following queri(es) is/are similar to the above query?
(a) SELECT B1.Book_Title, B1.Book_Author
FROM Book B1, Book B2
WHERE B1.Book_Author <> B2.Book_Author
AND B1.Book_Title <> B2.Book_Title
ORDER BY B1.Book_Author, B1.Book_Title;
(b) SELECT B1.Book_Title, B1.Book_Author
FROM Book B1, Book B2
WHERE B1.Book_Author <> B2.Book_Author
AND B1.Book_Title = B2.Book_Title
ORDER BY B1.Book_Author, B1.Book_Title;
Q32. Which of the following query will display the name of publisher which publishes
highest number of books with rating 5?
(a) SELECT p.P_name, COUNT(P_Name)
FROM Publisher p, Ratings r, Book b
WHERE r.rating = 5 AND p.P_ID = b.P_ID AND b.ISBN = r.ISBN GROUP BY
Q34. [MSQ]
Which of the following(s) query will display the name of books which is reading by
the reader who is born on the date 09 June 1963
(a) SELECT Book_Title FROM Book b, Reading r1, Reader r2
WHERE b.ISBN = r1.ISBN AND r2.Reader_ID = r1.Reader_ID
AND r2.DOB = '09-JUN-1963';
Data for the next five questions. Consider the following relations containing airline flight
information:
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)
the primary keys are underline and note that the Employees relation describes pilots and other
kinds of employees as well; every pilot is certified for some aircraft (otherwise, he or she
would not qualify as a pilot), and only pilots are certified to fly. You can use the database
snapshot given in Q21 to Q25 for answer to next five questions.
Q35. Consider the following RA query on the above database:
Answer: 18
Identify the flights that can be piloted by every pilot whose salary is more than
$100,000.
Data for the next three questions. Consider the following relations schema containing ebay
system information:
Items(itemID: integer, description: string, startBid: real, sellerID: integer, qty: integer)
soldFor: real)
Q40. Which of the following TRC query find the ID‟s of sellers of items with starting bid ≥
$1000?
(a) {R|∃I ∈ Items(I.startBid ≥ 1000 ∧ R.sellerID = I.sellerID)}
(b) {R|∀I ∈ Items(I.startBid ≥ 1000 ∧ R.sellerID = I.sellerID)}
(c) {I|∃R ∈ Seller(I.startBid ≥ 1000 ∧ R.sellerID = I.sellerID)}
(d) {I|∀R ∈ Seller (I.startBid ≥ 1000 ∧ R.sellerID = I.sellerID)}
Answer: A
Solution
Q41. Which of the following TRC query find the ID‟s of customers who bought ≥ 2 of the
same item or bought an item that a seller had with quantity 1?
(a) {R|∃P ∈ Purchases(P.count ≥ 2 ∧ (∃I ∈ Items(P.itemID = I.itemID ∧ I.qty = 1)))}
(b) {R|∃P ∈ Purchases(P.count ≥ 2 ∨ (∃I ∈ Items(P.itemID = I.itemID ∧ I.qty = 1)))}
(c) {R|∃P ∈ Purchases((P.count ≥ 2 ∧ (∃I ∈ Items(P.itemID = I.itemID ∧ I.qty = 1)) ∧
(R.custID = P.custID))}
(d) {R|∃P ∈ Purchases((P.count ≥ 2 ∨ (∃I ∈ Items(P.itemID = I.itemID ∧ I.qty = 1)) ∧
(R.custID = P.custID))}
Q42. Which of the following TRC query find the ID‟s of items which are stocked by ≥ 2
sellers?
(a) {R|∃I1, I2 ∈ Items(I1.itemID = I2.itemID
∧ I1.sellerID = I2.sellerID ∧ R.itemID = I1.itemID}
(b) {R|∃I1, I2 ∈ Items(I1.itemID = I2.itemID
∨ I1.sellerID = I2.sellerID ∨ R.itemID = I1.itemID}
(c) {R|∃I1, I2 ∈ Items(I1.itemID = I2.itemID
∧ I1.sellerID ≠ I2.sellerID ∧ R.itemID = I1.itemID}
(d) {R|∃I1, I2 ∈ Items(I1.itemID = I2.itemID
∨ I1.sellerID ≠ I2.sellerID ∨ R.itemID = I1.itemID}
Answer: C
Solution
Data for the next two questions. Consider the relations HOSPITAL (HOSPITALID, NAME,
LOCATION) and DOCTORS (DOTORNAME, HOSPITALID).
Q45. What will be the tuple relation calculus query equivalent to the following statement?
"Names of all doctors available in Peerless"
Answer: D
Solution
Answer: C
Solution
Answer: A
Solution
Q48. Consider the relation PRODUCT (NAME, COUNT, SHOPID) and QUANTITY
(COUNT, SHOPID) as follows:
Q51. [MSQ]
Which of the following conclusions for functional dependencies is/are correct?
(a) If A → B and BC → D, then AC → D
(b) If AB → C then A → C
(c) If A → B1,…,Bn and C1,…,Cm → D and {C1,...,Cm} is a subset of {B1,…,Bn}, then
A→D
(d) If A → C and B → C and ABC → D, then A → D
Answer: A,C
Solution
Answer: A,B
Solution
Q57. A key is simple if it consists of only one attribute. If every key of table R is simple key,
then which of the following is always true?
(a) If R is in 2NF, it is also in 3NF
(b) If R is in 3NF, it is also in BCNF
(c) R is in 2NF, but is not in 3NF
Data for the next two questions. Let FD1 and FD2 are two FD sets for a relation R. Consider
the following four cases:
1. If all FDs of FD1 can be derived from FDs present in FD2, we can say that FD1 ⊂ FD1.
2. If all FDs of FD2 can be derived from FDs present in FD1, we can say that FD2 ⊂ FD1.
3. If 1 and 2 both are true, FD1 = FD2.
Minimal cover =
AB
AC
ADVANCED DATABASE MANAGEMENT SYSTEM Page 55
DA DE
FD2= {ABC and DAE}
AB DA
AC DE
Answer:C
Q61. [MSQ]
Consider the following set of FDs on R (P, Q, S, T, U, V)
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
Answer: A,C
Solution
If (Pet_Name, Breed) is a key for this instance, what may be the value of X?
(a) Beagle.
(b) Pug.
(c) Labrador.
(d) Either Beagle or Labrador.
Answer: B
Solution
Answer: D
Solution
a decomposition is lossy if after joining relation contains extra tuple. divide table
according to decomposed relation and the perform joining operation again if the extra
tuple ocur then decomposition is lossy.
Q68. In a hospital, there are various departments. Each doctor is associated with one
department. A patient gets registered to a department under one doctor in that
department. It may be required, that he/she may be treated by other doctors of same
/different departments also. Doctors suggest various tests for the patients, those are
noted along with their reports. If the primary key for the Department table is Dept_No,
Doctor table is Doc_Id and Patient table is Pat_Id, what is the minimal choice for the
primary key of Test table?
(a) Test_date, Doc_Id and Pat_Id
(b) Test_date, Dept_No, and Pat_Id
(c) Test_date, Doc_Id, Pat_Id and Dept_No
(d) Test_date, Dept_No and Doc_Id
Answer: C
Solution
Q71. Consider the relational schema R = {P, Q, R, S, T, U, V } and the set of functional
dependencies FD:
P→Q Q → R PS → TRV QT → UR S→V
Which of the following is a minimum cover of the FD?
(a) The given FD is a minimum cover.
(b) {P → Q, Q → R, PS → T, QT → UR, S → V}
(c) {P → Q, Q → R, P → T, Q → U, S → V}
Q72. Consider the relational schema R = {A,B,C,D,E,F,G,H} and the set of functional
dependencies FD:
A → E, BE→ D, AD →BE, BDH→ E, AC→ E, F→ A, E →B, D →H, BG →F, CD →A
Which of the following is a minimum cover of the FD?
(a) A→E, E→D, BD→E, F→A, E→B, D→H, BG→F, CD→A
(b) A→E, E→D, BD→E, F→A, E→B, D→H, BG→F, CD→A, AD→B
(c) A→E, BD→E, F→A, E→B, D→H, BG→F, CD→A, AD→B
(d) A→E, E→D, B→E, F→A, E→B, D→H, BG→F, CD→A
Answer: A
Solution
AE , BED , ADBE, BDHE, ACE, FA , EB, DH , BGF, CDA.
AE
BED
ADB extra as AE and EB. AB is extra.
ADE extra as AE is there .can be remove.
BDH E here H is extra as DH is there .
BDE is minimal.
DH
BGF
CDA
EB
FA
Minimal cover is AE , ED , BDE, FA,EB , DH, BGF, CDA
Answer:A
Q73. Consider the universal relation R = {A, B, C, D, E, F, G, H, I, J} and the set of functional
Q74. [MSQ]
Consider the universal relation R = {A, B, C, D, E, F, G, H, I, J} and the set of functional
dependencies F {AB → C, A → DE, B → F, F → GH, D → IJ}. If we decompose above
relation into BCNF using standard algorithm, then which of the following set of
relations are possible:
(a) (A, D, E) (B, F) (F, G, H) (D, I, J) (A, B, C)
(b) (A, D, E) (B, F) (D, I, J) (A, B, C)
(c) (A, D, E) (D, I, J) (A, B, C)
(d) None of the above.
Answer: A
Solution
ABC, ADE,BF,FGH,DIJ
AB is the key.
(ABCDEFGHIJ)
FD‟s violate BCNF are
ADE
BF
FGH
DIJ
Remove right hand side from FD and make separate relation.
(ADE) (BF)(FGH)(DIJ)(ABC)
If first convert (B,F) into relation then .
Q75. Let R(A, B, C, D, E, F, G, H) be a relational schema in which the following FDs are
known to hold:{A→B, A→C, A→D, AE→H, E→D, E→F and E→G}.Suppose we
A B C D E F G H
R1
R2
AEH is not preserved.
neither dependency preserving neither lossless.
Answer:D
Q76. Let R(A, B, C, D, E, F) be a relational schema in which the following FDs are known to
hold:{AB → C, AC → B, AD → E, BC → A, B → F }. Suppose we decompose the
relation R into two relations, R1(AB), R2(BC), R3(ABDE) and R4(EF). The above
decomposition is:
(a) Dependency preserving and lossless join
(b) Lossless join but not dependency preserving
(c) Dependency preserving but not lossless join
(d) Not dependency preserving and not lossless join
Answer: D
Solution
AB → C, AC → B, AD → E, BC → A, B → F
R1(AB) ,R2(BC), R3(ABDE), R4(EF)
A B C D E F
R1
R2
R3
R4
Not lossless and not dependency preserving.
Answer:D
Data for the next two questions. Assume we have the relation R: {A, B, C, D, E, F, G, H, I, J, K,
L, M, N, O, P, Q} with the following functional dependencies:
{A, B, E, F} → {C, G}
{A} → {D, I}
{A, F} → {J}
{B, E} → {K}
{B} → {M, N}
{E} → {O}
{F} → {P}
{K} → {H, L}
{D} → {Q}
Q78. [MSQ]
Answer: (c)
Solution:
Q80. [MSQ]
Consider the following collection of relations and dependencies. Assume that each
relation is obtained through decomposition from a relation with attributes
ABCDEFGHI and that all the known dependencies over relation ABCDEFGHI are
listed for each question. The options are independent of each other, obviously, since
the given dependencies over ABCDEFGHI are different. Which of the following
relation(s) is/are not in BCNF?
(a) R1(A, C, B, D, E), A → B, C → D
(b) R2(A, B, F), AB → F, B → F
(c) R3(A, D), A → D, D → A
(d) R4(D, C, H, G), D → H, C → G
Answers: (a) (b) and (d)
Q86. [MSQ]
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 i.e. each set in the power set of
four attribute are closed, what can you conclude from this case?
(a) R is in 2 NF (b) R is in 3 NF
(c) R is in BCNF (d) No conclusion can be drawn
Answer: A,B
Solution
Q87. [MSQ]
Consider a table R(A, B, C, D). A set of attributes X is a super key if X+ = ABCD, a set X
Q88. [MSQ]
Consider a relation R that contains r tuples with five attributes ABCDE. Assume that R
is decomposed into two smaller relations ABC and CDE. Let S be the relation ABC ⋈
CDE that contains s tuples. Assume that the decomposition is lossless, but not
dependency preserving. Which of the following statements can infer to be always true:
(a) r = s (b) r ⊆ s (c) r ⊇ s (d) r ≠ s
Answer: A
Solution
Q91. Consider a disk with block size B = 1024 bytes. A block pointer is P = 6 bytes long, and
Data for the next two questions. consider a relational DBMS with the following employee
Q94. Suppose to improve access speed, we add a sparse index INDEX2 on INDEX1. After
building INDEX2 we want to find a record with a given id. In the worst-case scenario,
how many blocks must the system read to retrieve the contents of the (existing)
record? ______
Answer:7
Solution:
Index 1 on,Index 2
128
128 in index 2 now this = 16 blocks at index 1.
8
Q98. A database system maintains dense B-trees index on key field. Assume the following:
Block size: 4096 bytes.
Database record size: 300 bytes.
Block pointer: 10 bytes
Record pointer: 12 bytes.
Key field: 8 bytes.
The B-tree nodes are approximately 85% occupied.
The database has 1,000,000 rows
How many blocks will B-tree index (excluding data block) use? __________
Answer: 8696
Solution
Order of B- tree:-
n*c+(n-1)r+(n-1)k = 4096
n*10+(n-1)+(n-1) *6+4096
=10n +12n -12+8n-8<4096
30n-20 137
ADVANCED DATABASE MANAGEMENT SYSTEM Page 82
85
n= 137* = 116.67
100
n=116
115 keys in 1 node
1= 115keys
(13340 keys) = 115*116 keys (nodes) = 116
115*116*116 keys 116*116 nodes
but 3rd level contain keys >106
106 -13340+115=986545 keys left and 1 block contain 115 keys
916545
hence block require =
115
last level
8579+116+1= 8696 blocks
Answer: 8696
Q99. Consider a B+ tree with order of non-leaf node is n and leaf node are n – 1 that has a
depth L > 1 (The depth of a node is the number of edges from the node to the tree's
root node and the depth of the root is 0). What is the maximum number of record
pointers the B+ tree can contain?
(a) nL × (n + 1) (b) n L – 1 × (n + 1)
(c) n L – 1 × (n – 1) (d) n L × (n – 1)
Answer: D
Solution
Q100. Consider a B+ tree with order of non-leaf node is n and leaf node are n – 1 that has a
depth L > 1 (The depth of a node is the number of edges from the node to the tree's
root node and the depth of the root is 0). What is the minimum number of record
pointers the B+ tree can contain?
𝑛 𝐿 𝑛 −1 𝑛 𝐿 𝑛 −1
(a) 2 x × (b) 2 × ×
2 2 2 2
𝑛 𝐿−1 𝑛 −1 𝑛 𝐿−1 𝑛 −1
(c) 2 × × (d) 2 × ×
2 2 2 2
Q101. Construct a B+-tree of order 3 for the following set of key values: 2, 3, 5, 7, 11, 17, 19,
23, 29, and 31. Assume that the tree is initially empty and values are added in
ascending order. The total number of nodes in the B+-trees for the cases where the
number of pointers that will fit in one node is three? ______
Answer: 16
Solution:
2,3,5,7,11,17,19,23,29,31
Q102. Construct a B+-tree of order 4 for the following set of key values: 2, 3, 5, 7, 11, 17, 19,
23, 29, and 31. Assume that the tree is initially empty and values are added in
ascending order. The total number of nodes split in the construction of B+-trees for the
cases where the number of pointers that will fit in one node is four? ____________
Answer: 8
Solution
= 8 nodes
Answer: 8
Q103. Suppose you have a B+-tree with 3 levels (root at level 1) in which each node has
exactly 10 keys. There is a record for each key 1, 2, 3, . . ., N, where N is the number of
records. How many nodes must be examined to find all records with keys in the range
[95, 134]? _________
Answer: 7
Solution
Q104. Consider the B+-tree index shown in the figure below. Each intermediate node can
hold up to five pointers and four key values. Each leaf can hold up to four records, and
leaf nodes are doubly linked as usual.
Q105. Consider the B+-tree index shown in the figure below. Each intermediate node can
hold up to five pointers and four key values. Each leaf can hold up to four records, and
leaf nodes are doubly linked as usual.
What is the maximum number of keys you could insert that would NOT change the
height of the tree more than 1? __________
Answer: 82
Solution
4 keys
5 children 4 keys at 1st level.
2nd 4*5 = 20 keys
4*5*5 = 100
B+ total node are at leaf node = 100 maximum
out of 100 ; 18 are present.
100-18 =82
Answer: 82
Q106. [MSQ]
Which of the following statements is/are incorrect?
(a) In ordered index, entries in the index file are stored on the search-key value.
(b) Clustering index is an ordered index whose search key defines the sequential order
of the file.
(c) An ordered sequential file with a primary index is called an index-sequential file
(d) The search key value must be the primary key of the file
Answer: (a), (c) and (d)
Q107. [MSQ]
Which of the following statements about multilevel index is/are correct?
(a) If the primary index does not fit in memory, access becomes expensive.
(b) Outer index should be a sparse index of primary index.
(c) Indices at all levels are not necessarily updated on insertion or deletion from the
file.
(d) We can have a primary index with an index record for each search-key value.
Answer: A,B,C,D
Solution
Q109. Which of the following statements is/are true for a B+-tree of order m containing n
items?
(a) The depth of the B+-tree is O(logmn) and this bounds the total number of disk
seeks.
(b) A node contains a maximum of m - 1 keys, and this bounds the number of disk
seeks at each level of the tree.
(c) Every Binary Search Tree is also an order 2 B+-Tree.
(d) None of the above
Answer: A
Solution
Q110. If the SQL statement SELECT C1, C2, C3 FROM T4 WHERE C2='Smith' is frequently
executed, which column(s) should be considered for indexing based only on the
statement itself?
Q111. If the SQL statement SELECT R1.A, R2.B FROM R1, R2 WHERE R1.K = R2.F AND
R2.K = 10 is frequently executed, which indexes will prove most useful?
(a) Index on R1.K and index on R2.K
(b) Index on R1.A and index on R2.B
(c) Index on R1.K and index on R2.F
(d) Composite index on (R2.K, R2.F)
Answer: A
Solution
Q112. Consider a relation R (a, b, c, d) containing 1,000,000 records, where each page of the
relation holds 10 records. R is organized as a heap file with dense secondary indexes,
and the records in R are randomly ordered. Assume that attribute a is a candidate key
for R, with values lying in the range 0 to 999,999. Consider the list of approaches in
LIST - I and list of queries in LIST - II:
LIST - I LIST - II
1. Scanning through the whole heap i. Find all R tuples.
file for R. ii. Find all R tuples such that a < 50.
2. Using a B+ tree index on attribute iii. Find all R tuples such that a = 50.
Q113. Suppose that the following keys, with the given hash values, are inserted into an
initially empty table of size 7 using linear-probing hashing.
Key: A B C D E F G
Hash: 3 5 3 4 5 6 3
Select the line on the list below that could not possibly result from inserting these keys,
no matter in which order they are inserted.
(a) B D F A C E G (b) C G B A D E F
(c) F G B D A C E (d) G E C A D B F
Answer: C
Solution
a) Using order ACEGBDF we get:
B 0
D 1
F 2
A 3
C 4
E 5
G 6
i.e. (a)
Q114. Linear-probing hash table of length 10 uses the hash function h(x) =x mod 10 . After
inserting six integer keys into an initially empty hash table, the array of keys is:
0 1 2 3 4 5 6 7 8 9
42 23 34 52 46 33
Assume that the length of the hash table does not change during the insertions. Which
of the following choice(s) are insertion sequences resulting in the above hash table?
(a) 46, 42, 34, 52, 23, 33 (b) 34, 42, 23, 52, 33, 46
(c) 46, 34, 42, 23, 52, 33 (d) 42, 46, 33, 23, 34, 52
Answer: C
Solution
Q115. The hash function h(k) = k mod 7 and linear probing are used to insert keys < 37, 38,
72, 48, 98, 11, 56 > into the hash table with indices 0…6. The order of the keys in the
table are?
(a) 72, 11, 37, 38, 56, 98, 48, (b) 11, 48, 37, 38, 72, 98, 56
(c) 98, 11, 37, 38, 72, 56, 48 (d) 98, 56, 37, 38, 72, 11, 48
Answer: D
Solution
Assuming that the initial size of the hash table was 7 and that it did not grow or
shrink, how many possible keys from the given keys which could be the last inserted
key? ___________
Answer: 3
Solution
Q118. Suppose many items for a hash table are initially hashing such that the first two hash
to index i, the next two to index i + 1, the next two to index i + 2, etc. Which
implementation approach or approaches are likely to lead to very poor performance?
(a) Separate chaining
(b) Open addressing with linear probing.
(c) Open addressing with quadratic probing.
(d) Open addressing with double hashing.
Answer: (b)
Solution:
A B C D E F
i i+1 i+2 i+3 i+4 i+5 i+6 i+7
In linear probing all value except first the will collide in the table. and it performs
worst.
Answer:B
Data for the next two questions. Consider the following schedule of reads and writes to
pages.
And a reference graph is provided for your convenience. The dotted edges represent all
possible edges; each edge is labelled with the transaction IDs of the nodes it connects, in order.
e.g., the edge fromT4 → T1 is labelled 41.
21, 34, 41, 42. 21 comes from the RW conflict at time steps 2 and 7. I comes from the
RW conflictat time steps 4 and 6. J comes from the WR conflict at time steps 6 and 8.
K comes from the WRconflict at time steps 6 and 9.
Q121. Which of the following serial schedules are conflict equivalent to the schedule above?
(a) T4, T2, T1, T3 (b) T3, T2, T4, T1
(c) T3, T4, T2, T1 (d) T1, T2, T4, T3
Answer: (c)
Solution:
The graph is acyclic, so it is conflict serializable. Topologically sorting the abovegraph
gives this ordering.
Q122. Consider the transactions T1, T2, and T3 and the schedules S1 and S2 given below.
T1: r1(X); r1(Z); w1(X); w1(Z)
T2: r2(Y); r2(Z); w2(Z)
T3: r3(Y); r3(X); w3(Y)
S1: r1(X); r3(Y); r3(X); r2(Y); r2(Z); w3(Y); w2(Z); r1(Z); w1(X); w1(Z)
S2: r1(X); r3(Y); r2(Y); r3(X); r1(Z); r2(Z); w3(Y); w1(X); w2(Z); w1(Z)
Which one of the following statements about the schedules is TRUE?
(a) Only S1 is conflict-serializable.
(b) Only S2 is conflict-serializable.
(c) Both S1 and S2 are conflict-serializable.
precedence graph of S1 .
As here no cycle in precedence graph .
S1 is conflict serializable.
S2: r1(X); r3(Y); r2(Y); r3(X); r1(Z);r2(Z); w3(Y); w1(X); w2(Z); w1(Z)
Conflict serializable.
Answer:D
Q124. [MSQ]
Given the following two schedules:
S1: r1(x); r2(x); w2(x); r3(x); w1(x); w2(y); r3(y); w3(x)
S2: r2(x); r1(x); w1(x); w2(x); w2(y); r3(x); w3(x); r3(y)
Which of the following statements is/are true?
(a) S1 and S2 are conflict equivalent.
(b) S1 and S2 are view equivalent.
(c) Both S1 and S2 are conflict serializable
(d) Both S1 and S2 are view serializable
Answer: B
Solution
Answer:3
Q126. Consider the following partial Schedule S involving two transactions T1 and T2.
Time T1 T2
t0 read(A);
t1 write(A);
t2 read(C);
t3 write(C);
t4 read(B);
t5 write(B);
t6 read(A);
t7 Commit;
t8 read(B)
Suppose that the transaction T1 fails immediately after time instance 8. Which one of
the following statements is correct?
(a) T2 must be aborted and then both T1 and T2 must be re-started to ensure
transaction atomicity
(b) Schedule S is non-recoverable and cannot ensure transaction atomicity
(c) Only T2 must be aborted and then re-started to ensure transaction atomicity
(d) Schedule S is recoverable and can ensure atomicity and nothing else needs to be
done.
Answer: B
Solution
T1 get fails after T8.
Here T1 is uncommiteed at t1 time and write A and T2 read A at t6 and get commit
hence here uncommitted transaction changes get read by other transaction and get
committed itself hence non- recoverable.
T1 get failed hence not atomic.
Answer:B
Q127. Consider the following two transactions T1 and T2 involving data items A and B. The
Answer: D
Solution
D is correct. Both serial schedules T1 → T2 and T2 → T1, In the very first step one
transaction reads the value written by other transaction so any non-serial interleaving
will never lead to conflict
serializable
Q128. [MSQ]
Consider the following schedule
Time T1 T2 T3
t0 Write(A);
t1 Read(B);
t2 Read(B);
t3 Write(A);
t4 Read(B);
t5 Write(C);
t6 Commit;
t7
t8 Write(B);
t9 Commit;
t10 Commit;
Which of the following statements is/are true regarding to above schedule?
(a) This schedule is possible under basic two-phase locking.
(b) This schedule is possible under strict two-phase locking.
(d) This schedule is possible under time stamp protocol.
(c) This schedule is free from cascading roll backing.
Answer: A
Solution
Time T1 T2 T3
Possible under 2PL but not in strict all X-lock unlock after the commit only can‟t
possible in strict 2PL.
here uncommitted changes are not read write by any transaction .free from case cade
rollbacking.
Answer: A
Q129. For the schedule S given below, if transaction T1 aborts after the last operation of
schedule S, then which of the following statements will be true?
S: r1(x); r2(z); w1(x); r3(x); r2(y); w2(y); w3(x); r3(y); r2(x)
(a) Only T3 will be rolled back.
(b) First T2 will be rolled back followed by T3 rollback.
(c) First T3 will be rolled back followed by T2 rollback.
(d) There will be no cascading rollbacks.
Answer: C
Solution
S: r1(x); r2(z);w1(x); r3(x); r2(y);w2(y);w3(x); r3(y); r2(x)
After this T1 get abort.
hence first T3 is to be rollback followed by T2. as change of T1 is read by T2 .
Answer:C
Q130. [MSQ]
T1 T2 T3 T4
S(A)
r3(A)
X(B)
S(C) w4(B)
r1(C) unlock B
S(D)
r3(D)
X(B)
w3(B)
X(D)
w2(D)
T1 T2
X(A)
r1(A)
X(B)
r2(B)
w2(B)
w2(A)
commit
unlock A
X(A)
r2(B)
w2(B)
w1(A)
commit
unlock A
X(A)
r2(A)
w2(A)
commit
Q133. [MSQ]
Consider a schedule of three transactions, T1, T2, and T3 that access three database
elements, A, B, and C. The real time at which events occur increases down the page, as
usual. However, we have also indicated the timestamps of the transactions and the
Q135. Consider the following schedule under timestamp-based protocol, the protocol
allocates timestamps to transactions in the order of their starts.
r2(A), co2, r1(A), w1(A)
What action the protocol will take for the last request?
(a) the request is accepted,
(b) the request is ignored,
Q137. Consider four transactions T1, T2, T3, and T4 operating on three data objects X, Y, and Z.
Let a Timestamp Ordering scheduler allow the following schedule of operations:
r1(X), r2(Y), w2(Z), r3(Z), r4(X), w4(Y), w3(Z), r1(Z), w1(Y). Let ts1, ts2, ts3, and ts4 be the
timestamps allocated by the Timestamp Ordering scheduler to the four transactions T1,
T2, T3, and T4, respectively. Assume that the timestamps of X, Y, and Z are at or below
60 before the above schedule of operations is executed. identify in the list below the set
of timestamp values for the four transactions that will allow the schedule above.
(a) ts1 = 110, ts2 = 120, ts3 = 80, ts4 = 95.
(b) ts1 = 110, ts2 = 80, ts3 = 95, ts4 = 90.
(c) ts1 = 125, ts2 = 70, ts3 = 130, ts4 = 80.
(d) ts1 = 125, ts2 = 130, ts3 = 70, ts4 = 80.
Answer: C
Solution
Q139. Consider two transactions that simultaneously attempt to acquire locks on object Z.
The types of locks requested are given in four options below. Assume that each
transaction has requested the appropriate lock on Z's parent in the hierarchy. Which of
the following case(s) below, write the transactions can obtain the lock at the same
Q140. Consider the following lock requests in Table given below. And note that
S(_) and X(_) stand for 'shared lock' and 'exclusive lock', respectively.
T1, T2 and T3 represent three transactions.
LM stand for `lock manager'.
For the lock requests in above Table, which lock will be blocked by the lock manager?
(a) t1, t3, t4 (b)t2, t5 (c)t6, t7 (d) t3, t5
Q141. [MSQ]
Which of the following statements is/are true?
(a) Wound-wait always outperforms wait-die.
(b) If we know all records that each transaction will access, we can prevent deadlocks
by
imposing a total order on lock acquisitions.
(c) Wait-die always outperforms wound-wait.
(d) In general, locking uses fewer resources than optimistic methods that rely on
validation.
Answer: B,D
Solution
Q149. [MSQ]
How many of the following statements is/are TRUE?
1. For any schedules S1 and S2, if S1 and S2 are conflict serializable, then S1 and S2 are
conflict equivalent.
2. A SIX lock is compatible with IS and IX locks, i.e. if a transaction holds a SIX lock
on an object, then another transaction can take an IS or IX lock on the same object.
3. An IX lock is compatible with an IS lock, i.e. if a transaction holds an IS lock on an
object, then another transaction can take an IX lock on the same object.
4. Strict 2PL prevents deadlocks.
5. In timestamp-based concurrency control, if a transaction gets aborted, it will be
restarted with a new timestamp.
(a) 1 (b) 2
(c) 3 (d) 4
Answer:B
Solution
Q153. [MSQ]
Which of the following statements is /false?
(a) Blind writes appear in every view-serializable schedule that is not conflict
serializable.
Q155. [MSQ]
Which of the following statements is/are true?
(a) Under 2PL protocol, once a transaction releases a lock, it can no longer acquire any
new locks.
(b) Every conflict serializable can be produced by 2PL locking protocol.
(c) Schedules under 2PL are guaranteed to prevent cascading aborts.
(d) Strict two-phase locking is both necessary and sufficient to guarantee conflict
serializability.
Answer: (a)
Solution:
(a) Under 2PL protocol, once a transaction release a lock, it can no longer acquire a
lock- True
(b) Every conflict serializable can be produced by 2PL locking protocol- False.
(c) Schedules under 2PL are guaranteed to prevent cascading abort- False
(d) Strict two-phase locking is both necessary and sufficient to guarantee conflict
Data for the next two questions. Consider a database with three elements, X, Y and Z. The
initial values of X, Y and Z are 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 just after the last statement has
return. Consider the following log entries:
1. < START T2 >
2. < START T3 >
3. < T2, X, 10 >
4. < T2, Y, 20 >
5. < COMMIT T2 >
6. < START CKP T(T3) >
7. < T3, X, ??? >
8. < START T1 >
9. < T3, Z, ??? >
10. < T1, X, 42 >
11. < END CKP T >
12. < COMMIT T3 >
13. < START CKP T(T1) >
14. < COMMIT T1 >
Q156. If the pure redo logging (Deferred database modification) with log entry <txn, item,
after -val) is used then the missing value of line 7 and 9 is respectively
(a) 100, 101 (b) 42, 100 (c) 10, 100 (d) 10, 101
Answer: A
Solution
Q157. If the database crashes immediately after writing the above log entries, then
Data for the next two questions. Consider a database with three elements, X, Y and Z. The
initial values of X, Y and Z are 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 just after the last statement has
Q159. [MSQ]
If the database crashes immediately after writing the above log entries, which of the
following statements is/ are 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.
Q160. Assume a basic check pointing recovery protocol. Suppose the following schedule is
being run:
1. <START, T1>;
2. <T1, A, 120, 100>;
3. <CHECKPOINT>;
4. <COMMIT, T1>;
5. <START, T2>;
6. <T2, B, 150, 180>;
7. <START, T3>;
8. <T3, A, 100, 50>;
9. <START, T4>;
10. <T4, C, 300, 400>;
11. <T3, D, 300, 200>;
12. <COMMIT, T3>;
13. <T2, A, 50, 150>;
Suppose the schedule crashes after the last entry. What are the undo and redo lists in
the correct order?
(a) Undo List: T4, T2; Redo List: T1
(b) Undo List: T2, T4; Redo List: T3
(c) Undo List: T4, T2; Redo List: T1, T3
(d) Undo List: T4, T2; Redo List: T3
Q161. Which one of the following options does not follow deferred database modification
scheme in the system crash situation?
(a) After system crash if there is no “commit T” instruction in log file then it requires
nothing to recover
(b) After system crash all transactions are redone in the backward order of their log
record (i.e., last log record first)
(c) No undo operations are required in the deferred database scheme.
(d) None of the above
Answer: C
Solution
Q162. Consider the simple nested-loop join of the following two relations r and s.
Assuming the worst-case memory availability, i.e., the memory can hold only one
Assuming the worst-case memory availability, i.e., the memory can hold only one
Answer: 2050
Solution:
Outer relation should be smaller; thus, s should be the outer loop and r the inner.
Transfers = bs + bs × br = 50 + 50 × 40 = 2050
Data for the next two questions. Consider the following ER diagram:
Data for the next three questions. Consider the following ER diagram
Q166. How many tables will be created if we map this ER diagrams in to table? __________
Answer: 4
Solution
Here in question there is written that vehicle is super type and Truck and Bus is
subtype but Truck and Bus do not cover vehicle and Truck, Bus also not overlook .
We have to make table for super type and subtype.
3 tables are created.( vehicle, truck, bus)
Now driving _log is weak entity. we make one table for this using primary key of
vehicle. and generate is weak relationship.
4 tables are created. vehicle, Bus, Truck, Driving_log.
Answer:4
Q167. Which of the following is correct relation for the entity set Driving_Log?
(a) Driving_Log (log_number, distance)
(b) Driving_Log (plate_number, log_number, distance)
(c) Driving_Log (plate_number, log_number, distance)
(d) Driving_Log (plate_number, log_number, distance)
Q168. Which of the following is correct relation for the entity set Bus?
(a) Bus(max_passanger)
(b) Bus (plate_number, max_passanger)
(c) Bus (plate_number, max_passanger)
(d) Bus (plate_number, manufactured_year, max_passanger, purchased_year)
Answer: C
Solution
Bus here total generalization is not supertype and subtype both.
Bus will contain primary of vhicle and all its attribute.
Bus (plat_no, max passanger)
Answer:C
Answer: D
Solution
Q171. Consider the binary relationship type BiologicalMother between entity types Person
and Woman. Suppose the cardinality ratio (Person : Woman) constraint of the
relationship is expressed using (min, max) notation as (u, v) on the line connecting
Person to BiologicalMother and (x, y) on the line connecting Woman to BiologicalMother,
which one of the following is correct:
(a) (u,v) = (1,1); (x,y) = (1, N)
(b) (u,v) = (1,N); (x,y) = (1, N)
(c) (u,v) = (1,1); (x,y) = (0, N)
(d) (u,v) = (1,N); (x,y) = (0, N)
Answer: C
Solution
Q172. [MSQ]
Consider the following statements: Which of the following is/are true?
(a) An entity set E can be associated with a relationship set R more than once.
(b) At most 2 distinct entity sets can be associated with any relationship set R.
(c) A weak entity set must have total participation in its identifying relationship set.
(d) None of the above
Answer: C
Solution
Only 1 and 3 are true.
Answer:C
Which one of the following problem descriptions could have led to the ER model
above?
(a) We are modeling a volleyball tournament. A volleyball game is played by two
teams. Multiple referees make sure during a single game that the rules are
respected.
(b) A volleyball game in a tournament is played by two teams. A referee has to be
present at each game to make sure the rules are respected.
Data for the next two questions, Consider the following ER diagram:
Q174. How many tables will be created if we map this ER diagrams in to table? ________
Answer: 8
Solution
Following tables
(1)Reader (2)Borrows (3) Copy (4) Book (5)category (6)incat(7)publisher (8)contain
(Self join)in contain self join is there hence have to create table.
8 table
Answer:8
Q175. Which of the following is not the primary key of any table?
Q176. Consider an Entity-Relationship (ER) model in which entity sets E1 and E2 are
connected by an M : N relationship R12. E2 and E3 are connected by a 1 : N (1 on the
side of E2 and N on the side of E3) relationship R23. E1 has three single-valued
attributes a11, a12 and a13 of which a11 is the key attribute. E2 has two single-valued
attributes a21 and a22 of which is a21 the key attribute. E3 has two single-valued
attributes a31 and a32, and one multi-valued attribute of which a31 is the key attribute.
The relationships do not have any attributes. If a relational model is the derived from
the above ER model, then the minimum number of relations that would be generated
if all the relations are in 3NF is ________
Answer: 5
Solution
If a relational model is the derived from the above ER model, then the total number of
attributes in all relations that would be generated if all the relations are in 3NF is
______
Answer: 19
Solution
3 attribute in worker (Name, Persnr, stations)
3 attribute in doctor (PersNr,exprestise, Degree)
2in nurse (perNr, siklls)
2 in treats (persnr, patientNr)
6 in patient(Name, patientNr Room Nr from, To, illness)
3 in room/RoomNr ,Bed, station Nr)
19 attributes are there.
Answer:19
Other than the FD's that can be derived by ER diagram one more FD hold
Program, course# ⟶ cname
If we translate this ER diagram into table highest normal form satisfied by the schema
is
(a) 1 NF (b) 2 NF (c) 3 NF (d) BCNF
Answer: A
Solution
How many of the following conclusion can be inferred from the above diagram?______
(a) Each account must be associated with a bank branch.
(b) Each customer must have an account.
(c) Each loan must be owned by more than one customer, and each loan must be
associated with exactly one bank branch.
(d) A bank can have more than one branch.
Answer: 2
Solution