Computer Science EngineeringHard

How many strings of length 3 over {a, b} contain 'ab' as a substring?

  1. A. 3
  2. B. 5
  3. C. 4
  4. D. 6

Correct answer: C. 4

The strings are aab, aba, abb and bab, giving 4.

More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions

Exams that ask this topic