recategorized by
536 views
0 votes
0 votes

Consider the context-free grammar below ($\epsilon$ denotes the empty string, alphabet is $\{a,b\}$):

$$S\rightarrow \epsilon \mid aSb \mid bSa \mid SS.$$

What language does it generate?

  1. $(ab)^{\ast} + (ba)^{\ast}$
  2. $(abba) {\ast} + (baab)^{\ast}$
  3. $(aabb)^{\ast} + (bbaa)^{\ast}$
  4. Strings of the form $a^{n}b^{n}$ or $b^{n}a^{n},n$ any positive integer
  5. Strings with equal numbers of $a$ and $b$
recategorized by

1 Answer

0 votes
0 votes

$S\rightarrow \epsilon \mid aSb \mid bSa \mid SS$

  • $S\rightarrow a\underline{S}b$
  • $S\rightarrow a\underline{S}Sb$
  • $S\rightarrow a a\underline{S}b Sb$
  • $S\rightarrow a ab\underline{S}a b Sb$
  • $S\rightarrow a aba b \underline{S}b$
  • $S\rightarrow a aba b b$


Stings with an equal number of $a's$ and $b's.$

References:

So, the correct answer is $(E).$

edited by
Answer:

Related questions

1.6k
views
4 answers
3 votes
admin asked Feb 10, 2020
1,626 views
Consider the following statements.The intersection of two context-free languages is always context-freeThe super-set of a context-free languages is never regularThe subset of a decidable language ... $(1),(2),(3),(4)$ are true.
874
views
1 answers
2 votes
admin asked Feb 10, 2020
874 views
What is the maximum number of regions that the plane $\mathbb{R}^{2}$ can be partitioned into using $10$ lines?$25$50$55$56$1024$Hint: Let $A(n)$ be the maximum number ... $A(n)$.
1.1k
views
1 answers
6 votes
admin asked Feb 10, 2020
1,077 views
The figure below describes the network of streets in a city where Motabhai sells $\text{pakoras}$ from his cart. The number next to an edge is the time (in minutes ... are the only odd degree nodes in the figure above.$430$440$460$470$480$
1.0k
views
1 answers
3 votes
admin asked Feb 10, 2020
1,007 views
Suppose $X_{1a}, X_{1b},X_{2a},X_{2b},\dots , X_{5a},X_{5b}$ are ten Boolean variables each of which can take the value TRUE or FLASE. Recall ... not a satisfying assignment.How many satisfying assignments does $H$ have?$20$30$32$160$1024$