Skip to content

GATE CS Theory of Computation questions

Practise Theory of Computation questions for GATE CS. Explore official PYQs and original subject-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 PYQ2026Theory of ComputationRegular Expressions and Finite AutomataMSQ · 1 mark
Let MM be a nondeterministic finite automaton (NFA) with 66 states over a finite alphabet. Which of the following options CANNOT be the number of states in the minimal deterministic finite automaton (DFA) that is equivalent to MM ?
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 ComputationTuring MachinesMCQ · 1 mark
Which one of the following statements is equivalent to the following assertion? Turing machine MM decides the language L⊆{0,1}∗L \subseteq\{0,1\}^{*}
Official PYQ2026Theory of ComputationRegular Expressions and Finite AutomataMSQ · 2 marks
Consider the following two finite automata D1D_{1} and D2D_{2}. Which of the following statements is/are true?
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 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 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 Expressions and Finite AutomataMCQ · 2 marks
Consider the following deterministic finite automaton (DFA) defined over the alphabet, Σ={a,b}\Sigma=\{a, b\}. Identify which of the following language(s) is/are accepted by the given DFA.
Official PYQ2025Theory of ComputationRegular Expressions and Finite AutomataNAT · 2 marks
Consider a finite state machine (FSM) with one input XX and one output ff, represented by the given state transition table. The minimum number of states required to realize this FSM is _______. (Answer in integer). …
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 Expressions and Finite AutomataNAT · 2 marks
Let Σ={1,2,3,4}\Sigma=\{1,2,3,4\}. For x∈Σ∗x \in \Sigma^{*}, let prod⁡(x)\operatorname{prod}(x) be the product of symbols in xx modulo 7. We take prod⁡(ϵ)=1\operatorname{prod}(\epsilon)=1, where ϵ\epsilon is the null string. For example, prod⁡(124)=(1×2×4) mod 7=1\operatorname{prod}(124)=(1 \times 2 \times 4) \bmod 7=1. Define …
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 PYQ2025Theory of ComputationUndecidabilityMCQ · 1 mark
​​​​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?
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 PYQ2024Theory of ComputationRegular Expressions and Finite AutomataMSQ · 2 marks
​Consider the 55 -state DFA\text{DFA}. MM accepting the language L(M)⊂(0+1)∗L(M) \subset(0+1)^{*} shown below. For any string w∈(0+1)∗w \in(0+1)^* let n0(w)n_0(w) be the number of 0′s0^{\prime} s in ww and n1(w)n_1(w) be the number of 1 's in ww. Which of the following statements is/are FALSE?