GATE Computer ScienceEasyGATE CS (PYQ pattern)

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 contain an odd number of 1 bits?

  1. A. 8 and 16
  2. B. 0 and 16
  3. C. 16 and 16
  4. D. 0 and 32

Correct answer: B. 0 and 16

In an 8-bit palindrome every bit is paired with its mirror, so the weight is even: 0. A 9-bit palindrome has 4 free pairs plus a middle bit; the weight is odd exactly when the middle bit is 1, leaving 2⁴ = 16 choices.

More Digital Logic questions

Exams that ask this topic