Context Free Languages questions

Q25

GATE CS 2026 CS-1Context Free LanguagesMSQ1 mark
Consider the following grammar where SS is the start symbol, and aa and bb are terminal symbols.

S→aSbS∣bS∣ϵS \to aSbS \mid bS \mid \epsilon

Which of the following statements is/are true?
More than one option can be correct.
Show answer without attempting

Answer: A, B, C

Q52

GATE CS 2026 CS-1Context Free LanguagesMSQ2 marks
Consider the following context-free grammar GG.

S→abaABAbbaS \to abaABAbba
A→aaBBAIn∣bBabaaA \to aaBBAIn \mid bBabaa
B→aBb∣abB \to aBb \mid ab

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?
More than one option can be correct.
Show answer without attempting

Answer: B, D

Q29

GATE CS 2026 CS-2Context Free LanguagesMSQ1 mark
Which of the following grammars is/are ambiguous?
More than one option can be correct.
Show answer without attempting

Answer: B, C

Q48

GATE CS 2026 CS-2Context Free LanguagesMSQ2 marks
Let Σ={a,b,c,d}\Sigma = \{a, b, c, d\} and let L={aibjckdℓ∣i,j,k,ℓ≥0}L = \{a^i b^j c^k d^\ell \mid i, j, k, \ell \ge 0\}.

Which of the following constraints ensure(s) that the language LL is context-free?
More than one option can be correct.
Show answer without attempting

Answer: A, C, D

0/40 correct0 marks

Related topics in Theory of Computation