ProgrammingVery hardCompetitive coding (CP)

What is printed?

What is printed?
#include <stdint.h>
#include <stdio.h>
int main(void) {
    uint8_t v = 0x81;
    v = (uint8_t)((v >> 1) | (v << 7));
    printf("%d", v);
}
  1. A. 64
  2. B. 192
  3. C. 224
  4. D. 129

Correct answer: B. 192

Rotating 10000001 right by one moves the low bit to the top, giving 11000000 = 192. Losing the wrapped bit gives 64, and rotating by two gives 224.

More C Programming questions

Exams that ask this topic