GateAI
Transactions and Concurrency Control

GATE CSE 2012 · Q27

MCQ2 marksMedium

Time

Consider the following transactions with data items PP and QQ initialized to zero: T1T_1 : read (P);read (Q);if P = 0 then Q := Q + 1 ;write (Q). T2T_2 : read (Q);read (P);if Q = 0 then P := P + 1 ;write (P). Any non-serial interleaving of T1T_1 and T2T_2 for concurrent execution leads to

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: B) a schedule that is not conflict serializable

Transactions and Concurrency Control

Let us analyze the read and write operations of transactions T1T_1 and T2T_2:

  • T1T_1: R1(P)R_1(P), R1(Q)R_1(Q), W1(Q)W_1(Q)

  • T2T_2: R2(Q)R_2(Q), R2(P)R_2(P), W2(P)W_2(P)

Conflicting pairs between T1T_1 and T2T_2 are:

  1. On item $Q$: $R_2(Q)$ and $W_1(Q)$, $W_1(Q)$ and $R_2(Q)$

  2. On item $P$: $R_1(P)$ and $W_2(P)$, $W_2(P)$ and $R_1(P)$

In any non-serial interleaving:

  • T1T_1 reads PP before T2T_2 writes PP, creating a dependency edge T1→T2T_1 \to T_2.

  • Simultaneously, T2T_2 reads QQ before T1T_1 writes QQ, creating a dependency edge T2→T1T_2 \to T_1.

Because the precedence (serialization) graph contains a cycle (T1→T2T_1 \to T_2 and T2→T1T_2 \to T_1), the resulting schedule is not conflict serializable.

Therefore, option (B) is the correct choice.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Transactions and Concurrency Control previous year question is Q27 of the GATE CSE 2012 paper. Find more GATE CSE PYQs on Transactions and Concurrency Control in Databases, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Transactions and Concurrency Control PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Transactions and Concurrency Control in GATE CSE

Transactions and Concurrency Control has 25 GATE CSE PYQs across 20 papers from 2012 to 2026. 12 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2012.

How GATE tests Transactions and Concurrency Control

More from GATE CSE 2012

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2012 · Q27 · MCQ

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

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.