ProgrammingVery hard
The Gray code 0b110 is converted to ordinary binary using the prefix XOR rule. What is the decimal result?
- A. 5
- B. 6
- C. 4
- D. 3
Correct answer: C. 4
The first bit stays 1, the second is 1 XOR 1 = 0, and the third is 0 XOR 0 = 0, giving 100 = 4.
More C Programming questions
- What does printf("%d", 8 & 7 == 0); print?
- How many integers from 1 to 10^9 are divisible by 7 or by 11?
- The modular inverse of 2 modulo the NTT prime 998244353 is which value?
- A linear congruential generator x = (1103515245 x + 12345) mod 2^31 starts with x = 1. What is the next value?
- With 64-bit arithmetic, what is (10^9 x 10^9) mod (10^9 + 7)?
- What is the value of x & (x - 1) for x = 0b10110100 in binary as a decimal?