ProgrammingVery hard
With 32-bit unsigned arithmetic, what does (unsigned)-5 >> 1 print?
- A. 2147483646
- B. 2147483647
- C. 2147483645
- D. 4294967291
Correct answer: C. 2147483645
(unsigned)-5 is 4294967291. Shifting right by one gives 2147483645. Using signed -5 >> 1 would be implementation-defined.
More C Programming questions
- What is the value of ~5 & 0xF in C, with int of 32 bits?
- What is the value of (3 ^ 5) & ~1 in C?
- What is printed by printf("%d", 7 13 % 5 3 % 4);?
- In C99, what are the values of -8 % 3 and 8 % -3?
- What is 2^62 mod 1000000007?
- What is the total number of 1 bits in the binary representations of the integers 1 through 10?