GATE Computer ScienceHardGATE CS (PYQ pattern)

An 8-bit ALU computes 0x80 − 0x01 as 0x80 + 0xFE + 1. What are the resulting flags (N, Z, C, V) where C is the adder's carry-out?

  1. A. N = 0, Z = 0, C = 1, V = 1
  2. B. N = 0, Z = 0, C = 0, V = 1
  3. C. N = 1, Z = 0, C = 1, V = 0
  4. D. N = 0, Z = 0, C = 1, V = 0

Correct answer: A. N = 0, Z = 0, C = 1, V = 1

The sum is 0x17F, so the result is 0x7F (N = 0, Z = 0) with carry-out 1 (no borrow, since 0x80 ≥ 0x01 unsigned). Signed: −128 − 1 = −129 does not fit, so V = 1.

More Digital Logic questions

Exams that ask this topic