The language which is generated by the grammar S → aSa | bSb | a | b over the alphabet {a, b} is the set of

The language which is generated by the grammar S → aSa | bSb | a | b over the alphabet {a, b} is the set of Correct Answer All odd length palindromes

Concept:

S → aSa | bSb | a | b generates strings like {a, b, aaa, bbb, aba, bab, abbba, ababa, ….) which is the set of all odd length palindromes.

Example of odd length pallindrom.

String:  ababa

[ alt="F1 R.S 20.5.20 Pallavi D1" f: image at pm.jpeg src="//storage.googleapis.com/tb-img/production/20/05/F1_R.S_20.5.20_Pallavi_D1.png" style="width: 136px; height: 178px;">

Option 1: Incorrect

String: “aa” (Not accepted)

Begins and ends with same symbol but not accepted by given grammar

Option 2 and 4: Incorrect

String: “aa” (Not accepted)

Even length palindrome is not accepted by given grammar

Related Questions

Consider the following context-free grammar over the alphabet ∑ = {a, b, c} with S as the start symbol: S → abScT | abcT T → bT | b Which one of the following represents the language generated by the above grammar?