Skip to content

GATE CS Regular and Context-free Languages questions

Practise Regular and Context-free Languages 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 ComputationRegular and Context-free LanguagesMCQ · 2 marks
Let L1L_{1} and L2L_{2} be two languages over a finite alphabet, such that L1∩L2L_{1} \cap L_{2} and L2L_{2} are regular languages. Which of the following statements is/are always true?
Official PYQ2026Theory of ComputationRegular and Context-free LanguagesMSQ · 2 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 …
Official PYQ2026Theory of ComputationRegular and Context-free LanguagesMSQ · 2 marks
Let Σ={a,b,c,d}\Sigma=\{a, b, c, d\} and let L={aibjckdℓ∣i,j,k,ℓ≥0}L=\left\{a^{i} b^{j} c^{k} d^{\ell} \mid i, j, k, \ell \geq 0\right\}. Which of the following constraints ensure(s) that the language LL is context-free?
Official PYQ2025Theory of ComputationRegular and Context-free LanguagesMCQ · 1 mark
A regular language LL is accepted by a non-deterministic finite automaton (NFA) with nn states. Which of the following statement(s) is/are FALSE?
Official PYQ2025Theory of ComputationRegular and Context-free LanguagesMCQ · 2 marks
Consider the following two languages over the alphabet {a,b}\{a, b\}: L1={αβα∣α∈{a,b}+AND β∈{a,b}+}L2={αβα∣α∈{a}+AND β∈{a,b}+}\begin{array}{l} L_{1}=\left\{\alpha \beta \alpha \mid \alpha \in\{a, b\}^{+} \text{AND } \beta \in\{a, b\}^{+}\right\} \\ L_{2}=\left\{\alpha \beta \alpha \mid \alpha \in\{a\}^{+} \text{AND } \beta \in\{a, b\}^{+}\right\} \end{array} Which ONE of the following statements is CORRECT?
Official PYQ2025Theory of ComputationRegular and Context-free LanguagesMCQ · 2 marks
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}L2={ambncm+n∣m,n≥1}\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?
Official PYQ2025Theory of ComputationRegular and Context-free LanguagesMSQ · 2 marks
Let Σ={a,b,c}\Sigma=\{a, b, c\}. For x∈Σ∗x \in \Sigma^{*}, and α∈Σ\alpha \in \Sigma, let #α(x)\#_{\alpha}(x) denote the number of occurrences of α\alpha in xx. Which one or more of the following option(s) define(s) regular language(s)?
Official PYQ2025Theory of ComputationRegular and Context-free LanguagesMSQ · 1 mark
Consider the two lists List I and List II given below: …
Official PYQ2024Theory of ComputationRegular and Context-free LanguagesMSQ · 1 mark
​Let L1,L2L_1, L_2 be two regular languages and L3L_3 a language which is not regular. Which of the following statements is/are always TRUE?
Official PYQ2023Theory of ComputationRegular and Context-free LanguagesMSQ · 1 mark
Which of the following statements is/are CORRECT?\text{CORRECT}?
Official PYQ2022Theory of ComputationRegular and Context-free LanguagesMSQ · 1 mark
Which of the following statements is/are TRUE?\text{TRUE}?
Official PYQ2021Theory of ComputationRegular and Context-free LanguagesMCQ · 1 mark
Let ⟨M⟩\langle M \rangle denote an encoding of an automaton MM. Suppose that Σ={0,1}\Sigma = \{0,1\}. Which of the following languages is/are NOT\text{NOT} recursive?
Official PYQ2021Theory of ComputationRegular and Context-free LanguagesMSQ · 1 mark
Let L1L_1 be a regular language and L2L_2 be a context-free language. Which of the following languages is/are context-free?
Official PYQ2021Theory of ComputationRegular and Context-free LanguagesMCQ · 2 marks
​​​​​​Consider the following two statements about regular languages: S1S_1: Every infinite regular language contains an undecidable language as a subset. S2S_2: Every finite language is regular. Which one of the following choices is correct?
Official PYQ2020Theory of ComputationRegular and Context-free LanguagesMCQ · 1 mark
Consider the following statements. If L1∪L2L_1 \cup L_2 is regular, then both L1L_1 and L2L_2 must be regular. The class of regular languages is closed under infinite union. Which of the above statements is/are TRUE?
Official PYQ2020Theory of ComputationRegular and Context-free LanguagesMCQ · 1 mark
Consider the language L={an∣n≥0}∪{anbn∣n≥0}L = \{a^{n}\mid n \geq 0\} \cup \{a^{n}b^{n}\mid n \geq 0\} and the following statements. LL is deterministic context-free. LL is context-free but not deterministic context-free. LL is not LL(k)LL(k) for any kk. Which of the above statements is/are TRUE?
Official PYQ2020Theory of ComputationRegular and Context-free LanguagesMCQ · 2 marks
Consider the following languages. L1={wxyx∣w,x,y∈(0+1)+}L2={xy∣x,y∈(a+b)∗,∣x∣=∣y∣,x≠y}\begin{array}{ll} L_1= \{ wxyx \mid w,x,y \in (0+1)^{+} \} \\ L_2= \{xy \mid x,y \in (a+b)^{*}, \mid x \mid=\mid y \mid, x \neq y \} \end{array} Which one of the following is TRUE?
Official PYQ2020Theory of ComputationRegular and Context-free LanguagesNAT · 2 marks
Consider the following language. L={x∈{a,b}∗∣L = \{{ x\in \{a,b\}^*\mid}number of aa’s in xx divisible by 22 but not divisible by 3}3\} The minimum number of states in DFA that accepts LL is _________
Official PYQ2019Theory of ComputationRegular and Context-free LanguagesMCQ · 1 mark
If LL is a regular language over Σ={a,b}\Sigma = \{a,b\}, which one of the following languages is NOT regular?
Official PYQ2019Theory of ComputationRegular and Context-free LanguagesMCQ · 2 marks
Consider the following sets: S1: Set of all recursively enumerable languages over the alphabet {0,1}\{0, 1\} S2: Set of all syntactically valid C programs S3: Set of all languages over the alphabet {0,1}\{0,1\} S4: Set of all non-regular languages over the alphabet {0,1}\{ 0,1 \} Which of the above sets are uncountable?