Data Structures & AlgorithmsVery hardGATE CS · TCS NQT

How many binary strings of length 5 contain no two consecutive zeros?

  1. A. 14
  2. B. 13
  3. C. 15
  4. D. 17

Correct answer: B. 13

The count follows the Fibonacci numbers: each string ends in 1 (any valid string of length 4) or in 01 (valid of length 3). This gives 13.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic