Consider the following context-free grammar $G$ :
$$ \begin{aligned} & S \rightarrow a b a A B A b b a \\ & A \rightarrow a a B B A b \mid b B a b a a \\ & B \rightarrow a B b \mid a b \end{aligned} $$
In the above grammar, $S$ is the start symbol, $a$ and $b$ are terminal symbols, and $A$ and $B$ are non-terminal symbols.
Let $L(G)$ be the language generated by the grammar $G$. For a string $s \in L(G)$, let $n_1(s)$ be the number of a's in $s$ and $n_2(s)$ be the number of b's in $s$.
Which of the following statements is/are true?
Consider the following two languages over the alphabet $\{a, b, c\}$, where $m$ and $n$ are natural numbers.
$$\begin{aligned} & L_1=\left\{a^m b^m c^{m+n} \mid m, n \geq 1\right\} \\ & L_2=\left\{a^m b^n c^{m+n} \mid m, n \geq 1\right\} \end{aligned}$$
Which ONE of the following statements is CORRECT?
Consider a context-free grammar $G$ with the following 3 rules.
$S \rightarrow aS, \ S \rightarrow aSbS, S \rightarrow c$
Let $w \in L(G)$.
Let $n_a(w)$, $n_b(w)$, $n_c(w)$ denote the number of times $a$, $b$, $c$ occur in $w$, respectively. Which of the following statements is/are TRUE?
Let G = (V, Σ, S, P) be a context-free grammar in Chomsky Normal Form with Σ = { a, b, c } and V containing 10 variable symbols including the start symbol S. The string w = a30b30c30 is derivable from S. The number of steps (application of rules) in the derivation S ⟹ w is _______
GATE CSE Subjects
Browse all chapters by subject