A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

71. 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. A serializable schedule
b. A schedule that is not conflict serializable
c. A conflict serializable schedule
d. A schedule for which a precedence graph cannot be drawn
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).A schedule that is not conflict serializable

72. Which of the following concurrency control protocols ensure both conflict serialzability and freedom from deadlock? I. 2-phase locking II. Time-stamp ordering
a. I only
b. II only
c. Both I and II
d. Neither I nor II
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).II only

73. 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?
a. Only S1 is conflict-serializable
b. Only S2 is conflict-serializable
c. Both S1 and S2 are conflict-serializable
d. Neither S1 nor S2 is conflict-serializable
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).Only S1 is conflict-serializable

74. 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?
a. We must redo log record 6 to set B to 10500
b. We must undo log record 6 to set B to 10000 and then 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 in arbitrary order because they are idempotent
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).We must undo log record 6 to set B to 10000 and then redo log records 2 and 3

75. Which of the following scenarios may lead to an irrecoverable error in a database system ?
a. A transaction writes a data item after it is read by an uncommitted transaction
b. A transaction reads a data item after it is read by an uncommitted transaction
c. A transaction reads a data item after it is written by a committed transaction
d. A transaction reads a data item after it is written by an uncommitted transaction
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).A transaction reads a data item after it is written by an uncommitted transaction

76. Consider the following transaction involving two bank accounts x and y.

read(x); x := x – 50; write(x); read(y); y := y + 50; write(y)

The constraint that the sum of the accounts x and y should remain constant is that of
a. Atomicity
b. Consistency
c. Isolation
d. Durability
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).Consistency

77. Consider a simple checkpointing protocol and the following set of operations in the log.

(start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7);
(checkpoint);
(start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3); (write, T3, z, 7, 2);

If a crash happens now and the system tries to recover using both undo and redo operations, what are the contents of the undo list and the redo list
a. Undo: T3, T1; Redo: T2
b. Undo: T3, T1; Redo: T2, T4
c. Undo: none; Redo: T2, T4, T3; T1
d. Undo: T3, T1, T4; Redo: T2
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).Undo: T3, T1; Redo: T2

78. Which level of locking provides the highest degree of concurrency in a relational data base?
a. Page
b. Table
c. Row
d. Page, table and row level locking allow the same degree of concurrency
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).Row

79. Which one of the following is NOT a part of the ACID properties of database transactions?
a. Atomicity
b. Consistency
c. Isolation
d. Deadlock-freedom
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).Deadlock-freedom

80. Consider the following two phase locking protocol. Suppose a transaction T accesses (for read or write operations), a certain set of objects {O1,...,Ok}. This is done in the following manner: Step 1. T acquires exclusive locks to O1, . . . , Ok in increasing order of their addresses. Step 2. The required operations are performed. Step 3. All locks are released. This protocol will
a. guarantee serializability and deadlock-freedom
b. guarantee neither serializability nor deadlock-freedom
c. guarantee serializability but not deadlock-freedom
d. guarantee deadlock-freedom but not serializability
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).guarantee serializability and deadlock-freedom

Page 8 of 10