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?
- A. 8 and 16
- B. 0 and 16
- C. 16 and 16
- 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
- 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…
- An 8-bit floating-point format has 1 sign bit, 5 exponent bits (bias 15) and 2 fraction bits, with IEEE-style denormals and exponent field…