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

20152025

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

  1. A.

    Atomicity

  2. B.

    Consistency

  3. C.

    Isolation

  4. D.

    Durability

Attempted by 628 students.

Show answer & explanation

Correct answer: B

Answer: Consistency

Why: Consistency is the ACID property that requires transactions to preserve database integrity constraints. The requirement that the sum of accounts x and y remains constant is an integrity constraint, so ensuring this constraint holds before and after the transaction is a consistency concern.

  • The given transaction subtracts 50 from x and adds 50 to y, so if x + y was constant before execution, it remains constant after (x - 50) + (y + 50) = x + y.

  • Related ACID roles: atomicity ensures the transfer isn't partially applied; isolation handles concurrent interactions; durability ensures committed changes persist — but the invariant itself is a consistency requirement.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir