in Theory of Computation retagged by
20,315 views
34 votes
34 votes

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

  1. all palindromes
  2. all odd length palindromes
  3. strings that begin and end with the same symbol
  4. all even length palindromes
in Theory of Computation retagged by
20.3k views

4 Comments

@Pranavpurkar Agreed! Bad framing of options

1
1

it all depends on what the question setter wants from us.

1
1

@Pranavpurkar

no both b and c cant be true, because in option c we can have ‘abaa’ in which first and last symbol is same but it can’t be generated by above grammar

0
0

7 Answers

38 votes
38 votes
Best answer

Answer is B. String generated by this language is $a,b,aba,bab,aabaa,\ldots$

All this strings are odd length palindromes.

edited by

4 Comments

but it is not written that grammar should generate all strings that begin and end with same symbol

option C should be " all strings that begin and end with same symbol"

then it is correct to remove option c

is it not?
1
1
even ur answer contains flaw

the language u given covers  BOTH B and C.
0
0
aa is starting and ending with same symbal but not cover by above grammar.so option C) is wrong.only option B) is correct
2
2
17 votes
17 votes
(A) Counter Example :- aa or bb not generated by above Grammar.

(C) Counter example :- aa not genetrated by above Grammer.

(D) Counter Example :- aa not generated, but a generated.

(B) Correct. Odd length palindromes are generated by this grammar.
14 votes
14 votes

option b

4 Comments

I agree with you but I am asking about if all do not mention we assume that it talking about all. As in option C.
0
0
In option c it is saying it genrate starting and ending with same symble. But it can't genrate all string like string aa.  So it is wrong.
0
0
Yes it genrate all string . Not subset of string
0
0
Thanks Bro!!
0
0
8 votes
8 votes
(B) all odd length palindromes
by
Answer:

Related questions