The Gray-code equivalent of the binary number 1010 is:

2025

The Gray-code equivalent of the binary number 1010 is:

Answer: B. 1111Binary-to-Gray conversion rule: the most significant (leftmost) bit of the Gray code is identical to the most significant bit of the binary number. Each…

  1. A.

    1100

  2. B.

    1111

  3. C.

    1010

  4. D.

    0101

Attempted by 179 students.

Show answer & explanation

Correct answer: B

Binary-to-Gray conversion rule: the most significant (leftmost) bit of the Gray code is identical to the most significant bit of the binary number. Each subsequent Gray-code bit is obtained by XOR-ing the corresponding binary bit with the binary bit immediately to its left (that is, g(i) = b(i) XOR b(i-1), with g(1) = b(1)).

  1. Write the binary digits in order: b1 = 1, b2 = 0, b3 = 1, b4 = 0.

  2. g1 = b1 = 1 (the leading bit is copied unchanged).

  3. g2 = b1 XOR b2 = 1 XOR 0 = 1.

  4. g3 = b2 XOR b3 = 0 XOR 1 = 1.

  5. g4 = b3 XOR b4 = 1 XOR 0 = 1.

  6. Concatenating g1 g2 g3 g4 gives the Gray code 1111.

Reconstruct the binary number back from 1111 using the inverse Gray-to-binary rule, b1 = g1 and b(i) = b(i-1) XOR g(i): b1 = 1, b2 = 1 XOR 1 = 0, b3 = 0 XOR 1 = 1, b4 = 1 XOR 1 = 0, giving back 1010 -- confirming the conversion.

Explore the full course: Cdac C Cat Complete Preparation

Loading lesson…