SE3060 - Database Systems
SE3060 - Database Systems
SE3060 - Database Systems
Final Examination
Year 3, Semester 2 (2023)
Duration: 2 hours
EE
November 2023
Instructions to Candidates:
(a) List the properties ofa transaction. Briefly explain each of them.
(4 marks)
(b) Compare why serializable schedules are more important for database systems than the
serial schedule.
(3 marks)
(c) "The strict Two-Phase Locking (S2PL) protocol significantly reduces the occunence of
cascading aborts and unrecoverable schedules, enhancing concurrency control in
database systems". Do you agree with this? Provide reasonable justiflcation for your
decision.
(4 marks)
'`~
(d) Consider the following part of the transaction schedule.
T1 T2 T3 T4
SA
RA
S(C)
R(C)
X(C)wait
X®)
W)
X@)wait
XWD
X@)wait
X(A)wait
Assume that Transaction Ti is higher priority than transaction T,+I(i.e. transaction T| has
higherprioritythanT2;T2hashigherprioritythanT3;andT3hashigherprioritythanT4).
Review the provided transaction schedule and analyse the reasons for the delay in
completing these transactions. Assume that the strict two-phase locking protocol
has been used to enable concurrency.
(3 marks)
Draw a Wait-For-Graph for the given schedule and check for deadlock.
(2 marks)
Draw the schedule again considering deadlock prevention algorithm: Wound-wait
approach.
(4 marks)
Page 2 of 6
::::)lJf3ri6
EE
Describe the steps involved in executing each of the following operations according to
the Sj.mp/e Tree I ocAz.ng cz/gorz.r¢m, in tens of the order in which nodes are locked,
unlocked, read and written. Be specific about what type of locks are obtained and
released. .
i. Search23.
ii. Delete43.
iii. Insert44.
(5 marks)
(a) Briefly explain three file organization techniques used in database systems to store and
manage data efficiently.
(4' marks)
`-
(b) Given that indexes can speed up queries, why don't we just create as many indexes as
we like?
(3 marks)
root
Page 3 of 6
00576
Illustrate the 8+ tree after deleting 32. Consider left sibling for redistribution of data
entries.
(5 marks)
(e) Construct an Extendible Hashed File for the following.marks received by a group of
students in a course. The hashing function will consider the last 2 digits of the binary
representation.
marks
(5 marks)
(I) Provide three reasons to justify why most commercial databases support 8+ tree
indexes.
(5 marks)
EE
uestion 3 - Query Optimization 25 marks
(a) What is the justification for using I/0 costs as the main measure to compare different
algorithms for evaluating relational operators?
(2 marks)
On this table, there is a c/#s/ered a+ tree index on ez.d and an "#c/#s/ered a+ tree index
On age . EE'
i. The data records are stored in a heap file. In what order' are the data records of Emp
table stored and why?
(2 marks)
If 95% of tuples satisfy the selection condition, what would be the best access path
for processing this query? Justify your answer.
(5 marks)
Page 4 of 6
•r!J#F;n6
(d) Therelation Emp (eid: integer, ename:string, age: integer, salary: float)
contains 4,000 pages. There are 10 buffer pages. The attribute ez.d takes up 10 bytes,
e#ame 20 bytes, clge 2 bytes and sc!/crry 8 bytes. A clustered 8+ tree on <age, salary>
is the only index available. In estimating the cost of query plans, ignore the cost of
whting the final result.
(a) Discuss two real world exanples where NoSQL databases can be applied.
(5 marks)
a) Consider the following structure of books collection and whte answers for the following
questions.
`~
book id : ``8001'' ,
titl= : "MongoDB: The Definitive Guide" ,
author : ``Kristina Chodorow"
pages : 432 ,
langruage : ``English" ,
year : 2013 ,
publisher : {
name : ``O'Reilly Media'' ,
founded : 1980
location : ``CA"
i. Write a MongoDB query to display the fields boot id, /j.//e, cr24/¢or and};ea;. for all
the documents in the books collection.
(2 marks)
Page 5 of 6
005r`',7t:,
ii. Write a MongoDB query to display all the books which are published in the English
language.
(2 marks)
iii. Write a MongoDB query to find the books that have pages, more than 100 but less
than 500.
(2 marks)
iv. Write a MongoDB update statement to change the publication year of the book with
`book id' `8001' from 2013 to 2015.
(4 marks)
EE
Page 6 of 6