ProgrammingModerateTCS NQT · Infosys

uint32_t t = 2000000000u + 2000000000u; What is t?

  1. A. 4000000000
  2. B. -294967296
  3. C. 3705032704
  4. D. 0

Correct answer: A. 4000000000

The sum 4000000000 is below 2^32 = 4294967296, so no wraparound occurs. A signed 32-bit int would have overflowed here, which is why the unsigned type matters.

More C Programming questions

Exams that ask this topic