edited by
15,149 views
44 votes
44 votes

Consider a CFG with the following productions.

$S \to AA \mid B$
$A \to 0A \mid A0 \mid 1$
$B \to 0B00 \mid 1$

$S$ is the start symbol, $A$ and $B$ are non-terminals and 0 and 1 are the terminals. The language generated by this grammar is:

  1. $\left\{0^n 10^{2n} \mid n \geq 1\right\}$
  2. $\left\{0^i 10^j 10^k \mid i, j, k \geq 0\right\} \cup \left\{0^n 10^{2n}\mid n \geq 0\right\}$
  3. $\left\{0^i 10^j \mid i, j \geq 0\right\} \cup \left\{0^n 10^{2n}\mid  n \geq 0\right\}$
  4. The set of all strings over $\{0, 1\}$ containing at least two $0$'s
edited by

7 Answers

0 votes
0 votes
S → AA | B
A → 0A | A0 | 1
B → 0B00 | 1
In this B → 0B00 | 1 which generates {0n 102n | n ≥0}
S → AA | B
A → 0A | A0 | 1
Which generates 0A0A → 00A0A → 00101.
Which is suitable for B and D option. D is not correct because 00 is not generated by the given grammar. So only option B is left. Non-terminal B i s generating the second part of B choice and AA is generating the first part.
{0i 10j 10k | i, j, k ≥ 0} ∪ {0n 102n | n ≥ 0}

None of the above
–2 votes
–2 votes
fact of question is that instead of eliminating the options just find a counter example for each and every option.....nd then try with modified option as mentioned in previous comments........then option b is correct
Answer:

Related questions

56 votes
56 votes
6 answers
5
Ishrat Jahan asked Oct 28, 2014
12,709 views
Consider the following two finite automata. $M_1$ accepts $L_1$ and $M_2$ accepts $L_2$.$M_1$$M_2$ Which one of the following is TRUE?$L_1 = L_2$$L_1 \subset L_2$$L_1 \ca...