ProgrammingVery hard

The Gray code 0b110 is converted to ordinary binary using the prefix XOR rule. What is the decimal result?

  1. A. 5
  2. B. 6
  3. C. 4
  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

Exams that ask this topic