ProgrammingVery hardCompetitive coding (CP)

What is printed?

What is printed?
#include <stdint.h>
#include <stdio.h>
int main(void) {
    uint8_t x = 0x96;
    uint8_t r = (uint8_t)((x << 3) | (x >> 5));
    printf("%d", r);
}
  1. A. 75
  2. B. 180
  3. C. 150
  4. D. 165

Correct answer: B. 180

Rotating 10010110 left by three gives 10110100 = 0xB4 = 180. The shifted-out top bits come back in through the right shift.

More C Programming questions

Exams that ask this topic