+1 vote
330 views

The following Context-Free Grammar (CFG) :

$S \rightarrow aB | bA$

$A \rightarrow a | as | bAA$

$B \rightarrow b | bs | aBB$

will generate

1. Odd numbers of $a's$ and odd numbers of $b's$
2. Even numbers of $a's$ and even numbers of $b's$
3. Equal numbers of $a's$ and $b's$
4. Different numbers of $a's$ and $b's$
closed as a duplicate of: UGCNET-Dec2014-II-35

closed | 330 views

+1 vote

Refer this for Solution

by Boss (45.4k points)
Admin check the link also tells A there (hence C here) by mistake may be u marked X.
by (455 points)
edited
Answer C: Equal number of a's and b's

Option A is false because we can get even number of a's and even number of b's.

Example1: S -> bA -> bbAA -> bbaA -> bbaa

option B is false because we can get odd number of a's and odd number of b's.

Example2: S -> aB -> ab

The above two examples are creating equal number of a's and b's. This makes option D false
by (215 points)
edited by
0

give reasons why other options are incorrect.