GATE Computer ScienceVery hardGATE CS (PYQ pattern)

Which of these 8-bit two's-complement operations overflow as signed arithmetic? I. 0x80 − 0x01. II. 0x00 − 0x80. III. 0x7F + 0x80. IV. 0xC0 + 0xC0.

  1. A. II only
  2. B. I and II only
  3. C. I, II and IV only
  4. D. II and III only

Correct answer: B. I and II only

I: −128 − 1 = −129 < −128, overflow. II: 0 − (−128) = +128 > 127, overflow (the adder computes 0x00 + 0x80 with carry-in, giving 0x80). III: 127 + (−128) = −1, fine. IV: −64 + −64 = −128, exactly representable (0x80), no overflow even though a carry leaves the MSB.

More Computer Organization and Architecture questions

Exams that ask this topic