ProgrammingVery hard
An 8-bit value 0b10010110 is rotated left by 3 positions within 8 bits. What is the result in decimal?
- A. 150
- B. 75
- C. 45
- D. 180
Correct answer: D. 180
The rotate gives 10110100, which is 128 + 32 + 16 + 4 = 180. The bits shifted out at the top come back in at the bottom.
More C Programming questions
- unsigned char s = 0; for (int i = 1; i <= 100; i++) s += i; printf("%d", s); What is printed?
- What is (1ULL << 40) % 1000 in C?
- For the signed integer -17, which expression gives the non-negative remainder modulo 5 in C?
- In 32-bit signed int arithmetic, what is the largest n such that the sum 1 + 2 + ... + n does not overflow?
- How many integers from 1 to 100 are divisible by 6 or by 9?
- With 32-bit unsigned int, what is 65536u 65536u?