ProgrammingHard
What is the value of (3 ^ 5) & ~1 in C?
- A. 6
- B. 7
- C. 4
- D. 2
Correct answer: A. 6
3 ^ 5 = 6, and 6 & ~1 clears bit 0, which is already 0, so the result is 6.
More C Programming questions
- 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?
- What is the Hamming distance between 13 and 22 (the number of bit positions where they differ)?