ProgrammingHardGATE CS · Campus placements

unsigned int v = (unsigned int)(-2); printf("%X", v); What is printed?

  1. A. FFFFFFFD
  2. B. FFFFFFFE
  3. C. 0x2
  4. D. -2

Correct answer: B. FFFFFFFE

Converting -2 to unsigned int adds 2^32, giving 0xFFFFFFFE. The %X format prints the hexadecimal digits without the 0x prefix.

More C Programming questions

Exams that ask this topic