GATE Computer ScienceModerateGATE CSE · NIELIT
Which of the following languages over {a, b} is context-free but not regular?
- A. { a^n b^n c^n : n ≥ 0 }
- B. { w wᴿ : w ∈ {a, b}* }
- C. { a^n b^m : n, m ≥ 0 }
- D. { w w : w ∈ {a, b}* }
Correct answer: B. { w wᴿ : w ∈ {a, b}* }
Even-length palindromes need one stack; a^n b^n c^n and ww are not context-free; a*b* is regular.
More Theory of Computation questions
- 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?
- How many strings of length 8 over {a, b} contain aa as a substring but do not contain bb as a substring?
- An NFA with ε-moves over {a, b} has states 0–4, start 0 and accepting state 4. Transitions: 0 –ε→ 1, 2 –ε→ 3; δ(0,a) = {0}; δ(1,b) = {2}…