Skip to content

GATE CS Context-free Grammars and Push-down Automata questions

Practise Context-free Grammars and Push-down Automata questions for GATE CS. Explore official PYQs and original topic-wise quizzes, check answers and view available solutions. Free, no sign-in.

Subject, topic, year and type filter the full library. Match any choice within a filter, and all selected filter categories. Search, source and sort apply to this page.

20 on this page
Official PYQ2026Theory of ComputationContext-free Grammars and Push-down AutomataMSQ · 1 mark
Consider the following grammar where SS is the start symbol, and aa and bb are terminal symbols. S→aSbS | bS | ϵS \rightarrow a S b S \text{ | } b S \text{ | } \epsilon Which of the following statements is/are true?
Official PYQ2025Theory of ComputationContext-free Grammars and Push-down AutomataMCQ · 1 mark
Consider the following context-free grammar GG, where S,AS, A, 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∣AbbA→a∣aAB→b∣bB\begin{array}{l} S \rightarrow a a B \mid A b b \\ A \rightarrow a \mid a A \\ B \rightarrow b \mid b B \end{array} Which ONE of the …
Official PYQ2025Theory of ComputationContext-free Grammars and Push-down AutomataMCQ · 1 mark
​​​​Which ONE of the following languages is accepted by a deteministic pushdown automaton?
Official PYQ2023Theory of ComputationContext-free Grammars and Push-down AutomataMCQ · 2 marks
Consider the context-free grammar GG below S→aSb∣XX→aX∣Xb∣a∣b,\begin{array}{l} S \rightarrow a S b \mid X \\ X \rightarrow a X \mid X b \mid a \mid b, \end{array} where SS and XX are non-terminals, and aa and bb are terminal symbols. The starting non-terminal is SS. Which one of the following statements is CORRECT?\text{CORRECT}?
Official PYQ2023Theory of ComputationContext-free Grammars and Push-down AutomataMCQ · 2 marks
Consider the pushdown automaton (PDA)  P\text{(PDA)}\;P below, which runs on the input alphabet {a,b}\{a, b\}, has stack alphabet {⊥,A}\{\perp, A\}, and has three states {s,p,q}\{s, p, q\}, with ss being the start state. A transition from state uu to state vv, labelled c/X/γc / X / \gamma, where cc is an input symbol or ϵ,X\epsilon, X is a stack symbol, …
Official PYQ2022Theory of ComputationContext-free Grammars and Push-down AutomataMSQ · 2 marks
Consider the following languages: L1={ww∣w∈{a,b}∗}L_{1} = \{ ww | w \in \{a,b\}^{\ast} \} L2={anbncm∣m,n≥0}L_{2} = \{a^{n} b^{n} c^{m} | m,n \geq 0 \} L3={ambncn∣m,n≥0}L_{3} = \{a^{m} b^{n} c^{n} | m,n \geq 0 \} Which of the following statements is/are FALSE?\text{FALSE}?
Official PYQ2022Theory of ComputationContext-free Grammars and Push-down AutomataMSQ · 2 marks
Consider the following languages: L1={anwan∣w∈{a,b}∗}L_{1} = \{ a^{n} wa^{n} | w \in \{a,b\}^{\ast}\} L2={wxwR∣w,x∈{a,b}∗,∣w∣,∣x∣>0}L_{2} = \{wxw^{R} | w, x \in \{a,b\}^{*}, |w|, |x| > 0 \} Note that wRw^{R} is the reversal of the string w.w. Which of the following is/are TRUE?\text{TRUE}?
Official PYQ2021Theory of ComputationContext-free Grammars and Push-down AutomataMCQ · 1 mark
Suppose that L1L_1 is a regular language and L2L_2 is a context-free language. Which one of the following languages is NOT\text{NOT} necessarily context-free?
Official PYQ2021Theory of ComputationContext-free Grammars and Push-down AutomataNAT · 2 marks
In a pushdown automaton P=(Q,Σ,Γ,δ,q0,F)P=(Q, \Sigma, \Gamma, \delta, q_0, F), a transition of the form, where p,q∈Qp,q \in Q, a∈Σ∪{ϵ}a \in \Sigma \cup \{ \epsilon \}, and X,Y∈Γ∪{ϵ}X,Y \in \Gamma \cup \{ \epsilon \}, represents (q,Y)∈δ(p,a,X).(q,Y) \in \delta(p,a,X).Consider the following pushdown automaton over the input alphabet Σ={a,b}\Sigma = \{a,b\} and stack alphabet …
Official PYQ2021Theory of ComputationContext-free Grammars and Push-down AutomataMSQ · 2 marks
For a string ww, we define wRw^R to be the reverse of ww. For example, if w=01101w=01101 then wR=10110w^R=10110. Which of the following languages is/are context-free?
Official PYQ2019Theory of ComputationContext-free Grammars and Push-down AutomataMCQ · 2 marks
Which one of the following languages over Σ={a,b}\Sigma=\{a, b\} is NOT context-free?
Official PYQ2018Theory of ComputationContext-free Grammars and Push-down AutomataMCQ · 2 marks
Consider the following languages: {ambncpdq∣m+p=n+q, where m,n,p,q≥0}\{a^mb^nc^pd^q \mid m+p=n+q, \text{ where } m, n, p, q \geq 0 \} {ambncpdq∣m=n and p=q, where m,n,p,q≥0}\{a^mb^nc^pd^q \mid m=n \text{ and }p=q, \text{ where } m, n, p, q \geq 0 \} {ambncpdq∣m=n=p and p≠q, where m,n,p,q≥0}\{a^mb^nc^pd^q \mid m=n =p \text{ and } p \neq q, \text{ where } m, n, p, q \geq 0 \} {ambncpdq∣mn=p+q, where m,n,p,q≥0}\{a^mb^nc^pd^q \mid mn =p+q, \text{ where } m, n, p, q \geq 0 \} Which of the …
Official PYQ2017Theory of ComputationContext-free Grammars and Push-down AutomataMCQ · 1 mark
Consider the following languages over the alphabet Σ={a,b,c}\Sigma = \left \{ a, b, c \right \}. Let L1={anbncm∣m,n≥0}L_{1} = \left \{ a^{n}b^{n}c^{m}\mid m,n \geq 0 \right \} and L2={ambncn∣m,n≥0}L_{2} = \left \{ a^{m}b^{n}c^{n}\mid m,n \geq 0 \right \}. Which of the following are context-free languages? L1∪L2L_{1} \cup L_{2} L1∩L2L_{1} \cap L_{2}
Official PYQ2017Theory of ComputationContext-free Grammars and Push-down AutomataMCQ · 1 mark
Consider the context-free grammars over the alphabet {a,b,c}\left \{ a, b, c \right \} given below. SS and TT are non-terminals. G1:S→aSb∣T,T→cT∣ϵG_{1}:S\rightarrow aSb \mid T, T \rightarrow cT \mid \epsilon G2:S→bSa∣T,T→cT∣ϵG_{2}:S\rightarrow bSa \mid T, T \rightarrow cT \mid \epsilon The language L(G1)∩L(G2)L\left ( G_{1} \right )\cap L(G_{2}) is
Official PYQ2017Theory of ComputationContext-free Grammars and Push-down AutomataMCQ · 1 mark
If GG is a grammar with productions S→SaS∣aSb∣bSa∣SS∣ϵS\rightarrow SaS\mid aSb\mid bSa\mid SS\mid\epsilon where SS is the start variable, then which one of the following strings is not generated by GG?
Official PYQ2017Theory of ComputationContext-free Grammars and Push-down AutomataMCQ · 1 mark
Consider the following context-free grammar over the alphabet Σ={a,b,c}\Sigma = \{a,b,c\} with SS as the start symbol:S→abScT∣abcTS \rightarrow abScT \mid abcTT→bT∣bT \rightarrow bT \mid bWhich one of the following represents the language generated by the above grammar?
Official PYQ2017Theory of ComputationContext-free Grammars and Push-down AutomataMCQ · 1 mark
Identify the language generated by the following grammar, where SS is the start variable. S→XYS \rightarrow XY X→aX∣aX \rightarrow aX \mid a Y→aYb∣ϵY \rightarrow aYb \mid \epsilon
Official PYQ2016Theory of ComputationContext-free Grammars and Push-down AutomataMCQ · 1 mark
Consider the transition diagram of a PDA given below with input alphabet Σ={a,b}\Sigma=\{a,b\} and stack alphabet Γ={X,Z}\Gamma = \{X,Z\}. ZZ is the initial stack symbol. Let LL denote the language accepted by the PDA Which one of the following is TRUE?
Official PYQ2016Theory of ComputationContext-free Grammars and Push-down AutomataMCQ · 1 mark
Consider the following context-free grammars; G1:S→aS∣B,B→b∣bBG_1 : S \to aS \mid B, B \to b \mid bB G2:S→aA∣bB,A→aA∣B∣ε,B→bB∣εG_2 : S \to aA \mid bB, A \to aA \mid B \mid \varepsilon,B \to bB \mid \varepsilon Which one of the following pairs of languages is generated by G1G_1 and G2G_2 ,respectively?
Official PYQ2016Theory of ComputationContext-free Grammars and Push-down AutomataMCQ · 1 mark
Which of the following languages is generated by the given grammar? S→aS∣bS∣εS \rightarrow aS \mid bS \mid \varepsilon