in Theory of Computation retagged by
5,099 views
7 votes
7 votes

Which of the following sentences can be generated by 

S -> aS $\mid$ bA

A -> d $\mid$ cA

  1. bccdd
  2. abbcca
  3. abcabc
  4. abcd
in Theory of Computation retagged by
5.1k views

4 Answers

10 votes
10 votes
Best answer

S=>aS

=>abA

=>abcA

=>abcd

Hence,Option(D) abcd is the correct choice.

selected by
4 votes
4 votes

Option A-- two consecutive d can't generate

Option B&C can't generate bcz ..any string must endup with d to get accepted by this grammar.

Option D is correct bcz

S->aS

  -> abA

 -> abcA
-> abcd
2 votes
2 votes
option D

in any case d would come at end, that eliminate option B,C

d cannot come twice, that eliminate option A

so option D is the winner
1 vote
1 vote

ans is (d)

Answer: