GATE Computer ScienceModerateIBPS SO · GATE CSE
How many strings of length 7 over {a, b} belong to the language of the regular expression (a + bb)*(b + ε)?
- A. 38
- B. 31
- C. 34
- D. 43
Correct answer: C. 34
Count strings that parse into blocks a / bb followed by at most one extra b (this extra b is only usable at the end); enumeration of all 128 strings gives 34.
More Theory of Computation questions
- The grammar S → aSb | SS | ab generates how many distinct strings of length 6?
- Which of the following problems is decidable for the given input? I. Is the language of a given context-free grammar empty? II. Are two…
- Which of the following languages over {a, b} is context-free but not regular?
- A grammar in Chomsky normal form (no ε-productions) is used to derive a string of length 9. How many derivation steps (production…
- Over {a, b}, L = { w : |w| ≥ 3 and the third symbol from the right end is a }. What is the number of states in its minimal complete DFA?
- Over {a, b}, let L = { w : na(w) ≡ 1 (mod 4) OR nb(w) is even }. What is the number of states in its minimal complete DFA?