GATE Computer ScienceModerateGATE CSE
The grammar S → aSb | SS | ab generates how many distinct strings of length 6?
- A. 5
- B. 6
- C. 4
- D. 7
Correct answer: A. 5
It generates the non-empty balanced bracket strings (a = open, b = close); length 6 corresponds to Catalan(3) = 5 strings.
More Theory of Computation questions
- 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?
- Over {a, b}, L = { w : the fourth symbol from the right end of w is a }. How many states does the minimal complete DFA of L have?