Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

GATE | GATE-CS-2009 | Question 11

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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

My Personal Notes arrow_drop_up
Last Updated : 08 Oct, 2021
Like Article
Save Article
Similar Reads