recategorized by
2,735 views
1 votes
1 votes

The following CFG $S \rightarrow aB \mid bA, A \rightarrow a \mid as \mid bAA, B \rightarrow b \mid bs \mid aBB$ generates strings of terminals that have

  1. odd number of a’s and odd number of b’s
  2. even number of a’s and even number of b’s
  3. equal number of a’s and b’s
  4. not equal number of a’s and b’s
recategorized by

2 Answers

0 votes
0 votes
eliminate one by one

for D :S-->aB-->ab (GENERATES #a  = #b) SO IT IS WRONG

FOR A:  CONSIDER THE STRING aaab (ODD NUM OF a'S AND ODD NUM OF b'S)

            S-->aB-->aaBB-->aaaBBB-->aaabbb  ( WE ARE NOT ABLE TO GET)

FOR B:  CONSIDER THE STRING  aaaabb ( EVEN NUM OF a'S AND EVEN NUM OF b'S)

           S-->aB-->aaBB-->aaaBBB-->aaaaBBBB-->aaaabbbb(WE ARE NOT ABLE TO GET)

SO A,B,D ARE WRONG

NOW LOOK AT THE OUTPUTS OF A,B,D ..THESE ARE:  ab,aaabbb,aaaabbbb

which shows we can get #a's  =  # b's

so C is the ans
Answer:

Related questions

2 votes
2 votes
2 answers
2
go_editor asked Jul 7, 2016
4,993 views
Match the following :$\begin{array} {clcl} \text{(i)}& \text{Regular grammer} & \text{(a)} & \text{Pushdown automaton} \\ \text{(ii)}& \text{Context free grammer} & \tex...
3 votes
3 votes
1 answer
3
1 votes
1 votes
1 answer
4