in Theory of Computation edited by
2,083 views
2 votes
2 votes

The language which is generated by the grammar $S \rightarrow aSa \mid bSb \mid a \mid b$ over the alphabet of $\{a,b\}$ is the set of

  1. Strings that begin and end with the same symbol
  2. All odd and even length palindromes
  3. All odd length palindromes
  4. All even length palindromes
in Theory of Computation edited by
by
2.1k views

4 Answers

1 vote
1 vote

Strings generated by grammar are $\{a, b, aba, aaa, bab, ababa, aaaaa,..\}$ all are odd length palindromes. Option b) & d) eliminated.

Option a) is not correct as $'aaba'$ is a string starts and ends with same symbol but not generated by given grammar.

Hence Option C) is correct 

0 votes
0 votes
Answer: c) All odd length palindromes.
0 votes
0 votes
the string generated by this grammar are {a,b,aaa,aba,bab,bbb,aaaaa,ababb..........}

so the option C is correct.
0 votes
0 votes

We can solve such kinds of question with the help of OPTION ELIMINATION METHOD.

 FOR OPTION A,B,D: It does not generate {aa}

Hence,OPTION C is correct.

(:

 

 

Answer:

Related questions