in Others edited by
730 views
0 votes
0 votes

Which of the following strings is in the language defined by grammar $S\rightarrow OA,$ $A\rightarrow1A/0A/1$

  1. $01100$
  2. $00101$
  3. $10011$
  4. $11111$
in Others edited by
730 views

1 Answer

0 votes
0 votes
There seems to be a mistake in the grammar given.

Assuming the grammar is $S\rightarrow0A,A\rightarrow1A/0A/1$,

The grammar generates strings which start with 0 and end with 1.

So only option b is the answer.

OR

$S\rightarrow0A$

$S\rightarrow00A$

$S\rightarrow001A$

$S\rightarrow0010A$

$S\rightarrow00101$

Hence option B is answer

Related questions