Transactions and concurrency control

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

Let us assume that transaction T1 has arrived before transaction T2. Consider the schedule

S=r1(A); r2(B) ; w2(A); w1(B) 

Which of the following is true?

  • Allowed under basic timestamp protocol.

  • Not allowed under basic timestamp protocols because T1 is rolled back

  • Not allowed under basic timestamp protocols because T2 is rolled back

  • None of these

Question 4

Which of the following concurrency control protocol ensures both conflict serializability and free from deadlock?

  • Time stamp ordering

  • 2 Phase locking

  • Both (a) and (b)

  • None of the above

Question 5

Which one of these is characteristic of RAID 5?

  • Dedicated parity

  • Double parity

  • Hamming code parity

  • Distributed parity

Question 6

Consider following schedules involving two transactions: S1 : r1(X); r1(Y); r2(X); r2(Y); w2(Y); w1(X) S2 : r1(X); r2(X); r2(Y); w2(Y); r1(Y); w1(X) Which of the following statement is true?
  • Both S1 and S2 are conflict serializable.
  • S1 is conflict serializable and S2 is not conflict serializable.
  • S1 is not conflict serializable and S2 is conflict serializable.
  • Both S1 and S2 are not conflict serializable.

Question 7

Consider the following relation:
Works (emp_name, company_name, salary)
Here, emp_name is primary key. Consider the following SQL query
Select emp_name
From works T
where salary > (select avg (salary)
                from works S
                where T.company _ name = S.company _ name)
The above query is for following :
  • Find the highest paid employee who earns more than the average salary of all employees of his company.
  • Find the highest paid employee who earns more than the average salary of all the employees of all the companies.
  • Find all employees who earn more than the average salary of all employees of all the companies.
  • Find all employees who earn more than the average salary of all employees of their company.

Question 8

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=1200 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.

Question 9

Consider the table R with attributes A, B and C. The functional dependencies that hold on R are : A → B, C → AB. Which of the following statements is/are True ? I. The decomposition of R into R1(C, A) and R2(A, B) is lossless. II. The decomposition of R into R1(A, B) and R2(B, C) is lossy.

  • Only I
  • Only II
  • Both I and II
  • Neither I nor II

Question 10

Which of the following concurrency protocol ensures both conflict serializability and freedom from deadlock?

(a) z - Phase Locking
(b) Time Stamp Ordering

  • Both (a) and (b)

  • (a) only

  • (b) only

  • Neither (a) nor (b)

There are 48 questions to complete.

Take a part in the ongoing discussion