• edited by
6,734 views
27 27 votes

In the context-free grammar below, $S$ is the start symbol, $a$ and $b$ are terminals, and $\epsilon$ denotes the empty string.

$S \rightarrow aSa \mid bSb \mid a \mid b \mid \epsilon$

Which of the following strings is NOT generated by the grammar?

  1. $aaaa$
  2. $baba$
  3. $abba$
  4. $babaaabab$

3 Answers

Best answer
44 44 votes

$L(G) = PALINDROME  $

$baba$  does not belong to palindrome , so B is the answer.

• edited by
0 0 votes

Grammar is generating strings like

 

L = {$(ab)^{n}.(ba)^{n}$ | $(ba)^{n}.(ab)^{n}$ | $(a)^{n}.(a)^{n}$ | $(b)^{n}.(b)^{n}$ } 

so $baba$ is not accepted.

B

Answer:
Position:
Show:

Related questions

44 44 votes
7 answers 7 answers
14.7k
14.7k views
Ishrat Jahan asked Oct 31, 2014
14,655 views
In the context-free grammar below, $S$ is the start symbol, $a$ and $b$ are terminals, and $\epsilon$ denotes the empty string.$S \to aSAb \mid \epsilon$$A \to bA \mid \e...
48 48 votes
7 answers 7 answers
17.8k
17.8k views
Ishrat Jahan asked Oct 31, 2014
17,803 views
Let $L$ be a context-free language and $M$ a regular language. Then the language $L ∩ M$ isalways regularnever regularalways a deterministic context-free languagealways a...
41 41 votes
1 answers 1 answer
12.4k
12.4k views
Ishrat Jahan asked Oct 31, 2014
12,388 views
Which of the following statements about regular languages is NOT true ?Every language has a regular supersetEvery language has a regular subsetEvery subset of a regular l...
29 29 votes
5 answers 5 answers
8.5k
8.5k views
Ishrat Jahan asked Oct 31, 2014
8,474 views
In the automaton below, $s$ is the start state and $t$ is the only final state.Consider the strings $u = abbaba, v = bab, \text{and} w = aabb$. Which of the following sta...