ProgrammingHardTCS NQT · Infosys

unsigned int x = 1u; x = ~x; What is x?

  1. A. 0
  2. B. -2
  3. C. 1
  4. D. 4294967294

Correct answer: D. 4294967294

~1u is all bits set except bit 0, which for a 32-bit unsigned int is 4294967294. Unsigned NOT never produces a negative value.

More C Programming questions

Exams that ask this topic