0% found this document useful (0 votes)
9 views6 pages

Database Management System - Weekly Test 04 - Test Paper

This document is a weekly test for Database Management System focusing on Transaction and Concurrency Control, consisting of multiple-choice and numerical answer questions. It includes questions about properties of transactions, schedules, and serializability. The answer key and hints for solving the questions are also provided.

Uploaded by

Sachin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

Database Management System - Weekly Test 04 - Test Paper

This document is a weekly test for Database Management System focusing on Transaction and Concurrency Control, consisting of multiple-choice and numerical answer questions. It includes questions about properties of transactions, schedules, and serializability. The answer key and hints for solving the questions are also provided.

Uploaded by

Sachin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

1

Branch : CSE & IT Batch : Hinglish


WEEKLY TEST – 04
Subject : Database Management System
Topic : Transaction & Concurrency Control
Maximum Marks 20

Q.1 to 6 Carry ONE Mark Each


[MCQ] [MSQ]
1. The application programmer is responsible to ensure 4. Consider the following schedule using three
which of the following properties? transactions T1, T2 and T3
(a) Atomicity T1 T2 T3
(b) Consistency R(x)
(c) Isolation R(y)
(d) Durability R(y)
W(x)
[MSQ] W(x)
2. Which of the following scenarios may not lead to an R(x)
irrecoverable schedule? W(x)
(a) A transaction performs write on a data item after
it is read by an uncommitted transaction. Then which of the schedule below is not the correct
serialization of the above?
(b) A transaction reads a data item after it is written
by an uncommitted transaction. (a) T2 → T1 → T3 (b) T2 → T3 → T1
(c) T1 → T3 → T2 (d) T3 → T1 → T2
(c) A transaction reads a data item after it is read by
an uncommitted transaction.
[MCQ]
(d) A transaction reads a data item after it is written
by a committed transaction. 5. Choose the correct statement from the following for
schedule S given below:
T1 T2
[MSQ]
R(A)
3. Choose the correct statements from the following.
R(B)
(a) View serializability is a necessary and sufficient W(A)
condition for serializability testing. R(A)
(b) Conflict serializability is sufficient but not W(A)
necessary condition. W(B)
(c) Testing of conflict serializability is a polynomial R(B)
problem. W(B)
(d) All the statements are true. (a) Schedule S is conflict serializable.
(b) Schedule S is view serializable.
(c) Schedule S is not serializable
(d) None of the above.
2

[MCQ] (a) Atomicity (b) Consistency


6. Amongst the ACID properties of a transaction, the (c) Isolation (d) Durability
____ property requires that the changes made to the
database by a successful transaction always persist.

Q.7 to 13 Carry TWO Mark Each

[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

Hints and Solutions

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

Updated read: ___


Final write T2 → T1
There exists cycle in precedence graph therefore it is
not conflict serializable. Thus, for the given schedule no equivalent serial
schedule possibole. Hence, schedule is not serializable.
Now, check for view serializability:
Initial read: T1 → T2

For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4

You might also like