retagged by
744 views
0 0 votes

Consider the grammar given below:

$S \rightarrow x \ T \mid  y \ Z$

$Z \rightarrow x \mid  x \ S \mid y \ Z \ Z$

$T \rightarrow y \mid y \ S \mid y \ T \ T$

Consider the following strings:

  1. $xxyyx$
  2. $xxyyxy$
  3. $xyxy$
  4. $yxxy$
  5. $yyxxyx$
  6. $xyx$

Which of the above strings are generated by the given grammar?

  1. i, iv and iii
  2. ii, iii and iv
  3. ii, v and iv
  4. iii, iv and v

2 Answers

Best answer
1 1 vote
Option D , iii, iv and v is possible grammars.

 

selected by
0 0 votes

Extremely fast method if you read options before solving:

 

  1. Strings i and ii have ‘xx‘ at the start. Looking at the grammar, it expands to the right, so we have to produce xx from the starting terminal.
  2. S → xT →xy | xyS | xyTT .  So xx is not possible, Therefore both i and ii are not possible. 
  3. In options, only option D has no i and ii.

Therefore option D is answer.

Answer:
Position:
Show:

Related questions

0 0 votes
1 1 answer
670
670 views
Bikram asked Aug 12, 2017
670 views
The language generated by the following grammar is:$S \rightarrow aAb$$A \rightarrow aAb / B$$B \rightarrow CC$$C \rightarrow bDa$$D \rightarrow bDa / \epsilon$$\{ {a...
5 5 votes
0 0 answers
1.2k
1.2k views
Bikram asked Aug 12, 2017
1,223 views
The number of possible finite automata with two states $a0$ and $a1$ (where $a0$ is always the initial state over the alphabet $\{p, q\}$) which accepts empty language is...
0 0 votes
1 answers 1 answer
669
669 views
Bikram asked Aug 12, 2017
669 views
What is the regular expression corresponding to the above DFA?$(01 + (00)^*1)^*$$0^*10^*$$(10 + 0(00)^* (1 + 01) )^*$$0(00)^*10^*$
1 1 vote
0 0 answers
1.0k
1.0k views
Bikram asked Aug 12, 2017
1,015 views
Which of the following regular expressions does not generate the following language?$\{w \mid \text{ the length of }w \text{ is at most }4\} \text{ where } \Sigma = \{a,b...