ProgrammingModerateTCS NQT · Infosys

What is ~0u / 2 + 1 for a 32-bit unsigned int?

  1. A. 2147483647
  2. B. 2147483648
  3. C. 4294967295
  4. D. 2147483649

Correct answer: B. 2147483648

~0u is 4294967295, and halving gives 2147483647. Adding one yields 2147483648, the midpoint of the unsigned range.

More C Programming questions

Exams that ask this topic