Skip to content
Early access — you're among the first to try PYQLabs. Share feedback

GATE CSE & IT

2,749 questions · 40 years · 20 subjects

Public preview: use this branch page to find high-signal topics and keyed questions. Explanations are being added selectively, starting with recent and recurring concepts.

Worked PYQ examples

Open a few full study-layer explanations before signing in.

Browse explained PYQs →

High-yield topics

All trends →

Practice CSE & IT PYQs

80 questions shown in Theory of Computation. Filter for cleaner practice sessions.

Showing Theory of Computation PYQs from CSE & IT.
2026 PYQ

Which one of the following statements is equivalent to the following assertion? Turing machine $M$ decides the language $L \subseteq\{0,1\}$.

Theory of Computation/MCQ/answer key/explanation
2026 PYQ

Let $\Sigma=\{a, b, c, d\}$ and let $L=\left\{a^i b^j c^k d^l \mid i, j, k, l \geq 0\right\}$. Which of the following constraints ensure(s) that the language $L$ is context-free?

Theory of Computation/MSQ/answer key/explanation
2026 PYQ

Let $L_1$ and $L_2$ be two languages over a finite alphabet, such that $L_1 \cap L_2$ and $L_2$ are regular languages. Which of the following statements is/are always true?

Theory of Computation/MSQ/answer key/explanation
2026 PYQ

Consider the following grammar where $S$ is the start symbol, and $a$ and $b$ are terminal symbols. $$ S \rightarrow a S b S|b S| \in $$ Which of the following statements is/are tr...

Theory of Computation/MSQ/answer key/explanation
2026 PYQ

Consider the following context-free grammar $G$ : $$ \begin{aligned} & 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...

Theory of Computation/MCQM/answer key/explanation
2026 PYQ

Which of the following grammars is/are ambiguous?

Theory of Computation/MSQ/answer key/explanation
2026 PYQ

The determinant of a $4 \times 4$ matrix $A$ is 3 . The value of the determinant of $2 A$ is $\_\_\_\_$ . (answer in integer)

Theory of Computation/NAT/explanation
2026 PYQ

Let $M$ be a non-deterministic finite automaton (NFA) with 6 states over a finite alphabet. Which of the following options CANNOT be the number of states in the minimal determinist...

Theory of Computation/MCQ/answer key/explanation
2025 PYQ

Let $\Sigma=\{1,2,3,4\}$ For $x \in \Sigma^*$, let prod $(x)$ be the product of symbols in $x$ modulo 7 . We take $\operatorname{prod}(\varepsilon)=1$, where $\varepsilon$ is the n...

Theory of Computation/NAT
2025 PYQ

Let $\Sigma=\{a, b, c\}$. For $x \in \Sigma^{\star}$, and $\alpha \in \Sigma$, let $\#_\alpha(x)$ denote the number of occurrences of a in $x$. Which one or more of the following o...

Theory of Computation/MSQ/answer key/explanation
2025 PYQ

Which ONE of the following languages is accepted by a deterministic pushdown automaton?

Theory of Computation/MCQ/answer key/explanation
2025 PYQ

