GATE Computer ScienceHardGATE CS (PYQ pattern)
How many strings of length 7 over {a, b} belong to the language of the regular expression (a + ab + ba)*?
- A. 55
- B. 38
- C. 47
- D. 64
Correct answer: C. 47
The regex is ambiguous (aba = a·ba = ab·a), so count distinct strings, not tilings: building the minimal DFA and counting accepted paths of length 7 gives 47; counting tilings would overcount.
More Theory of Computation questions
- How many strings of length 10 over {a, b} lie in the language of the regular expression abab?
- The regular expression ((aa + bb)(ab + ba)) is over Σ = {a, b}. How many states does the minimal complete DFA for its language have?
- Exactly one of the following strings is NOT in the language of (a + ab)(b + ba). Which one?
- The regular expression a(bab)a is over Σ = {a, b}. How many states does the minimal complete DFA for its language have?
- The regular expression (a + b)(ab + ba)(a + b) is over Σ = {a, b}. How many states does the minimal complete DFA for its language have?
- Exactly one of the following strings is NOT in the language of (a + bb)(b + aa). Which one?