Aptitude | GATE IT 2006 | Question 4

In the context-free grammar below, S is the start symbol, a and b are terminals, and ϵ denotes the empty string

S → aSa | bSb | a | b | ϵ

Which of the following strings is NOT generated by the grammar?



 
(A) aaaa
(B) baba
(C) abba
(D) babaaabab


Answer: (B)

Explanation:  

The given Language is  Palindrome.

A,C and D follow the language but  baba  is not a palindrome  , so B is the answer

Quiz of this Question
Please comment below if you find anything wrong in the above post



My Personal Notes arrow_drop_up