Transactions and Concurrency Control
Transactions and Concurrency Control
Transactions and Concurrency Control
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
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?
5. Consider the 2 transactions T1 and T2 and four schedules S1, S2, S3 and S4 of T1 and T2 are
given below:
1
Which of the following schedules are conflict serializable?
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?
T3 T4 T7
R(Q)
W(Q)
W(Q) R(Q)
W(Q)
The labeled precedence graph will be:
2
9. In case of time stamp ordering R-timestamp (Q) denotes:
(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
3
(d) None of the above
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
4
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?
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?
5
(a) we must redo log record 6 to set B to 10,500
(b) we must redo log record 6 to set B to 10,000 and redo log records 2 and 3
(c) we need not redo log records 2 and 3 because transaction T1 has committed
(d) we can apply redo and undo operations arbitrarily because they are idempotent
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)
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
6
Which of the following are correct statements?
(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
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.