Dbms S2
Dbms S2
Solutions
1. What are the potential problems when a DBMS executes multiple transactions concurrently?
(a) log with deferred modification (b) log with immediate modification
(c) shadow paging (d) All of the above
Solution: Option(d)
Atomic instructions are those instructions in transaction that denote that either the
effect of the whole transaction will be there or no effect will be there.
3. Assume transaction A holds a shared lock R. If transaction B also requests for a shared lock on
R, it will:
4. Consider the following schedules involving 2 transactions which one of the following
statements are true?
1
(c) S1 is not conflict serializable and S2 is conflict serializable
(d) Both S1 and S2 are not conflict serializable
5. Consider the 2 transactions T1 and T2 and four schedules S1, S2, S3 and S4 of T1 and T2 are
given below:
6. Which of the following scenarios may lead to an irrecoverable error in database system?
7. Which of the following concurrency control protocol ensures both conflict serializability
and freedom from deadlock?
2
(i) 2 phase locking
(ii) time stamp ordering
T3 T4 T7
R(Q)
W(Q)
W(Q) R(Q)
W(Q)
3
Solution: Option (b)
Refer the videos, for finding precedence graph.
(a) the largest timestamp of any transaction that execute read(Q) successfully
(b) the average timestamp of any transaction that execute read(Q) successfully
(c) the average time stamp of any transaction that execute read(Q) unsuccessfully
(d) the smallest timestamp of any transaction that execute read(Q) successfully
4
shrinking phase (2nd phase).
T2
T1 T3 T4
Read(X)
Write(X)
Commit
Write(X)
Commit
Write(Y)
Read(Z)
Commit
Read(X)
Read(Y)
Commit
Read (X)
Read (Y)
Commit
5
14. Consider the following transactions with data items P and Q initialized to ‘0’
15. Consider the following schedules for transaction T1, T2, T3:
S1: R1(X); R2(Y); R3(Y); W2(Y); W1(X); W3(X); R2(X); W2(X)
Which one of the above schedules below is the correct serialization of the above?
6
16. Consider the following log sequence of 2 transactions on a bank account, with initial balance
12,000; that transfer 2000 to a mortgage payment, then apply 5% interest.
1. T1 start
2. T1 Bold= 1200, new= 10,000
3. T1 Mold=0, new= 2000
4. T1 commit
5. T1 start
6. T2 Bold= 10,000, new= 10,500
7. T2 commit
Suppose the database system crashes just before log record is written. When the system is
started which one statement is true for recovery procedure?
As it is given that the transaction is already committed, the changes are already
made. Now, since the changes are made, they are permanent so we do need to
restore them as the failure has no effect on the transaction. We need not redo log
records 2 and 3 because T1 has committed.
17. When a deadlock occurs the performance of the system degrades i.e. throughput decreases.
In order to increase the through, which of the following may help to the programmer?
(a) (i), (ii) and (iii) (b) (ii), (iii) and (iv)
(c) (i), (ii) and (iv) (d) (i), (ii), (iii) and (iv)
7
18. There are 2 transactions T1 and T2. T1 has 5 transactions and T2 has 3 transactions. Find the
number of concurrent schedules for the given 2 transactions.
(a) 15 (b) 25
(c) 44 (d) 56
19. 2PL generates serializability, but it does not prevent deadlocks. 2PL has 2 phases: growing
and shrinking. Which of the following rules are used to govern the 2PL protocol?
X, Y, Z
(i) It is possible for different transactions to hold locks on the same data item in x and z node at
the same time.
(ii) It is possible for more than one transaction to hold lock on same database element in 3
8
mode, at the same time another transaction holds a lock on the same element in mode y.
(iii)It is possible for different transactions to hold locks on the same element in all 3 lock
modes at the same time.