ProgrammingHardGATE CS · Campus placements

How many binary strings of length 4 contain at least two adjacent 1s?

  1. A. 6
  2. B. 8
  3. C. 10
  4. D. 4

Correct answer: B. 8

There are 16 strings in total, and 8 of them contain no two adjacent 1s (the Fibonacci count F(6) = 8). So 16 - 8 = 8 strings have at least one adjacent pair.

More C Programming questions

Exams that ask this topic