🇮🇳 GATE CS & IT Engineering · subject
GATE CS & IT Engineering Theory of Computation Syllabus
The Theory of Computation syllabus for GATE CS & IT Engineering in full: 4 chapters and 9 topics, every one listed below, plus 50 Theory of Computation flashcards with answers.
Theory of Computation syllabus: all 4 chapters
Expand any chapter to see its topics and sub-topics.
-
Regular expressions and finite automata
2 topics- Regular expressions
- Finite automata
-
Context-free grammars and push-down automata
2 topics- Context-free grammars
- Push-down automata
-
Regular and context-free languages, pumping lemma
3 topics- Regular languages
- Context-free languages
- Pumping lemma
-
Turing machines and undecidability
2 topics- Turing machines
- Undecidability
GATE CS & IT Engineering Theory of Computation flashcards — 50 questions with answers
In the Chomsky hierarchy, list the four grammar types and the machine that recognizes each.
Type 0 (unrestricted) — Turing machine; Type 1 (context-sensitive) — linear bounded automaton; Type 2 (context-free) — pushdown automaton; Type 3 (regular) — finite automaton.
Define a Deterministic Finite Automaton (DFA) as a 5-tuple.
A DFA is $M = (Q, \Sigma, \delta, q_0, F)$ where $Q$ is a finite set of states, $\Sigma$ the input alphabet, $\delta: Q \times \Sigma \to Q$ the transition function, $q_0 \in Q$ the start state, and $F \subseteq Q$ the set of accepting states.
How does the transition function of an NFA differ from that of a DFA?
An NFA's transition function maps to a set of states: $\delta: Q \times (\Sigma \cup \{\epsilon\}) \to 2^{Q}$, allowing multiple (or zero) next states and $\epsilon$-moves, whereas a DFA's is $\delta: Q \times \Sigma \to Q$ (exactly one next state).
If an NFA has $n$ states, what is the maximum number of states in the equivalent DFA obtained by subset construction?
$2^{n}$ states, since each DFA state corresponds to a subset of the NFA's states.
Are DFAs and NFAs equivalent in language-recognizing power?
Yes. Both recognize exactly the class of regular languages; every NFA can be converted to an equivalent DFA via subset construction.
State the three base cases in the definition of a regular expression over alphabet $\Sigma$.
$\emptyset$ is a regex denoting the empty language; $\epsilon$ is a regex denoting $\{\epsilon\}$; for each $a \in \Sigma$, $a$ is a regex denoting $\{a\}$.
What are the three operations used to build regular expressions, in order of precedence?
Kleene star (highest), then concatenation, then union/alternation $+$ (lowest). Parentheses override precedence.
What does Kleene's theorem state?
A language is regular if and only if it can be described by a regular expression; equivalently, regular expressions and finite automata describe exactly the same class of languages.
Define the Kleene star $L^{*}$ of a language $L$.
$L^{*} = \bigcup_{i=0}^{\infty} L^{i}$ where $L^{0} = \{\epsilon\}$ and $L^{i} = L \cdot L^{i-1}$. It is the set of all strings formed by concatenating zero or more strings from $L$.
Which closure operations are the regular languages closed under?
Union, intersection, complement, concatenation, Kleene star, reversal, difference, and homomorphism — regular languages are closed under all of these.
State the regular-language pumping lemma.
For every regular language $L$ there is a pumping length $p$ such that any string $w \in L$ with $|w| \geq p$ can be written as $w = xyz$ with $|xy| \leq p$, $|y| \geq 1$, and $xy^{i}z \in L$ for all $i \geq 0$.
How is the pumping lemma used to prove a language is NOT regular?
Assume $L$ is regular with pumping length $p$, pick a string $w \in L$ with $|w| \geq p$, and show that for every valid decomposition $w = xyz$ there exists some $i$ with $xy^{i}z \notin L$, contradicting the lemma.
Show why $L = \{a^{n}b^{n} : n \geq 0\}$ is not regular using the pumping lemma idea.
Pick $w = a^{p}b^{p}$. Since $|xy| \leq p$, $y$ consists only of $a$'s; pumping to $xy^{2}z$ gives more $a$'s than $b$'s, so $xy^{2}z \notin L$. Hence $L$ is not regular.
What is the role of the Myhill-Nerode theorem?
A language $L$ is regular iff the number of equivalence classes of its right-invariant relation (Myhill-Nerode relation) is finite; that finite index equals the number of states in the minimal DFA.
What does DFA minimization produce, and is it unique?
It produces the unique (up to isomorphism) DFA with the fewest states recognizing the same language, obtained by merging indistinguishable (equivalent) states.
Define a context-free grammar (CFG) as a 4-tuple.
A CFG is $G = (V, \Sigma, R, S)$ where $V$ is the set of variables (non-terminals), $\Sigma$ the terminals, $R$ a finite set of production rules of the form $A \to \gamma$ with $A \in V$ and $\gamma \in (V \cup \Sigma)^{*}$, and $S \in V$ the start symbol.
What is the form of productions in Chomsky Normal Form (CNF)?
Every rule is either $A \to BC$ (two variables) or $A \to a$ (single terminal); $S \to \epsilon$ is allowed only if $\epsilon$ is in the language. No other rule forms are permitted.
What is the form of productions in Greibach Normal Form (GNF)?
Every production has the form $A \to a\alpha$ where $a$ is a terminal and $\alpha \in V^{*}$ is a (possibly empty) string of variables.
What does it mean for a CFG to be ambiguous?
A CFG is ambiguous if some string in its language has two or more distinct leftmost derivations (equivalently, two distinct parse trees).
What is an inherently ambiguous context-free language?
A CFL for which every CFG that generates it is ambiguous; e.g. $\{a^{i}b^{j}c^{k} : i = j \text{ or } j = k\}$. No unambiguous grammar exists for such a language.
Show the other 30 Theory of Computation flashcards
Define a pushdown automaton (PDA) as a 7-tuple.
A PDA is $M = (Q, \Sigma, \Gamma, \delta, q_0, Z_0, F)$ where $Q$ states, $\Sigma$ input alphabet, $\Gamma$ stack alphabet, $\delta: Q \times (\Sigma \cup \{\epsilon\}) \times \Gamma \to 2^{Q \times \Gamma^{*}}$, $q_0$ start state, $Z_0$ initial stack symbol, $F$ accepting states.
Are nondeterministic PDAs and deterministic PDAs equivalent in power?
No. Nondeterministic PDAs recognize exactly the context-free languages, while deterministic PDAs (DPDAs) recognize only a proper subset, the deterministic context-free languages.
What is the relationship between PDAs and context-free grammars?
A language is context-free if and only if it is accepted by some (nondeterministic) pushdown automaton; CFGs and PDAs have equivalent expressive power.
What are the two equivalent acceptance criteria for a PDA?
Acceptance by final state and acceptance by empty stack. For nondeterministic PDAs these define the same class of languages (the CFLs).
State the pumping lemma for context-free languages.
For every CFL $L$ there is a constant $p$ such that any $z \in L$ with $|z| \geq p$ can be written $z = uvwxy$ with $|vwx| \leq p$, $|vx| \geq 1$, and $uv^{i}wx^{i}y \in L$ for all $i \geq 0$.
Use the CFL pumping lemma idea to show $\{a^{n}b^{n}c^{n} : n \geq 0\}$ is not context-free.
For $z = a^{p}b^{p}c^{p}$, the substring $vwx$ spans at most two of the three symbol types; pumping changes the counts of at most two symbols, breaking equality of all three counts, so $uv^{2}wx^{2}y \notin L$.
Which closure operations are context-free languages closed under?
CFLs are closed under union, concatenation, Kleene star, reversal, and homomorphism.
Which closure operations are context-free languages NOT closed under?
CFLs are not closed under intersection or complementation. (However, the intersection of a CFL with a regular language is context-free.)
Is the intersection of a context-free language and a regular language context-free?
Yes. The class of CFLs is closed under intersection with regular languages, even though it is not closed under intersection with arbitrary CFLs.
Define a (deterministic) Turing machine as a 7-tuple.
A TM is $M = (Q, \Sigma, \Gamma, \delta, q_0, q_{accept}, q_{reject})$ where $\Gamma \supseteq \Sigma$ is the tape alphabet (including blank), and $\delta: Q \times \Gamma \to Q \times \Gamma \times \{L, R\}$ specifies the next state, symbol written, and head move.
What is the difference between a recursive (decidable) language and a recursively enumerable (recognizable) language?
A recursive language is decided by a TM that halts on all inputs (accept or reject). A recursively enumerable language is recognized by a TM that halts and accepts on members but may loop forever on non-members.
State the relationship between a language $L$ being recursive and both $L$ and its complement being recursively enumerable.
$L$ is recursive (decidable) if and only if both $L$ and its complement $\overline{L}$ are recursively enumerable.
Is the class of recursive (decidable) languages closed under complement?
Yes. Recursive languages are closed under complement (swap accept and reject states). Recursively enumerable languages are NOT closed under complement.
What is the Church-Turing thesis?
Any function that is effectively computable by an algorithm (any mechanical procedure) can be computed by a Turing machine; the TM captures the intuitive notion of effective computability.
State the halting problem and its decidability status.
The halting problem asks, given a TM $M$ and input $w$, whether $M$ halts on $w$. It is undecidable: no TM can decide $H = \{\langle M, w\rangle : M \text{ halts on } w\}$ for all inputs.
Is the halting problem recursively enumerable?
Yes, the halting problem is recursively enumerable (semi-decidable) — a universal TM can simulate $M$ on $w$ and accept if it halts — but it is not recursive (decidable).
State Rice's theorem.
Every non-trivial semantic property of the language recognized by a Turing machine is undecidable. A property is non-trivial if some TMs have it and some do not, and it depends only on the language (not the machine's encoding).
What is the standard technique for proving a problem undecidable?
Reduction: show that a known undecidable problem (e.g. the halting problem $A_{TM}$) reduces to the target problem, so a decider for the target would yield a decider for the known undecidable problem — a contradiction.
Give the membership-problem decidability status for regular and context-free languages.
Membership is decidable for both: for regular languages run the DFA on the string; for CFLs use the CYK algorithm in $O(n^{3})$ time on a CNF grammar.
Which decision problems are decidable for regular languages but undecidable for context-free languages?
Equivalence ($L_1 = L_2$), and emptiness of the complement/universality ($L = \Sigma^{*}$) are decidable for regular languages but undecidable for CFLs. Also CFL ambiguity and CFL containment are undecidable.
Are emptiness and finiteness decidable for context-free languages?
Yes. Both emptiness ($L = \emptyset$) and finiteness of a CFL are decidable, e.g. by examining which variables are generating and reachable in the grammar.
What is the time complexity of the CYK parsing algorithm and what grammar form does it require?
$O(n^{3})$ time for a string of length $n$ (with the grammar size as an additional factor); it requires the grammar in Chomsky Normal Form.
What is a leftmost derivation in a CFG?
A derivation in which, at each step, the leftmost non-terminal in the current sentential form is the one replaced by a production.
What is the language recognized by a finite automaton called, and give one example that is NOT in this class.
A regular language. An example outside the class (not regular) is $\{a^{n}b^{n} : n \geq 0\}$, which requires unbounded counting that a finite automaton cannot do.
What is the Post Correspondence Problem (PCP) and its decidability status?
Given two lists of strings $(x_1,\dots,x_n)$ and $(y_1,\dots,y_n)$, PCP asks whether there is a sequence of indices $i_1\dots i_k$ with $x_{i_1}\cdots x_{i_k} = y_{i_1}\cdots y_{i_k}$. PCP is undecidable.
How do you convert a regular expression to an NFA, and how many states does Thompson's construction add per operator?
By Thompson's construction, building NFA fragments recursively for base symbols and combining them with $\epsilon$-transitions for union, concatenation, and star. Each operator adds a constant number of states, giving an NFA linear in the regex size.
What property must hold of a DFA's transition function that need not hold for an NFA?
A DFA must be total and deterministic: exactly one transition is defined for every (state, input symbol) pair, with no $\epsilon$-moves. An NFA may have zero, one, or many transitions, plus $\epsilon$-moves.
Compare the memory models of finite automata, pushdown automata, and Turing machines.
A finite automaton has only finite-state memory (no auxiliary storage); a PDA adds a single unbounded LIFO stack; a Turing machine has an unbounded read/write tape with two-way head movement, the most powerful of the three.
Is the equivalence problem for two DFAs decidable?
Yes. Equivalence of DFAs (and of regular expressions/NFAs) is decidable — e.g. by minimizing both DFAs and checking isomorphism, or testing whether the symmetric difference language is empty.
State whether the union, intersection, and complement of two recursively enumerable languages are recursively enumerable.
Recursively enumerable languages are closed under union and intersection, but NOT under complement (the complement of an r.e. but non-recursive language is not r.e.).
GATE CS & IT Engineering Theory of Computation FAQ
What is in the GATE CS & IT Engineering Theory of Computation syllabus?
GATE CS & IT Engineering Theory of Computation is split into 4 chapters: Regular expressions and finite automata, Context-free grammars and push-down automata, Regular and context-free languages, pumping lemma and Turing machines and undecidability. Together they contain 9 topics.
How many chapters are in GATE CS & IT Engineering Theory of Computation?
4 chapters, containing 9 topics. The largest chapter is Regular and context-free languages, pumping lemma, with 3 topics.
Are there flashcards for GATE CS & IT Engineering Theory of Computation?
Yes — a 50-card Theory of Computation deck, printed in full in the flashcards section of this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.