ProgrammingHardGATE CS · Campus placements
unsigned int v = (unsigned int)(-2); printf("%X", v); What is printed?
- A. FFFFFFFD
- B. FFFFFFFE
- C. 0x2
- 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
- int a[3] = {1, 2, 3}; int p = a; int (q)[3] = &a; printf("%d", (q + 2) + (p + 1)); What is printed?
- unsigned char x = 0; x--; What is x?
- Which statement about the return value of strcmp is true?
- For 4-bit masks (bits 0 to 3), how many masks have both bit 0 and bit 2 set?
- What is the value of (1ULL << 63) >> 62 for uint64t arithmetic?
- uint8t a = 200, b = 250; uint8t avg = (a + b) / 2; What is avg?