GATE Computer ScienceVery hardGATE CSE · NIELIT
How many strings of length 12 over {a, b} contain neither aba nor bbb as a substring?
- A. 189
- B. 196
- C. 184
- D. 204
Correct answer: A. 189
Count with the transfer matrix of the 4-state automaton that tracks the relevant suffix (or enumerate all 4096 strings): 189.
More Theory of Computation questions
- Consider the grammar S → aSbS | bS | ε over {a, b}. How many strings of length exactly 9 does it generate?
- The grammar S → SS | aS | a is used to parse the string a⁶ (six a's). How many different parse trees does a⁶ have?
- A Turing machine (blank B, halts when no rule applies or in state acc) has rules: q0: a→(q1,B,R), b→(q2,B,R), B→(acc,B,S); q1 and q2…
- Which regular expression (+ denotes union) denotes exactly the set of non-empty strings over {a, b} that start with a, end with a and…
- How many strings of length 10 over {a, b} belong to the language of (a+b)(aab + bba)(a+b), that is, contain aab or bba as a substring?
- Let L = { w ∈ {a, b} : (|w|a + 2·|w|b) mod 12 ∈ {1, 5, 9} }, where |w|a and |w|b count the a's and b's. What is the number of equivalence…