Dbms Question Bank
Dbms Question Bank
( AN AUTONOMOUS INSTITUTION )
UNIT 3 TRANSACTIONS
Transaction Concepts – ACID Properties – Schedules – Serializability – Transaction support in
SQL – Need for Concurrency – Concurrency control –Two Phase Locking- Timestamp –
Multiversion – Validation and Snapshot isolation– Multiple Granularity locking – Deadlock
Handling – Recovery Concepts – Recovery based on deferred and immediate update – Shadow
paging – ARIES Algorithm
( AN AUTONOMOUS INSTITUTION )
Key value Stores – Column Based Systems – Graph Databases. Database Security: Security issues
– Access control based on privileges – Role Based access control – SQL Injection – Statistical
Databasesecurity – Flow control – Encryption and Public Key infrastructures – Challenges
TOTAL: 45 PERIODS
( AN AUTONOMOUS INSTITUTION )
OUTCOMES:
Upon completion of the course, the students will be able to:
Construct SQL Queries using relational algebra
Design database using ER model and normalize the database
Construct queries to handle transaction processing and maintain consistency of the
database
Compare and contrast various indexing strategies and apply the knowledge to tune the
performance of the database
Appraise how advanced databases differ from Relational Databases and find a suitable
database for the given requirement.
TEXT BOOKS:
1. Abraham Silberschatz, Henry F. Korth, S. Sudharshan, ―Database System Concepts‖, Seventh
Edition, McGraw Hill, 2020.
2. Ramez Elmasri, Shamkant B. Navathe, ―Fundamentals of Database Systems‖, Seventh Edition,
Pearson Education, 2017
REFERENCES:
1. C.J.Date, A.Kannan, S.Swamynathan, ―An Introduction to Database Systems‖, Eighth
Edition,Pearson Education, 2006.
( AN AUTONOMOUS INSTITUTION )
( AN AUTONOMOUS INSTITUTION )
COURSE OUTCOME
At the end of course, students will be able to
UNIT I
RELATIONAL DATABASE :
Purpose of Database System – Views of data – Data Models – Database System Architecture –
Introduction to relational databases – Relational Model – Keys – Relational Algebra – SQL fundamentals
Advanced SQL features – Embedded SQL– Dynamic SQL
PART A
1. What is database?(R)
A database is a basic electronic storage with collection of interrelated data, organized to provide
efficient retrieval. Databases are organized by fields, records and files or tables.
( AN AUTONOMOUS INSTITUTION )
On-line retailers
Manufacturing
Human resources
( AN AUTONOMOUS INSTITUTION )
( AN AUTONOMOUS INSTITUTION )
The collection of information stored in the database at a particular moment is called an
instance of the database.
( AN AUTONOMOUS INSTITUTION )
14. What are the different data models? (R) (MAY 2012)
Relational Data Model
The Entity-Relationship Data Model
Object-Based Data Model
Semi structured Data Model
( AN AUTONOMOUS INSTITUTION )
represent both data and the relationships among those data. It also includes a DML and DDL.
( AN AUTONOMOUS INSTITUTION )
( AN AUTONOMOUS INSTITUTION )
31. What is the use of embedded SQL? (U) (MAY 2012) (NOV 2014)
A fundamental principle underlying embedded SQL, which we call the dual-mode
principle, is that any SQL statement that can be used interactively can also be embedded in an
application program.
( AN AUTONOMOUS INSTITUTION )
32. Write short note on OPEN, FETCH and CLOSE statements. (R)
OPEN:
EXEC SQL OPEN < Cursor name>;
Opens the specified cursor. A set of rows is thus identified and becomes the current active set for
the cursor.
FETCH:
EXEC SQL FETCH <Cursor name>
INTO <host variable reference
commalist>; Advances the specified cursor to the next
row in the active set.
CLOSE:
( AN AUTONOMOUS INSTITUTION )
invoked automatically whenever some specified event occurs.
( AN AUTONOMOUS INSTITUTION )
attribute names, to be a relation with a heading that is the union of the headings of a and b and with
a body appearing in a and a tuple appearing in b.
49. Give the usage of the rename operation with an example.(MAY 2010) (U)
1.LosslessDecomposition
2. DependencyPreservation
3. Lack of Data Redundancy
( AN AUTONOMOUS INSTITUTION )
Key A key is a single or combination of multiple fields. Its purpose is to access or retrieve
( AN AUTONOMOUS INSTITUTION )
PART B
1. Explain the system structure of a database system with neat block diagram. (R) (DEC 2007), (MAY
2010) (MAY 2012)
2. What is a data model? Explain various data model for describing the design of a database at the logical
level. (U) (APRIL 2008), (MAY 2010)
3. Explain the different between physical and logical data independence with an example. (U)(APRIL 2008)
5. Describe the three-schema architecture. Why do we need mapping between schema Levels? How do
different schema definition languages support this architecture? (R) (DEC 2008)
1. What is the notation used in E-R diagram? Explain the E-R model structure with Example.(U)(NOV
2014)
2. Explain the role and functions of the database administrator. (R)
iv. Views
4. Develop an Entity Relationship model for a library management system. Clearly State the
problem Definition, Description, Business Rule and any assumption you make. (AP)
(MAY 2009) (NOV 2014)
12. (i)State and explain the command DDL,DML,DCL with suitable example(7).
(ii) Justify the need of embedded SQL.Consider the relation
Student (student no, name, mark and grade).Write the embedded SQL statement in C language to
retrieve all the students records whose mark than 90. (6) (Nov/Dec-2017)
13. Discuss about Tuple Relational Calculus and Domain Relational Calculus. (R) (DEC 2008)
( AN AUTONOMOUS INSTITUTION )
(MAY 2012)
14. What are aggregate functions? Explain five built-in aggregate functions. (U) (MAY 2008)
15. Consider the following relations for a company database Application.(AP)(MAY 2009)
( AN AUTONOMOUS INSTITUTION )
Department (DeptNo,Name)
(ii) Develop an SQL query to list the department number and the
number of Employee in each department.
(iii) Develop a View that will keep track of the department number, the number of
employees in the department, and the total basic pay expenditure for each
department.
(iv) Develop an SQL query to list the details of employees who have worked in more
than three projects on a day.
16. Explain how dangling tuple may arise and also explain problems that they Cause. (U)
(MAY 2008)
17. Briefly present a survey on Integrity and Security. (U) (MAY 2012)
18. Create an EMPLOYEE table and write the steps for various functions in an SQL Like add,
update, delete, save and join the various attributes of an EMPLOYEE Table.
(C)(MAY 2007)
19. Explain the use of trigger with your own example. (U) (MAY 2010)
20. What is a view? How can it be created? Explain with an example. (R) (MAY 2010)
21. Briefly present a survey on Integrity and Security. (U) (MAY 2012)
( AN AUTONOMOUS INSTITUTION )
Course File
Professor File
10
( AN AUTONOMOUS INSTITUTION )
Registration File
Consider a suitable example of tuples/records for the above mentioned tables and write
DML statements (SQL) to answer for the queries listed below:
(iv) For a specific student number, in which courses is the student registered and what is
his/her name?
23. Let relations r1(A,B,C)and r2(C,D,E) have the following properties r1 has 20000 tuples r2
has 45000 tupes ,25 tuples of r1, fit on one block and 30 tuples of r2 fit on one block .Estimate
the number of block transfers and seeks required,using each of the following join strategies for
r1∞r2:
(i) Nested loop join
(ii) Block Nested
loop join
(iii) Merge join
( AN AUTONOMOUS INSTITUTION )
(ii) Find the names of employees who have borrowed all books published by McGraw-
11
( AN AUTONOMOUS INSTITUTION )
UNIT II
DATABASE DESIGN
Entity-Relationship model – E-R Diagrams – Enhanced-ER Model – ER-to-Relational
Mapping – Functional Dependencies – Non-loss Decomposition – First, Second, Third
Normal Forms, Dependency Preservation – Boyce/Codd Normal Form – Multi-valued
Dependencies and Fourth Normal Form – JoinDependencies and Fifth Normal Form
Fifth Normal Form
PART A
1. What is entity? (R)
It is a 'thing' in the real world with an independent existence.
( AN AUTONOMOUS INSTITUTION )
The object –oriented data model is another data model that has seen
increasing attention. The object-oiented model can be seen as extending the E-R
model with notions of encapsulation, methods and object identity.
II / III 129
12
( AN AUTONOMOUS INSTITUTION )
XY
( AN AUTONOMOUS INSTITUTION )
A relvar is in BCNF if and only if every nontrivial, left-irreducible FD
has a candidate key as its determinant (OR) A relvar is in BCNF if and only
if every determinant is a candidate key.
17. What is multi-valued dependence? (R)
II / III 130
13
( AN AUTONOMOUS INSTITUTION )
*{A, B …Z}
if and only if every legal value of R is equal to the join of its projections on A,
B,……Z.
( AN AUTONOMOUS INSTITUTION )
such that most ambiguity is removed.
131
( AN AUTONOMOUS INSTITUTION )
28. What is the difference between Data Integrity and Data Security? (NOV 2013)
(U)
Data integrity and data security are two different aspects that make sure
the usability of data is preserved all the time. Main difference between integrity
and security is that integrity deals with the validity of data, while security deals
with protection of data. Backing up, designing suitable user interfaces and error
detection/correction in data are some of the means to preserve integrity, while
authentication/authorization, encryptions and masking are some of the popular
SubCode:CS3492 Subject Name : DBMS
Department of Computer Science and Business Systems
( AN AUTONOMOUS INSTITUTION )
means of data security. Suitable control mechanisms can be used for both
security and integrity.
29. Which operators are called as unary operators and why are they called so
(NOV 2013) (U)
II / III 132
15
( AN AUTONOMOUS INSTITUTION )
PART B
1. What is the notation used in E-R diagram? Explain the E-R model structure with
Example.
(U)(NOV 2014)
2. Develop an Entity Relationship model for a library management system. Clearly
State the problem
Definition, Description, Business Rule and any assumption you make. (AP)
(MAY 2009) (NOV 2014)
3. Develop an Entity Relationship model preparation staff (chef) and finalize the
customer‗s bill. The Food preparation staffs (Chefs), with their touch-display
interfaces to the system, are able to view orders sent to the kitchen by waiters.
During preparation, they are able to let the waiter know the status of each item,
and can send notifications when items are completed. The system should have
full accountability and logging facilities, and should support Supervisor actions
to account for exceptional circumstances, such as a meal being refunded or
walked out on. (AP) (Dec2015)
4. Distinguish between lossless-join decomposition and dependency preserving
decomposition(7)
5. State and explain the architecture of DBMS.Draw the ER diagram for banking
systems.(Home loan Application)(13)(Nov/Dec-2017)
( AN AUTONOMOUS INSTITUTION )
133
( AN AUTONOMOUS INSTITUTION )
UNIT III
TRANSACTIONS
Transaction Concepts – ACID Properties – Schedules – Serializability –
Transaction support in SQL – Need for Concurrency – Concurrency
control –Two Phase Locking- Timestamp – Multiversion – Validation and
Snapshot isolation– Multiple Granularity locking – Deadlock Handling –
Recovery Concepts – Recovery based on deferred and immediate update
– Shadow paging – ARIES Algorithm
PART – A
( AN AUTONOMOUS INSTITUTION )
concurrently, any given transaction‗s updates all connected from
all the rest, until that transaction commits. Another way of saying
the same thing is that, for any two distinct transactions A and B ,
A might see B‗s updates or B might see A‗s updates, but not both.
II / III 134
17
( AN AUTONOMOUS INSTITUTION )
( AN AUTONOMOUS INSTITUTION )
points while it is executing, and subsequently to roll back to a previously
established save point, if required, instead of having to roll back all the way
to the beginning.
II / III 135
18
( AN AUTONOMOUS INSTITUTION )
13. What are the three problems that any concurrency control mechanism must
address? (R)
The three problems are:
Two –phase locking theorem is ―If all transactions obey the two-phase
locking protocol, then all possible interleaved schedules are serializable‖.
19. State the two-phase locking protocol. (MAY 2012)(NOV 2013) (R)
The two-phase locking protocol is as follows
( AN AUTONOMOUS INSTITUTION )
i. Before operating on any object a transaction must acquire a
lock on that object.
ii. After releasing a lock, a transaction must never go on to
II / III 136
19
( AN AUTONOMOUS INSTITUTION )
Hold and Wait:There must exist a process that is holding at least one
resource and is waiting to acquire additional resources that are
currently being held by other processes.
Circular Wait: There must exist a set {p0, p1, .... pn} of waiting processes
such that p0 is
waiting for a resource which is held by p1, p1 is waiting for a resource which
is held by p2,..............................................................................................................................
SubCode:CS3492 Subject Name : DBMS
Department of Computer Science and Business Systems
( AN AUTONOMOUS INSTITUTION )
pn-1 is waiting for a resource which is held by pn and pn is waiting for
a resource which is held by p0.
II / III 137
20
( AN AUTONOMOUS INSTITUTION )
It is simple, but efficient, scheme called the shadow copy schemes. It is based o n
making copies of the database called shadow copies that one transaction is active
at a time. The scheme also
25. What type of locking needed for insert and delete operations (April/May-
2017)
When you execute an INSERT, UPDATE, or DELETE statement, the database server
uses
exclusive locks. An exclusive lock means that no other users can update or delete the
item until the
PART – B
3. What is Deadlock? List and discuss the four conditions for Deadlock. (R)
( AN AUTONOMOUS INSTITUTION )
(MAY 2007)(NOV 2014)
II / III 138
21
( AN AUTONOMOUS INSTITUTION )
A
=
0
t
h
SubCode:CS3492 Subject Name : DBMS
Department of Computer Science and Business Systems
( AN AUTONOMOUS INSTITUTION )
e
n
II / III 139
22
( AN AUTONOMOUS INSTITUTION )
B
:
=
B
+
1
;
W
r
i
t
e
(
B
)
.
T2:read(B);
Read (A);
If B=0 then A:=A+1;
Write (A).
Add lock and unlock instruction to transactions T1 and T2,so that they
observe the two phase locking protocol. Can the execution of these
transactions result in a deadlock?(AP)
(NOV 2016)
UNIT IV
IMPLEMENTATION TECHNIQUES
RAID – File Organization – Organization of Records in Files – Data dictionary Storage –
Column Oriented Storage– Indexing and Hashing –Ordered Indices – B+ tree Index Files –
B tree Index Files – Static Hashing – Dynamic Hashing – Query Processing Overview –
Algorithms for Selection, Sorting and join operations – Query optimization using Heuristics
- Cost Estimation.
PART – A
( AN AUTONOMOUS INSTITUTION )
II / III 140
23
( AN AUTONOMOUS INSTITUTION )
( AN AUTONOMOUS INSTITUTION )
6. What is tape storage?)(U)
Tape storage used for primarily for backup and archival data.
Cheaper, but much slower access, since tape must be read
sequentially from the beginning.
II / III 141
24
( AN AUTONOMOUS INSTITUTION )
Cache
Main memory
Flash memory
Magnetic disk
Optical disk
Magnetic tapes
9. What is NAS?(R)
Network attached storage (NAS) is an alternative to SAN. NAS is
much like SAN, except that instead of the networked storage appearing to be
a large disk, it provides a file system interface using networked file system
protocols such as NFS or CIFS.
( AN AUTONOMOUS INSTITUTION )
12. Define average seek time.(R)
The average seek time is the average of the seek times, measured over a
sequence of random requests.
II / III 142
25
( AN AUTONOMOUS INSTITUTION )
17. What are the factors to be taken into account in choosing a RAID level?(R)
The factors to be taken into account in choosing a RAID level are
( AN AUTONOMOUS INSTITUTION )
21. What is a multitable clustering file organization?(U)
A multitable clustering file organization is a file organization that
stores related records of two or more relations in each block. Such a file
organization allows us to read records that would satisfy the join condition by
143
( AN AUTONOMOUS INSTITUTION )
( AN AUTONOMOUS INSTITUTION )
Indices whose search key specifies an order different from the sequential
order of the file are called nonclustering indices.
II / III 144
27
( AN AUTONOMOUS INSTITUTION )
All files are ordered sequentially on some search key. Such files, with a
clustering index on the search key, are called index-sequential files.
( AN AUTONOMOUS INSTITUTION )
node Set C= node
pointed to by Pm
End End
Else set C= the node pointed to by Pi
II / III 145
28
( AN AUTONOMOUS INSTITUTION )
( AN AUTONOMOUS INSTITUTION )
For each tuple t s in s do begin
Test pair (tr, ts) to see if they
satisfy the join condition If
II / III 146
29
( AN AUTONOMOUS INSTITUTION )
E
n
d
For each
block
Br of r
do
begin
For
each
block
Bs of s
do
begin
For each
tuple tr
in Br
do
begin
For
each
tuple ts
in Bs
do
begin
Test pair (tr, ts) to see if they
SubCode:CS3492 Subject Name : DBMS
Department of Computer Science and Business Systems
( AN AUTONOMOUS INSTITUTION )
satisfy the join condition If
they do, add tr.ts to the result.
E
n
II / III 147
30
( AN AUTONOMOUS INSTITUTION )
E
n
d
E
n
d
E
n
d
( AN AUTONOMOUS INSTITUTION )
Can move records on page without changing rid; so, attractive for
fixed-length records too. Page is full when data space and slot
array meet.
148
( AN AUTONOMOUS INSTITUTION )
16
24
( AN AUTONOMOUS INSTITUTION )
In a hash file organization we obtain the bucket of a record directly
from its search-key value using a hash
II / III 149
32
( AN AUTONOMOUS INSTITUTION )
Dynamic Hashing
Searching any data in a B+ tree is very easy because all data are found in leaf
nodes. In a B tree, data cannot be found in leaf nodes.
B+ trees store redundant search key but B tree has no redundant value.
In a B+ tree, leaf nodes data are ordered as a sequential linked list but in B
tree the leaf node cannot be stored using a linked list. Many database
systems' implementations prefer the structural simplicity of a B+ tree.
57. What is a query execution plan?(Apr/May-2017)
Execution plan will be generated by Query optimizer with the help of statistics
and Algebrizer\processor tree.
It is the result of Query optimizer and tells how to do\perform your
work\requirement.
There are two different execution plans - Estimated and Actual.
Estimated execution plan indicates optimizer view.
( AN AUTONOMOUS INSTITUTION )
Actual execution plan indicates what executed the query and how was it done.
58. Which cost component are used most often as the basis for cost function?
(Apr/May-2017)
(i) Access cost to secondary storage
II / III 150
33
( AN AUTONOMOUS INSTITUTION )
PART B
2. What are the steps involved in query processing? How would you estimate the
cost of the query? (U) (MAY 2007)
9. Explain how the RAID systems improve performance and reliability. (U)(DEC
2007)
10. Describe the structure of B+ tree and list the characteristics of a B+tree.(U)
( AN AUTONOMOUS INSTITUTION )
(DEC 2008), (MAY 2012) (MAY 2010)
(NOV 2014)
II / III 151
34
( AN AUTONOMOUS INSTITUTION )
12. Describe static hashing and dynamic hashing.(U)(DEC 2008). (NOV 2014)
13. Describe in detail about how records are represented in a file and how to
organize them in a file. (AP)(MAY 2012).
14. Explain about spatial and mobile database (U)(NOV 2014)(NOV 2016)
A
D
V
A
N
C
E
D
T
O
P
I
( AN AUTONOMOUS INSTITUTION )
C
S
152
( AN AUTONOMOUS INSTITUTION )
Request(source text)
Terminal from which the operation was invoked
User who invoked the operation
( AN AUTONOMOUS INSTITUTION )
Date and time of the operation
Relvar(s), tuples(s),attribute(s) affected
Before images(old values)
After images(new values)
II / III 153
36
( AN AUTONOMOUS INSTITUTION )
( AN AUTONOMOUS INSTITUTION )
enterprise-local data can be kept locally, where it most logically belongs-
while at the same time remote data can be accessed when necessary.
154
( AN AUTONOMOUS INSTITUTION )
( AN AUTONOMOUS INSTITUTION )
maintain consistency within one environment, in that both the OODBMS
and the programming language will use the same model of representation.
155
( AN AUTONOMOUS INSTITUTION )
( AN AUTONOMOUS INSTITUTION )
Relevancy ranking is the process of sorting the document results so that those
documents which are most likely to be relevant to your query are shown at the
top.
156
( AN AUTONOMOUS INSTITUTION )
( AN AUTONOMOUS INSTITUTION )
term is most often associated with scrambling plaintext (ordinary text,
sometimes referred to as cleartext) into ciphertext (a process called encryption),
then back again (known as decryption).
157
( AN AUTONOMOUS INSTITUTION )
28. Write about the four types (Star, Snowflake, Galaxy and Fast
constellation) of Data warehouse schemas.(DEC2015)(R)
1. STAR SCHEMA:Centralized Fact table connect the one or more denormalized data
3. STAR FLAKE SCHEMA:One or more centralized fact table connect the single
denormolized data
Applications:
Cross-Marketing
SubCode:CS3492 Subject Name : DBMS
Department of Computer Science and Business Systems
( AN AUTONOMOUS INSTITUTION )
Basket Data Analysis
Catalog design
158
( AN AUTONOMOUS INSTITUTION )
PART B
8. Neatly write the K-means algorithm and show the intermediate results in
clustering the below given points into two clusters using K-means algorithm.
P10,0),P21,10),P3:(2,20),P4:(1,15),P5:(1000,2000),P6:(1500,1500),P7:(1
000,1250). (U) (Dec2015)
11. Suppose that you have been hired as a consultant to choose a database system
for your client‗s application .For each of the following applications, state what
type of database system (relational,persistent programming language based
OODB,object relational;do not specify a commercial product)you whould
recommend.Justify your recommendation
12. Trace the results of using the Apriori algorithm on grocery store example to
support threshold s=33.34% and confidence threshold c=60%.Show the candidate
and frequent itemsets foreach database scan.Enumerate all the final frequent
itemsets.Also indicate the association rules that are generated and highlight the
( AN AUTONOMOUS INSTITUTION )
strong ones,sort them by confidence.
Transaction Id Items
T1 HotDogs,Buns,Ketchup
( AN AUTONOMOUS INSTITUTION )
T2 HotDogs,Buns
T3 HotDogs,Coke,Chips
T4 Chips,Coke
T5 Chips,Ketchup
T6 HotDogs,Coke,Chips
( AN AUTONOMOUS INSTITUTION )