Context Free Language: GATE CS Previous Year Questions

Context Free Language · Theory of Computation

41 questions · asked in 24 of 27 years (2000–2026)

MCQ 36 · MSQ 51-mark 23 · 2-mark 18

2000Questions per year2026

Questions 1–5 of 41

Q1GATE 2025 (Session 1)1 markMCQ−0.33 if wrong
Consider the following context-free grammar GG, where SS, AA, and BB are the variables (non-terminals), aa and bb are the terminal symbols, SS is the start variable, and the rules of GG are described as:

S→aaB∣AbbS \to aaB \mid Abb
A→a∣aAA \to a \mid aA
B→b∣bBB \to b \mid bB

Which ONE of the languages L(G)L(G) is accepted by GG?

Q2GATE 2025 (Session 1)2 marksMCQ−0.67 if wrong
Consider the following two languages over the alphabet {a,b,c}\{a, b, c\}, where mm and nn are natural numbers:

L1={ambmcm+n∣m,n≥1}L_1 = \{ a^m b^m c^{m+n} \mid m, n \geq 1 \}
L2={ambncm+n∣m,n≥1}L_2 = \{ a^m b^n c^{m+n} \mid m, n \geq 1 \}

Which ONE of the following statements is CORRECT?

Q3GATE 2025 (Session 2)1 markMCQ−0.33 if wrong
Let G1,G2G_1, G_2 be Context-Free Grammars (CFGs) and RR be a regular expression. For a grammar GG, let L(G)L(G) denote the language generated by GG.
Which ONE among the following questions is decidable?

Q4GATE 20231 markMSQ
Which of the following statements is/are CORRECT?

One or more options are correct.

Q5GATE 20222 marksMSQ
Consider the following languages:

L1={anwan∣w∈{a,b}∗}L2={wxwR∣w,x∈{a,b}∗,∣w∣,∣x∣>0}\begin{aligned} L_1&= \{a^n wa^n|w \in \{a,b \}^* \} \\ L_2&= \{wxw^R | w,x \in \{a,b \}^*, |w|,|x| \gt 0 \} \end{aligned}

Note that wRw^R is the reversal of the string ww. Which of the following is/are TRUE?

One or more options are correct.

Keep practising

Topics in Theory of Computation

All CS topics ›