ProgrammingVery hardGATE CS · Campus placements

uint32_t x = 0x12345678u; the 32-bit left rotation by 8 bits, written as (x << 8) | (x >> 24), gives what value?

  1. A. 0x34567812
  2. B. 0x78123456
  3. C. 0x12345678
  4. D. 0x56781234

Correct answer: A. 0x34567812

Rotating left by 8 moves the top byte 0x12 to the bottom, giving 0x34567812. The shift form is only defined for counts 1 to 31, so a rotation of 0 must be handled separately.

More C Programming questions

Exams that ask this topic