GATE Computer ScienceModerateGATE CS (PYQ pattern)

A 4-bit two's complement adder computes A + B + Cin. Over all 512 combinations of A, B (each −8 to 7) and Cin (0 or 1), for how many is the signed overflow flag V set?

  1. A. 128
  2. B. 112
  3. C. 64
  4. D. 120

Correct answer: A. 128

Positive overflow: A + B + Cin ≥ 8 with A, B in 0..7: for Cin = 0 there are 28 pairs with A + B ≥ 8, for Cin = 1 there are 36 with A + B ≥ 7. Negative overflow: A + B + Cin ≤ −9: Cin = 0 gives 36 pairs with A + B ≤ −9, Cin = 1 gives 28 with A + B ≤ −10. Total 28 + 36 + 36 + 28 = 128.

More Digital Logic questions

Exams that ask this topic