Skip to main content

Gray code, (11101)Gray to binary, FFH AND CAH

Short answer

Gray code is an unweighted code where successive values differ in only one bit. (11101)Gray = (10110) binary (22 decimal). Bitwise AND of (FF)H and (CA)H is (CA)H (11001010, decimal 202).

Define Gray Code and convert (11101)Gray code to binary. When (FF)H is ANDed with (CA)H what will be the resulting number.

Gray code

Gray code is an unweighted, cyclic (reflected binary) code in which two successive numbers differ in only one bit. Example: 0 → 000, 1 → 001, 2 → 011, 3 → 010, 4 → 110. Because only one bit changes at a time, it avoids false outputs during transitions and is used in shaft encoders and K-map labelling.

(11101) Gray to binary

Rule: BMSB=GMSBB_{MSB} = G_{MSB}, then Bi=Bi+1⊕GiB_i = B_{i+1} \oplus G_i.

Gray bitOperationBinary bit
1copy1
11⊕11 \oplus 10
10⊕10 \oplus 11
01⊕01 \oplus 01
11⊕11 \oplus 10

Answer: (11101)Gray=(10110)2=2210(11101)_{Gray} = (10110)_2 = 22_{10}

(FF)H AND (CA)H

AND is done bit by bit:

 FFH = 1111 1111
 CAH = 1100 1010
 AND = 1100 1010

ANDing any bit with 1 leaves it unchanged, so FFH acts as a mask that passes the other number.

Answer: (FF)H⋅(CA)H=(CA)H=(11001010)2=20210(FF)_H \cdot (CA)_H = (CA)_H = (11001010)_2 = 202_{10}

✓ Answer checked by Claude Opus 5.5 (high effort)

All Digital Logic chapter 1 questions →