• edited by
15,621 views
33 33 votes

Consider the CFG with $\left\{S, A, B\right\}$ as the non-terminal alphabet, $\{a, b\}$ as the terminal alphabet, $S$ as the start symbol and the following set of production rules:

$S \rightarrow aB$            $S \rightarrow bA$

$B \rightarrow b$               $A \rightarrow a$ 

$B \rightarrow bS$           $A \rightarrow aS$

$B \rightarrow aBB$       $A \rightarrow bAA$

Which of the following strings is generated by the grammar?

  1. $aaaabb$
  2. $aabbbb$
  3. $aabbab$
  4. $abbbba$

3 Answers

Best answer
41 41 votes
$S  \rightarrow aB$
    $ \rightarrow aaBB$
    $ \rightarrow aabB$
    $ \rightarrow aabbS$
    $ \rightarrow aabbaB$
    $ \rightarrow aabbab$

Correct Answer: $C$
• edited by
–3 –3 votes
ans c) b)
1 flag:
✌ Edit necessary (js__)
Answer:
Position:
Show:

Related questions

34 34 votes
5 answers 5 answers
15.0k
15.0k views
go_editor asked Apr 23, 2016
15,001 views
Consider the CFG with $\left\{S, A, B\right\}$ as the non-terminal alphabet, $\{a, b\}$ as the terminal alphabet, $S$ as the start symbol and the following set of product...
96 96 votes
11 answers 11 answers
53.7k
53.7k views
Kathleen asked Sep 21, 2014
53,734 views
Consider the following two statements:P: Every regular grammar is LL(1)Q: Every regular set has a LR(1) grammarWhich of the following is TRUE?Both P and Q are trueP is tr...
43 43 votes
6 answers 6 answers
21.9k
21.9k views
Kathleen asked Sep 21, 2014
21,859 views
Consider the grammar with non-terminals $N=\left\{S,C,S_1\right\}$, terminals $T=\left\{a, b, i, t, e\right\}$, with $S$ as the start symbol, and the following set of rul...
23 23 votes
3 answers 3 answers
13.1k
13.1k views
Kathleen asked Sep 21, 2014
13,123 views
Which one of the following is a top-down parser?Recursive descent parser.Operator precedence parser.An LR(k) parser.An LALR(k) parser.