GATE Computer ScienceHardGATE CS (PYQ pattern)
Let g(x) = x XOR (x >> 1) be the 8-bit binary-reflected Gray encoding. What is the smallest k ≥ 1 such that applying g k times returns every 8-bit value to itself?
- A. 8
- B. 2
- C. 7
- D. 256
Correct answer: A. 8
Over GF(2), g = I + S with S the right shift, and S⁸ = 0. Then g^(2^j) = I + S^(2^j): g² = I + S², g⁴ = I + S⁴, g⁸ = I + S⁸ = I. g⁴ ≠ I because S⁴ ≠ 0 (e.g. 10000000 → g⁴ gives 10001000), so the order is exactly 8.
More Digital Logic questions
- A bit string is a palindrome if it reads the same forwards and backwards. How many 8-bit palindromes and how many 9-bit palindromes…
- Let g(x) = x XOR (x >> 1) be the 8-bit Gray code of x. For how many x in 0..254 is g(x) equal to x + 1?
- For how many of the 256 ordered pairs of 4-bit two's complement numbers (a, b) does the exact product a·b fit in a 4-bit two's complement…
- 0.1 stored in IEEE 754 single precision (round to nearest) has the bit pattern 0x3DCCCCCD. Relative to the exact value 0.1, the stored…
- What is the IEEE 754 single-precision bit pattern of the value nearest to −1/3 (round to nearest)?
- Which of the following are true in IEEE 754 arithmetic (using the language operators ==, != and the usual semantics)? Let nan be a NaN and…