Professional Documents
Culture Documents
Q1. Consider the following schedule consisting of four transactions T1, T2, T3, T4.
[CHECKPOINT]
start(T1)
read_item(T1, A)
T1 : A=A+3
write_item(T1,A)
commit(T1)
[CHECKPOINT]
start(T2)
read_item(T2)
T2: A=A+2
write_item(T2,A)
start(T3)
read_item(T3,B)
T3: B=B+4
write_item(T3,B)
start(T4)
read_item(T4,B)
T4: B=B+3
write_item(T4,B)
commit(T2)
read_item(T3,A)
[SYSTEM CRASH]
read_item(Ti, X) represents that transaction Ti reads item X. write_item(Ti, X) states that transaction Ti
writes item X. Ti: Op states that transaction Ti performs operation O. Assume that the initial value of A is 1
and B is 0.
1a) (7 points) Consider a system with deferred update and redo logs. List log entries created before the
system crashes? Which transactions are undone during recovery? Which transactions are redone? Is there
any cascaded rollback?
1b) (7 points) Consider a system with immediate update and undo/redo log. List log entries created before
the system crashes? Which transactions are undone during recovery? Which transactions are redone? Is
there any cascaded rollback?
1c) (5 points) What is two phase commit protocol? Why are two phases needed in a distributed
environment ?
Q2. Consider the following relational schema created by user X:
2a. (10 points) Write SQL statements for granting following privileges to account A, B and C.
User X gives permission to user B to select and update Works_on.Hours and propagate these to other
users.
User X gives permission to user A to view the total number of hours each employee has worked. Note
that user A doesn’t have permission to view Project attributes, e.g. Pno, Pname, etc.
2b. (3 points) Can user C still select and update X.Works_on.Hours ? Why ?
2c. (5 points) What is a mandatory security mechanism? List a security problem solved by a mandatory
security mechanism.
Q3. Let Wi(j) be a write operation by Transaction Ti on item j in the database. Let Ri(j) denote a read
operation by Transaction Ti on item j in the database. Consider a database with items X, Y, Z and
transactions T1, T2, and T3.
3a) (6 points) Draw conflict graphs and state if S1, S2 and S3 are conflict-serializable.
3b) (8 points) Determine if S1, S2 and S3 are consistent with TIME-STAMP ORDERING based
concurrency control. Justify your answer. (To save time you may work with the edges of conflict schedule
graph rather than history of time-stamps for data-items.)
3c) (8 points) Determine if S1, S2 and S3 are consistent with BASIC 2-phase locking based concurrency
control. Justify your answer.
3d) (8 points) Define the phantom problem. Create an example schedule and transaction to illustrate it.
Does 2-phase locking prevent phantom problem? Justify your answer.
Q4. Consider the following customer transactions over items A, B, C, D and E:
T1: {A,B,C,D}
T2: {C,D}
T3: {A,C,D}
T4: {E}
T5: {A,D,B}
T6: {A,D}
T7: {A,E,D}
T8: {C}
4b. (4 points) Compute confidences for the association rules CD-> A and A->CD
4c. (4 points) Is confidence a symmetric measure? What about support ? (A measure f for rule LHS->RHS
is symmetric if f(LHS->RHS)=f(RHS->LHS).)
4d. (8 points) Suppose we apply the Apriori algorithm on above data set. Let the minimum support
threshold be equal to 30%. How many size-2 candidate itemsets will be generated for frequent size-1
subsets ? How many size-2 frequent itemsets are there? List the frequent itemsets.
5b. (6 points) What is a bit-map index? Which of the above queries will benefit from a bit-map index?
Justify your answer.