ProgrammingModerate

What value is -x when x is 7 in two's complement, expressed as ~x + 1?

  1. A. -8
  2. B. 14
  3. C. -6
  4. D. -7

Correct answer: D. -7

Two's complement negation flips every bit and adds 1: ~7 is -8, so ~7 + 1 = -7. The tempting -8 stops after the bit flip, which is always one less than the true negative.

More C Programming questions

Exams that ask this topic