Transaction & Concurrency Control GATE CS PYQ Quiz

Last Updated :
Discuss
Comments

Question 1

Consider the following transactions with data items P and Q initialized to zero:

T1: read (P) ;
read (Q) ;
if P = 0 then Q : = Q + 1 ;
write (Q) ;
T2: read (Q) ;
read (P) ;
if Q = 0 then P : = P + 1 ;
write (P) ;

Any non-serial interleaving of T1 and T2 for concurrent execution leads to

  • A serializable schedule

  • A schedule that is not conflict serializable

  • A conflict serializable schedule

  • A schedule for which a precedence graph cannot be drawn

Question 2

Consider the following schedule for transactions T1, T2 and T3: 

 

Which one of the schedules below is the correct serialization of the above?

  • T1->>T3->>T2

  • T2->>T1->>T3

  • T2->>T3->>T1

  • T3->>T1->>T2

Question 3

Consider two transactions T1 and T2, and four schedules S1, S2, S3, S4 of T1 and T2 as given below:

T1 = R1[X] W1[X] W1[Y]
T2 = R2[X] R2[Y] W2[Y]
S1 = R1[X] R2[X] R2[Y] W1[X] W1[Y] W2[Y]
S2 = R1[X] R2[X] R2[Y] W1[X] W2[Y] W1[Y]
S3 = R1[X] W1[X] R2[X] W1[Y] R2[Y] W2[Y]
S4 = R2[X] R2[Y] R1[X] W1[X] W1[Y] W2[Y]

Which of the above schedules are conflict-serializable?

  • S1 and S2

  • S2 and S3

  • S3 only

  • S4 only

Question 4

Which of the following scenarios may lead to an irrecoverable error in a database system ?

  • A transaction writes a data item after it is read by an uncommitted transaction

  • A transaction reads a data item after it is read by an uncommitted transaction

  • A transaction reads a data item after it is written by a committed transaction

  • A transaction reads a data item after it is written by an uncommitted transaction

Question 5

Consider the following schedule S of transactions T1, T2, T3, T4:

GATECS2014Q29


Which one of the following statements is CORRECT?

  • S is conflict-serializable but not recoverable

  • S is not conflict-serializable but is recoverable

  • S is both conflict-serializable and recoverable

  • S is neither conflict-serializable nor is it recoverable

Question 6

Consider the following partial Schedule S involving two transactions T1 and T2. Only the read and the write operations have been shown. The read operation on data item P is denoted by read(P) and the write operation on data item P is denoted by write(P).

Q39

Suppose that the transaction T1 fails immediately after time instance 9. Which one of the following statements is correct?

  • T2 must be aborted and then both T1 and T2 must be re-started to ensure transaction atomicity

  • Schedule S is non-recoverable and cannot ensure transaction atomicity

  • Only T2 must be aborted and then re-started to ensure transaction atomicity

  • Schedule S is recoverable and can ensure atomicity and nothing else needs to be done

Question 7

Which of the following concurrency control protocols ensure both conflict serializability and freedom from deadlock? I. 2-phase locking II. Time-stamp ordering

  • I only

  • II only

  • Both I and II

  • Neither I nor II

Question 8

Consider the following four schedules due to three transactions (indicated by the subscript) using read and write on a data item x, denoted by r(x) and w(x) respectively. Which one of them is conflict serializable.

GATECS2014Q39

  • A

  • B

  • C

  • D

Question 9

Consider the transactions T1, T2, and T3 and the schedules S1 and S2 given below.

T1: r1(X); r1(Z); w1(X); w1(Z)
T2: r2(Y); r2(Z); w2(Z)
T3: r3(Y); r3(X); w3(Y)
S1: r1(X); r3(Y); r3(X); r2(Y); r2(Z);
w3(Y); w2(Z); r1(Z); w1(X); w1(Z)
S2: r1(X); r3(Y); r2(Y); r3(X); r1(Z);
r2(Z); w3(Y); w1(X); w2(Z); w1(Z)

Which one of the following statements about the schedules is TRUE?

  • Only S1 is conflict-serializable.

  • Only S2 is conflict-serializable.

  • Both S1 and S2 are conflict-serializable.

  • Neither S1 nor S2 is conflict-serializable.

Question 10

Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest.

  1. T1 start
2. T1 B old=12000 new=10000
3. T1 M old=0 new=2000
4. T1 commit
5. T2 start
6. T2 B old=10000 new=10500
7. T2 commit

Suppose the database system crashes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?

  • We must redo log record 6 to set B to 10500

  • We must undo log record 6 to set B to 10000 and then redo log records 2 and 3.

  • We need not redo log records 2 and 3 because transaction T1 has committed.

  • We can apply redo and undo operations in arbitrary order because they are idempotent

There are 31 questions to complete.

Take a part in the ongoing discussion