ProgrammingVery hardGATE CS · Campus placements

uint32_t x = 0x80000001u; x = (x << 1) | (x >> 31); What is x?

  1. A. 0x00000003
  2. B. 0x00000002
  3. C. 0x80000001
  4. D. 0x00000001

Correct answer: A. 0x00000003

Shifting left drops the top bit and leaves 0x00000002. Shifting right by 31 brings that top bit back as bit 0, so the result is 0x00000003, a left rotation by one bit.

More C Programming questions

Exams that ask this topic