GATE Computer ScienceHardGATE CS (PYQ pattern)

How many binary strings of length exactly 16 (leading zeros allowed) represent a number divisible by 5?

  1. A. 13108
  2. B. 13107
  3. C. 13109
  4. D. 9832

Correct answer: A. 13108

The numbers 0..65535 contain ⌊65535/5⌋ + 1 = 13108 multiples of 5 (the DFA over remainders mod 5 accepts exactly those). Dividing 2¹⁶ by 5 forgets the multiple 0.

More Theory of Computation questions

Exams that ask this topic