Skip to content
Related Articles

Related Articles

GATE | GATE-CS-2009 | Question 11
  • Difficulty Level : Medium
  • Last Updated : 18 Jan, 2014

S -> aSa|bSb|a|b; The language generated by the above grammar over the alphabet {a,b} is the set of
(A) All palindromes
(B) All odd length palindromes.
(C) Strings that begin and end with the same symbol
(D) All even length palindromes


Answer: (B)

Explanation: The possible palindrome generated by above grammar can be of odd length only as there is no rule for S -> \epsilon

For example generated palindromes are aba, aaa, bab, ababa, aaaaa, ..

Quiz of this Question

sudo-gate-course

My Personal Notes arrow_drop_up
Recommended Articles
Page :