Consider the following two languages over the alphabet $\{a, b\}$ : $$\begin{aligned} & L_1=\left\{\alpha \beta \alpha \mid \alpha \in\{a, b\}^{+} \text {AND } \beta \in\{a, b\}^{+...

Theory of Computation/MCQ/answer key/explanation
2025 PYQ

Consider the two lists List-I and List-II given below: List - I List - II (i) Context free languages (a) Closed under union (ii) Recursive languages (b) Not closed under complement...

Theory of Computation/MTF/answer key/explanation
2025 PYQ

Let $G_1, G_2$ be Context Free Grammars (CFGs) and $R$ be a regular expression. For a grammar $G$, let $L(G)$ denote the language generated by $G$. Which ONE among the following qu...

Theory of Computation/MCQ/answer key/explanation
2025 PYQ

Consider a finite state machine (FSM) with one input $X$ and one output $f$, represented by the given state transition table. The minimum number of states required to realize this...

Theory of Computation/NAT/explanation
2025 PYQ

Consider the following two languages over the alphabet $\{a, b, c\}$, where $m$ and $n$ are natural numbers. $$\begin{aligned} & L_1=\left\{a^m b^m c^{m+n} \mid m, n \geq 1\right\}...

Theory of Computation/MCQ/answer key/explanation
2025 PYQ

Consider the following context-free grammar $G$, where $S, A$, and $B$ are the variables (nonterminals), $a$ and $b$ are the terminal symbols, $S$ is the start variable, and the ru...

Theory of Computation/MCQ/answer key/explanation
2025 PYQ

A regular language $L$ is accepted by a non-deterministic finite automaton (NFA) with $n$ states. Which of the following statement(s) is/are FALSE?

Theory of Computation/MSQ/answer key/explanation
2024 PYQ

Let L 1 be the language represented by the regular expression b * ab * (ab * ab * ) * and L 2 = { w ∈ (a + b) * | |w| ≤ 4 } , where |w| denotes the length of string w . The number...

Theory of Computation/NAT/explanation
2024 PYQ

Let G = (V, Σ, S, P) be a context-free grammar in Chomsky Normal Form with Σ = { a, b, c } and V containing 10 variable symbols including the start symbol S . The string w = a 30 b...

Theory of Computation/NAT/explanation
2024 PYQ

Consider the following two regular expressions over the alphabet {0,1} : $$r = 0^* + 1^*$$ $$s = 01^* + 10^*$$ The total number of strings of length less than or equal to 5, which...

Theory of Computation/NAT/explanation
2024 PYQ

Consider a context-free grammar $G$ with the following 3 rules. $S \rightarrow aS, \ S \rightarrow aSbS, S \rightarrow c$ Let $w \in L(G)$. Let $n_a(w)$, $n_b(w)$, $n_c(w)$ denote...

Theory of Computation/MSQ/answer key/explanation
2024 PYQ

Let $L_1, L_2$ be two regular languages and $L_3$ a language which is not regular. Which of the following statements is/are always TRUE?

Theory of Computation/MSQ/answer key/explanation
2023 PYQ

Consider the context-free grammar G below $$\matrix{ S & \to & {aSb|X} \cr X & \to & {aX|Xb|a|b,} \cr } $$ where S and X are non-terminals, and a and b are terminal symbols. The st...

Theory of Computation/MCQ/answer key/explanation
2023 PYQ

Which of the following statements is/are CORRECT?

Theory of Computation/MSQ/answer key/explanation
2023 PYQ

Consider the following definition of a lexical token id for an identifier in a programming language, using extended regular expressions: $$\mathrm{letter\to[A-Za-z]}$$ $$\mathrm{le...

Theory of Computation/MCQ/answer key/explanation
2023 PYQ

Consider the language L over the alphabet {0, 1}, given below: $$L = \{ w \in {\{ 0,1\} ^ * }|w$$ does not contain three or more consecutive $$1's\} $$. The minimum number of state...

Theory of Computation/NAT/explanation
2022 PYQ

Consider the following languages: $$\eqalign{ & {L_1} = \{ ww|w \in \{ a,b\} *\} \cr & {L_2} = \{ {a^n}{b^n}{c^m}|m,\,n \ge 0\} \cr & {L_3} = \{ {a^m}{b^n}{c^n}|m,\,n \ge 0\} \cr}...

Theory of Computation/MSQ/answer key/explanation
2022 PYQ

Which of the following is/are undecidable?

Theory of Computation/MSQ/answer key/explanation
2022 PYQ

Consider the following languages: L 1 = {a n wa n | w $$\in$$ {a, b}*} L 2 = {wxw R | w, x $$\in$$ {a, b}*, | w | , | x | > 0} Note that w R is the reversal of the string w. Which...

Theory of Computation/MCQ/answer key/explanation
2022 PYQ

Which of the following statements is/are TRUE?

Theory of Computation/MSQ/answer key/explanation
2021 PYQ

Let L ⊆ {0,1}* be an arbitrary regular language accepted by a minimal DFA with k states. Which one of the following languages must necessarily be accepted by a minimal DFA with k s...

Theory of Computation/MCQ/answer key/explanation
2021 PYQ

Suppose that L 1 is a regular and L 2 is a context-free language, Which one of the following languages is NOT necessarily context-free?

Theory of Computation/MCQ/answer key/explanation
2021 PYQ

Which of the following regular expressions represent(s) the set of all binary numbers that are divisible by three? Assume that the string ∈ divisible by three.

Theory of Computation/MSQ/answer key/explanation
2021 PYQ

Let $$\left\langle M \right\rangle $$ denote an encoding of an automation M. Suppose that ∑ = {0, 1}. Which of the following languages is/are NOT recursive?

Theory of Computation/MCQ/answer key/explanation
2021 PYQ

Let L 1 be a regular language and L 2 be a context-free language. Which of the following languages is/are context-free?

Theory of Computation/MSQ/answer key/explanation
2021 PYQ

For a string w, we define w R to be the reverse of w. For example, if w = 01101 then w R = 10110. Which of the following languages is/are context-free?

Theory of Computation/MSQ/answer key/explanation
2021 PYQ

Consider the following language. L = { w ∈ {0, 1}* | w ends with the substring 011} Which one of the following deterministic finite automata accepts L?

Theory of Computation/MCQ/answer key/explanation
2021 PYQ

For a Turing machine M, {M} denotes an encoding of M. Consider the following two languages. L 1 = {(M) | M takes more than 2021 steps on all inputs} L 2 = {(M) | M takes more than...

Theory of Computation/MCQ/answer key/explanation
2021 PYQ

Consider a network using the pure ALOHA medium access control protocol, where each frame is of length 1,000 bits. The channel transmission rate is 1 Mbps (= 10 6 bits per second)....

Theory of Computation/NAT/explanation
2021 PYQ

Consider the following two statements about regular languages: S 1 : Every infinite regular language contains an undecidable language as a subset. S 2 : Every finite language is re...

Theory of Computation/MCQ/answer key/explanation
2020 PYQ

Consider the language L = { $${a^n}|n \ge 0$$ } $$ \cup $$ { $${a^n}{b^n}|n \ge 0$$ } and the following statements. I. L is deterministic context-free. II. L is context-free but no...

Theory of Computation/STMT/answer key/explanation
2020 PYQ

Consider the following statements. I. If L 1 $$ \cup $$ L 2 is regular, then both L 1 and L 2 must be regular. II. The class of regular languages is closed under infinite union. Wh...

Theory of Computation/STMT/answer key/explanation
2020 PYQ

Consider the following languages. L 1 = {wxyx | w, x, y ∈ (0 + 1) + } L 2 = {xy | x, y ∈ (a + b)*, |x| = |y|, x ≠ y} Which one of the following is TRUE?

Theory of Computation/MCQ/answer key/explanation
2020 PYQ

Which one of the following regular expressions represents the set of all binary strings with an odd number of 1’s?

Theory of Computation/MCQ/explanation
2020 PYQ

Consider the following language. L = {x $$ \in $$ {a, b}* | number of a’s in x is divisible by 2 but not divisible by 3} The minimum number of states in a DFA that accepts L is ___...

Theory of Computation/NAT/explanation
2020 PYQ

Which of the following languages are undecidable? Note that $$\langle M\rangle $$ indicates encoding of the Turing machine M. L 1 = $$\left\{ {\langle M\rangle |L\left( M \right) =...

Theory of Computation/MCQ/answer key/explanation
2019 PYQ

Consider the following sets : S1. Set of all recursively enumerable languages over the alphabet $\{0,1\}$ S2. Set of all syntactically valid C programs S3. Set of all languages ove...

Theory of Computation/MCQ/answer key/explanation
2019 PYQ

If L is a regular language over Σ = {a, b}, which one of the following languages is NOT regular?

Theory of Computation/MCQ/answer key/explanation
2019 PYQ

Let $\Sigma$ be the set of all bijections from $\{1, \ldots, 5\}$ to $\{1, \ldots, 5\}$, where id denotes the identity function, i.e. $\operatorname{id}(j)=j, \forall j$. Let $\cir...

Theory of Computation/NAT/explanation
2019 PYQ

For Σ = {a, b}, let us consider the regular language L = {x | x = a 2+3k or x = b 10+12k , k ≥ 0}. Which one of the following can be a pumping length (the constant guaranteed by th...

Theory of Computation/MCQ/answer key/explanation
2019 PYQ

Which one of the following languages over $\Sigma=\{a, b\}$ is NOT context-free?

Theory of Computation/MCQ/answer key/explanation
2018 PYQ

Consider the following languages: $$\,\,\,\,\,\,\,\,{\rm I}.\,\,\,\,\,\,\,$$ $$\left\{ {{a^m}{b^n}{c^p}{d^q}} \right.|m + p = n + q,$$ where $$\left. {m,n,p,q \ge 0} \right\}$$ $$\...

Theory of Computation/MCQ/answer key/explanation
2018 PYQ

The set of all recursively enumerable languages is

Theory of Computation/MCQ/answer key/explanation
2018 PYQ

Consider the following problems. $$L(G)$$ denotes the language generated by a grammar $$G.$$ $$L(M)$$ denotes the language accepted by a machine $$M.$$ $$\,\,\,\,\,\,\,\,{\rm I}.\,...

Theory of Computation/STMT/answer key/explanation
2018 PYQ

Let $$N$$ be an $$NFA$$ with $$n$$ states. Let $$k$$ be the number of states of a minimal $$DFA$$ which is equivalent to $$N.$$ Which one of the following is necessarily true?

Theory of Computation/MCQ/answer key/explanation
2016 PYQ

Consider the following languages : $$$\eqalign{ & {L_1} = \left\{ {{a^n}{b^m}{c^{n + m}}:m,n \ge 1} \right\} \cr & {L_2} = \left\{ {{a^n}{b^n}{c^{2n}}:n \ge 1} \right\} \cr} $$$ Wh...

Theory of Computation/MCQ/answer key
2016 PYQ

Consider the following languages. $$\,\,\,\,\,\,\,\,\,\,\,\,$$ $${L_1} = \left\{ {\left\langle M \right\rangle |M} \right.$$ takes at least $$2016$$ steps on some input $$\left. \,...

Theory of Computation/MCQ/answer key
2016 PYQ

Which of the following languages is generated by the given grammar? $$$S \to aS|bS|\varepsilon $$$

Theory of Computation/MCQ/answer key/explanation
2016 PYQ

The number of states in the minimum sized $$DFA$$ that accepts the language defined by the regular expression $$${\left( {0 + 1} \right)^ * }\left( {0 + 1} \right){\left( {0 + 1} \...

Theory of Computation/NAT
2016 PYQ

Which of the following decision problems are undecidable? $$\,\,\,\,\,\,\,\,\,\,{\rm I}.\,\,\,\,\,\,\,\,\,\,$$ Given $$NFAs$$ $${N_1}$$ and $${N_2},$$ is $$L\left( {{N_1}} \right)...

Theory of Computation/MCQ/answer key
2016 PYQ

Consider the following two statements : $$\,\,\,\,\,\,\,{\rm I}.\,\,\,\,\,$$ If all states of an $$NFA$$ are accepting states then the language accepted by the $$\,\,\,\,\,\,\,\,\,...

Theory of Computation/MCQ/answer key
2016 PYQ

Consider the following context-free grammars: $$\eqalign{ & {G_1}:\,\,\,\,\,S \to aS|B,\,\,B \to b|bB \cr & {G_2}:\,\,\,\,\,S \to aA|bB,\,\,A \to aA|B|\varepsilon ,\,\,B \to bB|\va...

Theory of Computation/MCQ/answer key
2016 PYQ

Which one of the following regular expressions represents the language: the set of all binary strings having two consecutive $$0s$$ and two consecutive $$1s?$$

Theory of Computation/MCQ/answer key/explanation
2016 PYQ

Consider the following types of languages: $${L_1}:$$ Regular, $${L_2}:$$ Context-free, $${L_3}:$$ Recursive, $${L_4}:$$ Recursively enumerable. Which of the following is/are TRUE...

Theory of Computation/MCQ/answer key
2016 PYQ

Language $${L_1}$$ is defined by the grammar: $$S{}_1 \to a{S_1}b|\varepsilon $$ Language $${L_2}$$ is defined by the grammar: $$S{}_2 \to ab{S_2}|\varepsilon $$ Consider the follo...

Theory of Computation/STMT/answer key
2016 PYQ

Let $$X$$ be a recursive language and $$Y$$ be a recursively enumerable but not recursive language. Let $$W$$ and $$Z$$ be two languages such that $$\overline Y $$ reduces to $$W,$...

Theory of Computation/MCQ/answer key
2015 PYQ

The number of states in the minimal deterministic finite automaton corresponding to the regular expression $${\left( {0 + 1} \right)^{\,\, * }}\left( {10} \right)$$ is ____________...

Theory of Computation/NAT
2015 PYQ

Language $${L_1}$$ is polynomial time reducible to language $${L_2}$$ . Language $${L_3}$$ is polynomial time reducible to $${L_2}$$ , which in turn is polynomial time reducible to...

Theory of Computation/STMT/answer key/explanation
2015 PYQ

Consider the alphabet $$\sum { = \left\{ {0,1} \right\},} $$ the null/empty string $$\lambda $$ and the sets of strings $${X_0},\,{X_1},$$ and $${X_2}$$ generated by the correspond...

Theory of Computation/MCQ/answer key
2015 PYQ

Consider the following statements. $$\,\,\,$$ $${\rm I}.\,\,\,\,\,\,\,\,\,$$ The complement of every Turing decidable language is Turing decidable $$\,$$ $${\rm II}.\,\,\,\,\,\,\,\...

Theory of Computation/STMT/answer key
2015 PYQ

For any two languages L 1 and L 2 such that L 1 is context-free and L 2 is recursively enumerable but not recursive, which of the following is/are necessarily true? I. $${\overline...

Theory of Computation/STMT/answer key
2015 PYQ

Which of the following languages is/are regular? $${L_1}:\left\{ {wx{w^R}|w,x\, \in \left\{ {a,b} \right\}{}^ * } \right.$$ and $$\left. {\left| w \right|,\left| x \right| > 0} \ri...

Theory of Computation/MCQ/answer key
2015 PYQ

Which of the following languages are context-free? $$$\eqalign{ & {L_1} = \left\{ {{a^m}{b^n}{a^n}{b^m}|m,n \ge 1} \right\} \cr & {L_2} = \left\{ {{a^m}{b^n}{a^m}{b^n}|m,n \ge 1} \...

Theory of Computation/MCQ/answer key/explanation
2015 PYQ

Let $$L$$ be the language represented by the regular expression $$\sum {^ * 0011\sum {^ * } } $$ where $$\sum { = \left\{ {0,1} \right\}} .$$ What is the minimum number of states i...

Theory of Computation/MCQ/answer key
2014 PYQ

Which one of the following is TRUE?

Theory of Computation/MCQ/answer key
2014 PYQ

Let $$ < M > $$ be the encoding of a Turing machine as a string over $$\sum { = \left\{ {0,1} \right\}.} $$ Let $$L = \left\{ { < M > \left| M \right.} \right.$$ is a Turing machin...

Theory of Computation/MCQ/answer key
2014 PYQ

Let $$A\,\,{ \le _m}\,\,B$$ denotes that language $$A$$ is mapping reducible (also known as many-to-one reducible) to language $$B.$$ Which one of the following is FALSE?

Theory of Computation/MCQ/answer key
2014 PYQ

Let $${L_1} = \left\{ {w \in \left\{ {0,1} \right\}{}^ * \left| w \right.} \right.$$ has at least as many occurrences of $$(110)'s$$ as $$(011)'s$$$$\left. \, \right\}$$. Let $${L_...

Theory of Computation/MCQ/answer key
2014 PYQ

Which one of the following problems is un-decidable?

Theory of Computation/MCQ/answer key