ProgrammingModerateGATE CS · Campus placements

uint8_t x = 0xB4; What is the lowest set bit of x, computed as x & (uint8_t)-x?

  1. A. 0x80
  2. B. 0xB0
  3. C. 0x08
  4. D. 0x04

Correct answer: D. 0x04

0xB4 = 1011 0100, and its lowest set bit is 0x04. The cast of -x wraps to 0x4C, and ANDing that with 0xB4 keeps only 0x04.

More C Programming questions

Exams that ask this topic