You are on page 1of 3

Final Exam for CSci5708 Spring 2002

Due: In 120 minutes


Course: Csci5708, Spring 2002
Instructions:
1. There are five questions in this paper.
2. Please use the blue book provided to write the answers. Show the reasoning behind the answers.
The process of arriving at answers carries as much weight as the correctness of answers.
3. Budget your time to answer various questions to avoid spending too much time on a particular
question.
4. It is an open book and open notes examination. You may need to consult the book and notes for
some question. However, sharing of books and notes across students is not allowed.

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:

Employee(SSN, Name, Salary, Supperssn, Dno)


Works_on(ESSN, Pno, Hours)
Project(Pno, Pname, Dno)
SSN is the primary key for Employee, ESSN and Pno together are the primary key for Works_on and Pno
is the primary key for Project.

2a. (10 points) Write SQL statements for granting following privileges to account A, B and C.

 User A is a supervisor of department number(Dno) 5. User X gives permission to user A to select


SSN, Name of employees in his/her department.

 User X gives permission to user B to select and update Works_on.Hours and propagate these to other
users.

 User B gives permission to user C to select and update X.Works_on.Hours.

 User X revokes all privileges from user B on Works_on.

 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.

Transaction T1: R1(Y), R1(Z), W1(Y), W1(Z)


Transaction T2: R2(Z), R2(Y), W2(Y), R2(X), W2(X)
Transaction T3: R3(X), W3(X), R3(Y), W3(Y)

Consider 3 different schedules, namely, S1, S2 and S3:


S1:R1(Y),R1(Z),R3(X),W3(X),W1(Y),W1(Z),R2(Z),R3(Y),W3(Y),R2(Y), W2(Y),R2(X),W2(X)
S2:R1(Y),R1(Z),W1(Y),W1(Z),R3(X),W3(X),R3(Y),W3(Y),R2(Z), R2(Y),W2(Y),R2(X),W2(X)
S3:R1(Y),R1(Z),R3(X),W3(X),W1(Y),W1(Z),R2(Z),R2(Y),W2(Y),R3(Y), R2(X),W3(Y),W2(X)

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}

4a. (4 points) Compute supports for itemsets {A}, {C,D}, {A,C,D}

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.

Q5. Consider following relational schemas:

Dimension tables : Customer(Custid, Custname, Zipcode)


Product(Prodid, Prodname, Price, Color)
Fact table : Fact(Custid, Prodid, Sale)

5a. (7 points) Write SQL expressions for the following queries.


 Compute CUBE of fact table.
 List total sales of products for each color.
 List total sales for Red colored products in Zipcode 55455.

5b. (6 points) What is a bit-map index? Which of the above queries will benefit from a bit-map index?
Justify your answer.

You might also like