GATEverse
← GATE CSE 2026 Set 1

Q42

MSQ2 marks

Consider the following context-free grammar GG.

S→abaABAbbaA→aaBBAb∣bBabaaB→aBb∣ab\begin{array}{l} 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{array}

In the above grammar, SS is the start symbol, aa and bb are terminal symbols, and AA and BB are non-terminal symbols. Let L(G)L(G) be the language generated by the grammar GG. For a string s∈L(G)s \in L(G), let n1(s)n_{1}(s) be the number of aa 's in ss and n2(s)n_{2}(s) be the number of bb 's in ss. Which of the following statements is/are true?

Sign in to save attempts.

Loading…