Database Management System - Weekly Test 04 - Test Paper
Database Management System - Weekly Test 04 - Test Paper
[NAT] [MCQ]
7. Consider given two schedules: 11. Consider the following schedule:
S1: r1(x) r1(y) r2(x) r2(y) w2(y) w1(x) S: r1(A) r2(B) r3(C) r1(B), r2(C), r3(A)
S2: r1(x), r2(x), r2(y) w2(y) r1(y) w1(x). w1(A) w2(B) w3(C)
The number of schedules that is/are conflict Choose the correct statements for the above schedule
serializable are? S.
(a) S is conflict serializable as T1 → T2 → T3.
[NAT] (b) There exist 30 conflict equal serial schedules for
S.
8. Consider the given transactions:
(c) S is not conflict serializable schedule.
T1: w3(A) w3(B)
(d) None of these.
T2: r2(A) r2(B)
T3: r1(A) w1(A) r1(B) w1(B)
The number of concurrent schedules between T1, T2 [NAT]
and T3 is / are ______that are non-serial. 12. Consider given schedule:
S: r1(x), r2(y), w3(y), r4(x), w4(z), w3(y)
[NAT] How many conflict serializable schedules exists for the
9. How many view equivalent serial schedules are above schedule S?
possible for the below schedule:
S: w1(A) r2(A) w3(A) r4(A) w5(A) [MSQ]
13. Consider the given schedule S as follows:
[NAT] S: r1(x) w2(x) w1(x), commit 2, commit 1.
10. Consider the following schedule: Choose the correct statements regarding above.
S: r1(x) w1(y) r2(x) w2(y) r3(x) w3(y) (a) S is a recoverable schedule.
The number of conflict equivalent schedules (b) S is conflict serializable.
is/are______.
(c) S is view serializable.
(d) S is not serializable.
3
Answer Key
1. (b) 8. (414)
2. (a, c, d) 9. (2)
3. (a, b, c, d) 10. (15)
4. (a, b, d) 11. (c)
5. (c) 12. (12)
6. (d) 13. (a, d)
7. (1)
4
1. (b) 6. (d)
The application programmer or user is responsible to Durability property requires that the changes made to
ensure the consistency property for any transaction. the database by a successful transaction should always
Atomicity and Durability are ensured by the recovery persist, even if there is a failure of any blind.
management component of DBMS software. While
isolation is taken care by the concurrency controller of
7. (1)
DBMD software.
Precedence graph for S1:
2. (a, c, d)
A transaction is said to be irrecoverable if it reads a data
item after that data item is written by an uncommitted
transaction. Cycle in precedence graph
not conflict serializable.
3. (a, b, c, d) Precedence graph for S2:
Conflict serializability is a sufficient but not necessary
condition views serializability is both necessary and
No cycle in precedence graph
sufficient testing of conflict serializability is dense in
polynomial time. S2 is serializable as T2 → T1.
Between S1 and S2 only S2 is conflict serializable.
4. (a, b, d)
Checking for conflict serializability using precedence 8. (414)
graph (n + m + k)!
Number of concurrent schedules =
n!m!k!
Where n, m, and R are operations in transactions T1, T2,
and T3 respectively.
n = 2, m = 2, k = 4
Conflict serial schedule = T1 → T3 → T2 (n + m + k)! 8!
=
n!m!k! 2!2!4!
5. (c) 4 3
8 7 6 5 4 !
=
If we check for precedence graph of S: 4 ! 2 2
= 20 × 21
= 420
There exists cycle in precedence graph hence it is not Number of non-serial schedules = 420 – 3!
conflict serializable.
420 – 6 = 414
Also need to check for no blind write present, therefore
no view serializable.
The schedule S is not serializable.
5
9. (2)
T1 T2 T3 T4 T5
w(A)
r(A)
w(A) The schedule S is not conflict serializable.
r(A)
w(A) 12. (12)
Initial read: ____ T1 T2 T3 T4
Updated read: T1 → T2 and T3 → T4 r(x)
Final write: T5 r(y)
• The view equal serial schedule will have T5 fixed at
w(y)
the end
_ _ _ _ _ T5 r(x)
• Also, T1 → T2 and T3 → T4 is also fixed to preserve w(z)
updated read property w(y)
However, T1 → T2 and T3 → T4 can be arranged in
2 ways
Checking for the precedence graph.
• The view equal serial schedules will be:
T1 → T2 → T3 → T4 → T5
T3 → T4 → T1 → T2 → T5
10. (15)
There exists conflict for all the write operations, so That means only constraint is T2 should execute before
their order cannot be changed. T3 while T1 and T4 can execute in any order.
Read operations have no conflict.
_____ w1(y) _____ w2(y) _____ w3(y) (T2 → T3)
read on x by T1 will be left of w1(y) so, _____T2 _____T3 _____.
_____r1 _____w1(y) _____w2(y) _____w3(y) Both T1 and T4 can be in any of the 3 places. Therefore
Now r2 can go to any of the 3 places left of w2(y), so. 3!
_____r1 _____w1 _____r2 _____w2 _____w3
Now r3 can go to any of the 5 places left of w3(y). so, Also T1 and T4 execute any order therefore 2!. So, total
total conflict equivalent. conflict serializable schedule 3! × 2! = 12.
Schedule 3 × 5 = 15.
13. (a, d)
11. (c)
T1 T2
T1 T2 T3
r(A) r(x)
r(B) w2(x)
r(C) w1(x)
r(B) commit
r(C)
commit
r(A)
w(A) There exists no dirty read, therefore the schedule S is
w(B) recoverable schedule
w(C)
6
For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if