ProgrammingHard
What is the value of ~5 & 0xF in C, with int of 32 bits?
- A. 11
- B. 5
- C. 6
- D. 10
Correct answer: D. 10
~5 is -6, whose low four bits are 1010, which is 10 in decimal.
More C Programming questions
- 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?
- What is 1 ^ 2 ^ 3 ^ 4 ^ 5 ^ 6 ^ 7 ^ 8 ^ 9 ^ 10 in C?