Transaction & Concurrency Control - DPP 02 (Of Lec 06)
Transaction & Concurrency Control - DPP 02 (Of Lec 06)
[MCQ] [MCQ]
1. Consider the following schedule S of transaction T1, T2 4. Consider the following transactions T1 and T2:
and T3. T1 T2
S: r1(x); r2(x); r3(y); w1(x); r2(z); r2(y); w2(y); w1(z); Read(A); Read(A);
Which one of the schedule below is the correct Update A = A + 100;
serialization of the above. Update A = A – 50;
(a) T2 T1 T3 Write(A);
(b) T3 T2 T1 Write(A);
(c) T3 T1 T2 The above transaction has _____.
(d) T2 T3 T1 (a) Lost update problem
(b) Dirty read problem
(c) Unrepeatable read problem
[MCQ]
(d) Incorrect summary problem
2. Consider the transactions T1, T2 and T3 and the
schedules S1 and S2 given below.
[MCQ]
T1: r1(A); r1(C); w1(A); w1(C)
5. Consider the following schedule.
T2: r2(B); r2(C); w2(C) Time T1 T2
T3: r3(B); r3(A); w3(B) t0 Read Item(A);
S1: r1(A); r3(B); r3(A); r2(B); r2(C); w3(B); w2(C); t1 Read Item(A);
r1(C); w1(A); w1(C) t2 A = A + X;
S2: r1(A); r3(B); r2(B); r3(A); r1(C); r2(C); w3(B); t3 Write Item(A);
w1(A); w2(C); w1(C) t4 Read Item(A);
Which one of the following statements about the
Which of the following concurrency problem exists in
schedule is TRUE?
the above given schedule?
(a) Only S1 is conflict serializable. (a) Dirty read (b) Unrepeatable read
(b) Only S2 is conflict serializable. (c) Lost update (d) Both a and b
(c) Both S1 and S2 are conflict serializable.
(d) Neither S1 nor S2 is conflict serializable. [MCQ]
6. ______Problem occurs when a transaction reads data
from a database, then another transaction reads the
[MCQ] same database data, and this particular data is deleted
3. Which of the following schedule is view serializable by an operation of the first transaction.
but not conflict serializable. (a) Dirty read
(a) r1(P); r2(P); w1(P); r2(Q) (b) Unrepeatable read problem
(b) r1(P); w1(P); r2(P); w2(Q) (c) Phantom read
(c) w1(P); w2(P); w1(P); w2(P); w1(P) (d) Lost update problem
(d) None of these.
2
Answer Key
1. (b) 6. (c)
2. (a) 7. (b)
3. (c) 8. (b)
4. (a) 9. (b, c)
5. (b)
4
From precedence graph, the correct serialization order We check for order of read in view serializability. In
is T3 T2 T1 order T2 T1, the schedule is view serializable.
4. (a)
2. (a)
The Transaction T1 first reads data A from the database
S1: r1(A); r3(B); r3(A); r2(B); r2(C); w3(B); w2(C); then transaction T2 reads the same data from the
r1(C); w1(A); w1(C) database. Then T1 Performs an operation to add 100 to
A. Then transaction T2 Performs an operation to
subtract 50 from the data read by T2. i.e., A. T1
performs a write operation to save the value of A
according to changes made to T1. Then T2 performs a
write operation to update the value of A again in the
As there is no cycle is precedence graph DB. This situation causes changes to A made by T1 to
be lost because T2 overwrites A again after T1 update
S1 is conflict serializable. A. you could also say that the update of T1 is lost.
S2: r1(A); r3(B); r2(B); r3(A); r1(C); r2(C); w3(B); Hence a is correct option.
w1(A); w2(C); w1(C)
5. (b)
In above schedule, T1 reads value of A and then again
reads the value of A. The Ist value of A is different from
other value in 2nd read.
Hence this is called unrepeatable read.
There exists a cycle hence it is not conflict serializable.
Hence, S1 is conflict serializable but S2 is not conflict 6. (c)
serializable. The phantom read problem arises when a transaction
reads a variable once but when it tries to read the same
variable again which was already deleted by other
3. (c) transaction, this problem known as phantom read
A : False problem.
Conflict serial schedule T1 T2 T3 T4 Cycle in the precedence graph, therefore not conflict
serializable.
9. (b, c)
For checking conflict serializability we make use of
precedence graph. For checking view serializability we
check for 3 conditions.
1. Initial read
2. Updated read
8. (b) 3. Final write
If a schedule is not conflict serializable and there exists
no blind write then we can conclude the schedule is not
view serializable too.
Precedence graph.