Counted from the questions in the past papers listed on this site. Repeated = how many times the topic came in those papers.
Theory of Computation important questions with answers
Each answer starts with the short answer. Then come the points to write, a diagram and an exam tip. The questions under each topic are copied from the RGPV papers.
Q1. Mealy and Moore machines: difference and conversion
Asked 24 times in 2020, 2022, 2023, 2024, 2025, 2026 · Unit 1
From the papers
“Differentiate between Moore machine and Mealy machine with suitable examples.” (2025, 2026)
“Design a Moore machine to find the residue mod 2 of a binary input.” (2023, 2024)
“Design a Mealy machine to detect 101 in a binary stream and convert it into a Moore machine.” (2026)
The short answer
Both are finite automata with output: a Moore machine gives its output from the state alone. A Mealy machine gives it on the transition, from the state together with the current input.
Write these points
Moore machine: M = (Q, Σ, Δ, δ, λ, q0) with λ: Q → Δ. The six parts are states, input alphabet, output alphabet, transition function, output function and start state.
Mealy machine: the same six parts, but λ: Q × Σ → Δ.
For an input of length n, a Moore machine gives n + 1 outputs because the start state also gives one. A Mealy machine gives n outputs.
Moore to Mealy: for each move from p to q on a, write the output λ(q) of the state it enters on that edge. The number of states stays the same.
Mealy to Moore: find every state that is entered with different outputs. Split such a state q into q/0 and q/1. Copy the outgoing moves of q to both copies. States entered with one output only are not split.
Moore may need more states. Mealy reacts to the input in the same step.
Point
Moore
Mealy
Output depends on
Present state only
Present state and input
Outputs for n inputs
n + 1
n
Number of states
Often more
Often fewer
Output written
Inside the state
On the edge
Example.
In the figure, A on 0 goes to B with output 0 and B on 1 goes to A with output 1. A is entered with outputs 0 and 1, so it splits into A/0 and A1/1. B is entered only with output 0, so it stays one state.
Real-life example
A lift shows the floor number for the floor it is on. That is a Moore output, tied to the state. A vending machine gives a can only when the last coin goes in. That output belongs to the transition, like a Mealy machine.
Both machines print 1 when the input read so far ends in 01.
Same or opposite: Mealy and Moore machine
Point
Mealy
Moore
Same or opposite
Output depends on
State and input
State only
Opposite
Output for input of length n
n symbols
n + 1 symbols
Opposite
States needed
Fewer
Same or more
Opposite
Finite automaton with output
Yes
Yes
Same
Exam tip. In Mealy to Moore, first list the outputs each state is entered with. Split only those states. In Moore to Mealy the edge gets the output of the target state, not the source state. Draw both machines and give the transition table for each.
Q2. Design a PDA for a given language (aⁿbⁿ, wwᴿ, wcwᴿ)
Asked 23 times in 2020, 2022, 2023, 2024, 2025, 2026 · Unit 4
From the papers
“Construct a PDA for L = {ww | w in (a+b)*}.” (2023, 2025)
“Design a PDA for L = {a^n b^n | n >= 1}.” (2023, 2025)
“Construct PDAs by empty stack for a^n b^m c^n (n, m >= 1) and a^n b^(2n).” (2023, 2024)
The short answer
A pushdown automaton (PDA) is a finite automaton with a stack. To design one, decide what to push while the first part of the input is read, then what to pop while the second part is read.
Write these points
Formal form: M = (Q, Σ, Γ, δ, q0, Z0, F). The move δ(q, a, X) = (p, γ) means: in state q, reading a with X on top, go to p and replace X by the string γ.
For aⁿbⁿ: push one a for every a. On the first b change state. Pop one a for each b. If only Z0 is left at the end, accept.
Transitions for aⁿbⁿ (n ≥ 1), pushing the a's: δ(q0, a, Z0) = (q0, aZ0) and δ(q0, a, a) = (q0, aa).
Popping for the b's: δ(q0, b, a) = (q1, ε) and δ(q1, b, a) = (q1, ε).
Ending: δ(q1, ε, Z0) = (q2, Z0). q2 is the final state.
For wcwᴿ: push every symbol of w. On c move to a pop state. Each later symbol must match the top and is popped. Only Z0 left at the end means accept. This PDA is deterministic.
For wwᴿ there is no centre mark. The PDA guesses the middle with an ε-move from the push state to the pop state. So it must be non-deterministic.
For aⁿb²ⁿ push two a's for each a and pop one for each b. For a²ⁿbⁿ push one for each a. On each b pop one, then pop one more with an ε-move.
Acceptance can be by final state or by empty stack. Both give the same class of languages. Say which one you use.
Example.
Trace of aabb: (q0, aabb, Z0) ⊢ (q0, abb, aZ0) ⊢ (q0, bb, aaZ0) ⊢ (q1, b, aZ0) ⊢ (q1, ε, Z0) ⊢ (q2, ε, Z0). It is accepted. For aab the machine stops in q1 with a still on the stack, so it rejects.
Real-life example
When you type code, the editor checks that every opening bracket has a closing one. It pushes each ( on a stack and pops it at each ). That is exactly how a PDA accepts aⁿbⁿ.
PDA for aⁿbⁿ. A label a, X / γ means: read a, X on top, replace X by γ.
Same or opposite: PDA for wcwᴿ and PDA for wwᴿ
Point
wcwᴿ
wwᴿ
Same or opposite
Middle marked
Yes, by c
No
Opposite
Type of PDA
Deterministic
Non-deterministic
Opposite
Push first half, pop second half
Yes
Yes
Same
Guess needed
No
Yes, where the middle is
Opposite
Exam tip. Show the instantaneous descriptions for one accepted string, because the trace carries marks. Write δ as a list of moves, since a diagram alone is not enough. If {ww} is asked, write that it is not a CFL, so no PDA accepts it.
Asked 20 times in 2020, 2022, 2023, 2024, 2025, 2026 · Unit 3
From the papers
“Define Chomsky normal form and Greibach normal form with examples.” (2024, 2026)
“Convert S -> aSb | SS | e to Chomsky normal form.” (2024, 2025)
“Explain CNF and GNF and compare the two normal forms.” (2026)
The short answer
A CFG is in Chomsky normal form (CNF) when every production is A → BC or A → a. It is in Greibach normal form (GNF) when every production is A → aα, with a terminal a followed by variables α.
Write these points
Before either form, clean the grammar. Remove ε-productions first, then unit productions, then useless symbols.
CNF step 1: in every body of length 2 or more, replace each terminal a by a new variable Ca. Add Ca → a.
CNF step 2: break long bodies into pairs. A → B1B2B3 becomes A → B1D1 and D1 → B2B3.
GNF step 1: rename the variables A1, A2, ..., An. Substitute until every production Ai → Ajγ has j > i.
GNF step 2: remove left recursion. A → Aα | β becomes A → β | βZ with Z → α | αZ.
GNF step 3: substitute back from An down to A1 so every body starts with a terminal. Then fix the Z productions the same way.
In CNF a string of length n is derived in exactly 2n − 1 steps and the parse tree is binary. The CYK algorithm needs CNF.
Example.
S → aSb | ab to CNF. Add A → a and B → b, so S → ASB | AB. Break ASB with C → SB. Result: S → AC | AB, C → SB, A → a, B → b.
Real-life example
Compilers often rewrite a grammar into a fixed shape before parsing. The CYK parsing algorithm needs CNF. A top-down parser is easier to build when every rule starts with a terminal, as in GNF.
Clean the grammar first, then convert.
Same or opposite: CNF and GNF
Point
CNF
GNF
Same or opposite
Rule shape
A → BC or A → a
A → aα
Opposite
Steps for a string of length n
2n − 1
n
Opposite
Used by
CYK algorithm
Top-down parsing, PDA building
Opposite
Every CFG without ε can be converted
Yes
Yes
Same
Exam tip. Show each step under its own heading. Marks are given step by step. An ambiguous grammar can still be put in CNF. CNF does not remove ambiguity. ε is allowed only as S → ε when ε is in the language and S is on no right side.
Asked 18 times in 2020, 2022, 2023, 2024, 2025, 2026 · Unit 2
From the papers
“Explain DFA and NDFA.” (2026)
“Explain deterministic and non-deterministic finite automata with examples.” (2025)
“Convert the NDFA d(q0,a)={q0,q1}, d(q0,b)={q0}, d(q1,b)={q1}, final q1 to a DFA.” (2025)
The short answer
An NFA can go to zero, one or many states on one symbol and may have ε-moves, while a DFA has exactly one move. Every NFA has an equal DFA, found by the subset construction.
Write these points
NFA: δ: Q × Σ → 2^Q (a set of states). DFA: δ: Q × Σ → Q (one state).
The start state of the DFA is {q0}. With ε-moves it is ε-closure(q0), the set of states reached from q0 by ε-moves alone, q0 included.
For each new subset S and each symbol a, the next state is the union of δ(q, a) for all q in S. With ε-moves, take the ε-closure of that union.
Repeat only for subsets that appear. Stop when no new subset comes.
A subset is final if it holds at least one final state of the NFA.
An n-state NFA can need up to 2ⁿ DFA states. Both accept exactly the regular languages.
Point
DFA
NFA
Moves per symbol
Exactly one
Zero, one or more
ε-moves
Not allowed
Allowed in ε-NFA
Dead state
Needed for a complete DFA
Not needed
Accepts w when
The one path ends in F
Any path ends in F
Size
Can be large
Usually smaller
Example.
NFA: δ(q0, a) = {q0, q1}, δ(q0, b) = {q0}, δ(q1, b) = {q1}, final q1. {q0} on a gives {q0, q1} and on b gives {q0}. {q0, q1} on a gives {q0, q1} and on b gives {q0} ∪ {q1} = {q0, q1}. So the DFA has two states and {q0, q1} is final.
Real-life example
A regular expression typed into a search box becomes an NFA first, because that is easy. The tool then turns it into a DFA, because a DFA runs fast with one move per character. Subset construction is that step.
The NFA from the exam question and its DFA.
Same or opposite: NFA and the DFA made from it
Point
NFA
DFA from subset construction
Same or opposite
States
n
Up to 2ⁿ
Opposite
Each DFA state is
One state
A set of NFA states
Opposite
Final states
Given
Any set holding an NFA final state
Opposite
Accept the same language
Yes
Yes
Same
Exam tip. Draw the subset table first, then the DFA diagram. A subset with even one NFA final state is final. For an ε-NFA always start from the ε-closure of the start state.
Asked 17 times in 2020, 2022, 2023, 2024, 2025, 2026 · Unit 2
From the papers
“Design a DFA accepting strings with at least 3 a's over {a,b}.” (2020, 2022, 2023)
“Draw the DFA over {0,1} for strings with an even number of 0's and an even number of 1's.” (2026)
“Design a finite automaton that checks whether a binary number is divisible by three.” (2026)
The short answer
A DFA is M = (Q, Σ, δ, q0, F) where δ: Q × Σ → Q gives exactly one next state for each state and symbol. To design one, decide what each state must remember about the input read so far.
Write these points
Write a few strings that are in L and a few that are not. Then name each state by what it remembers, such as a count of a's, the last two symbols or a remainder.
Binary number divisible by k: keep the remainder. New remainder = (2r + bit) mod k. You need k states and remainder 0 is final.
Ends with a pattern (01, abb): each state remembers the longest suffix that is also a prefix of the pattern.
Contains a substring (101, 1100): use the same idea. The last state loops on every symbol.
Counting (at most 3 a's, exactly 2 a's): one state per count. Extra a's go to a dead (trap) state.
Even and odd counts (even 0's and even 1's): four states for (even, even), (even, odd), (odd, even) and (odd, odd).
Every state needs one move for every symbol. Add a dead state for missing moves and show it.
State
0
1
→ q0 (final)
q0
q1
q1
q2
q0
q2
q1
q2
Example.
Not ending with 01: first build the DFA for 'ends with 01'. A is the start, B means the last symbol was 0, C means the input ends in 01.
Moves: A: 0 → B, 1 → A. B: 0 → B, 1 → C. C: 0 → B, 1 → A.
Now swap final and non-final states, so A and B become final.
Real-life example
A metro gate, a lift controller and the pattern search in a text editor all work as DFAs. The search for 'abb' in a file is a small DFA that remembers how much of 'abb' it has seen.
Each state is the remainder so far. q0 is both start and final.
Same or opposite: DFA and NFA
Point
DFA
NFA
Same or opposite
Moves on one symbol
Exactly one
Zero, one or many
Opposite
ε-moves
Not allowed
Allowed
Opposite
Accepts regular languages
Yes
Yes
Same
Easy to design
Harder
Easier
Opposite
Easy to run in a program
Yes
Needs conversion
Opposite
Exam tip. Give the transition table as well as the diagram. Test the DFA on two strings, one accepted and one rejected. Swapping final states gives the complement only on a complete DFA, never on an NFA.
“Differentiate between decidable and recursively enumerable languages.” (2023, 2025)
The short answer
A language is recursively enumerable (r.e.) if some Turing machine accepts it, even if the machine loops on strings outside it. It is recursive (decidable) if some Turing machine accepts it and halts on every input.
Write these points
Every recursive language is r.e. The opposite is false: the halting language is r.e. but not recursive.
A problem is decidable if a TM always halts with the correct yes or no answer. Otherwise it is undecidable.
Recursive languages are closed under union, intersection and complement. For the complement, swap the accept and reject states of a machine that always halts.
R.e. languages are closed under union and intersection. They are not closed under complement.
Theorem: L is recursive if and only if L and its complement are both r.e. Run both machines side by side, one step each. One of them must accept, so the combined machine always halts.
Decidable: membership in a CFL, emptiness of a DFA. Undecidable: the halting problem, PCP, whether L(M) is regular, whether a TM halts on input 101.
Church's thesis: whatever can be computed by an algorithm can be computed by a Turing machine.
Three languages, three answers.
L1 = binary strings with an even number of 0s. A DFA decides it and always halts, so L1 is recursive.
HALT = {(M, w) : M halts on w}. Run M on w and accept if it stops. That accepts every member, so HALT is r.e.
HALT is not recursive, because no machine can also say no on every input that loops.
The complement of HALT is not even r.e. If it were, HALT and its complement would both be r.e., making HALT recursive.
Real-life example
An antivirus program cannot decide for every program whether it will ever do harm. That question is undecidable, like the halting problem. So antivirus tools use patterns and guesses instead of a perfect test.
Recursive languages sit inside the r.e. languages.
Same or opposite: recursive and recursively enumerable language
Point
Recursive
Recursively enumerable
Same or opposite
Turing machine halts
On every input
Only on strings in the language
Opposite
Also called
Decidable
Semi-decidable
Opposite
Complement is in the class
Yes
Not always
Opposite
Accepted by a Turing machine
Yes
Yes
Same
Exam tip. The whole difference is the phrase 'halts on every input'. Write it. Give one example of each class. The complement of an r.e. language that is not recursive is not even r.e.
Asked 14 times in 2020, 2022, 2023, 2024, 2025, 2026 · Unit 3
From the papers
“What is parsing? How do leftmost and rightmost derivations help to find ambiguity?” (2023, 2024)
“What is ambiguity in CFG? Explain derivation trees and illustrate ambiguity.” (2026)
“Explain derivation trees and ambiguity in CFG with examples.” (2026)
The short answer
A CFG is ambiguous if some string has two different parse trees. Two different leftmost derivations (or two different rightmost derivations) of one string show the same thing.
Write these points
To prove ambiguity give one string and two different leftmost derivations or two parse trees. One such string is a full proof.
E → E + E | E * E | id: the string id + id * id has two trees (see the figure).
S → aSbS | bSaS | ε: abab has two leftmost derivations. S ⇒ aSbS ⇒ abS ⇒ abaSbS ⇒ ababS ⇒ abab. Also S ⇒ aSbS ⇒ abSaSbS ⇒ abaSbS ⇒ ababS ⇒ abab.
S → SS | a | b: aaa can be split as (aa)a or a(aa), so it has two trees.
Removing ambiguity: there is no general method.
For expressions use one variable per precedence level with left associative operators.
Result: E → E + T | T, T → T * F | F, F → (E) | id.
Some CFLs are inherently ambiguous, for example {aⁱbʲcᵏ | i = j or j = k}. Every grammar for them is ambiguous.
Whether an arbitrary CFG is ambiguous is undecidable.
Two parse trees for id + id * id.
Grammar E → E + E | E * E | id. Derivation 1: E ⇒ E + E ⇒ id + E ⇒ id + E * E ⇒ id + id * id.
Derivation 2: E ⇒ E * E ⇒ E + E * E ⇒ id + E * E ⇒ id + id * id. Two leftmost derivations mean the grammar is ambiguous.
Put id = 2, 3, 4. Tree 1 gives 2 + (3 × 4) = 14. Tree 2 gives (2 + 3) × 4 = 20.
The grammar E → E + T | T, T → T * F | F, F → id has only the first tree. It always gives 14.
Real-life example
A calculator reading 2 + 3 × 4 must not get two answers. An ambiguous grammar would allow both 20 and 14. Precedence rules in the grammar remove the second parse tree.
Grammar E → E + E | E * E | id. Two trees for one string means ambiguous.
Same or opposite: ambiguous and unambiguous grammar
Point
Ambiguous
Unambiguous
Same or opposite
Parse trees for some string
Two or more
Exactly one
Opposite
Leftmost derivations
More than one
One
Opposite
Good for compilers
No
Yes
Opposite
Generates a language
Yes
Yes
Same
Exam tip. Both derivations must be leftmost, or both rightmost. One leftmost and one rightmost derivation of the same tree prove nothing. Draw the two parse trees side by side. After giving the unambiguous grammar, show that the same string now has one tree.
Q8. Types of Turing machine: universal, multitape, multihead
Asked 13 times in 2020, 2022, 2023, 2024, 2025, 2026 · Unit 5
From the papers
“Differentiate universal, multi-tape and multi-head Turing machines.” (2026)
“Compare multi-tape and multi-head Turing machines. How do they affect computational power?” (2025)
“Explain the different models of Turing machines.” (2024)
The short answer
A Turing machine has a finite control, an infinite tape and a read/write head that moves left or right. Its variants, such as multitape, multihead and universal machines, accept no more languages than the basic one-tape machine.
Write these points
Universal Turing machine (UTM): its input is the code of any TM M together with an input w. It simulates M on w. This is the idea behind the stored program computer.
Multitape TM: k tapes, each with its own head. One move reads all k symbols, writes on each tape and moves each head. A one-tape TM simulates it using tracks. Then t steps become O(t²) steps.
Multihead TM: one tape with several heads. A one-tape TM simulates it by marking the head positions on extra tracks.
Multidimensional TM: the tape is a grid and the head can move up, down, left or right.
Two-way infinite tape, multitrack and non-deterministic TMs are also equal in power to the basic TM.
Church-Turing thesis: anything computable by an algorithm is computable by a basic TM.
Variant
What changes
Power
Universal
Reads the code of a TM as input
Same
Multitape
k tapes, k heads
Same, but faster
Multihead
k heads on one tape
Same
Non-deterministic
Many possible moves
Same
Linear bounded
Tape limited to the input
Less (context sensitive)
Why a second tape saves time.
Check if w is a palindrome, with |w| = 100.
One tape: the head runs to the far end and back for each pair of symbols. That is about 100 + 98 + ... ≈ 5,000 moves.
Two tapes: copy w to tape 2 in 100 moves, then read tape 1 forwards and tape 2 backwards. About 300 moves in all.
Both machines accept the same language. A k-tape machine that runs t steps can be copied by a one-tape machine in about t² steps.
Real-life example
A computer that runs any program you load is a universal machine. It reads the program as data, just as a universal Turing machine reads the code of another machine on its tape.
Three tapes, one control. The gold triangles mark the three heads.
Same or opposite: single tape and multitape Turing machine
Point
Single tape
Multitape
Same or opposite
Tapes
One
k tapes, each with a head
Opposite
Speed
Slower
Faster, up to a square factor
Opposite
Recognises the same languages
Yes
Yes
Same
Easy to design
Harder
Easier
Opposite
Exam tip. End each variant with 'equal in power to the basic TM'. Explain the simulation of a multitape TM in one line. It is the usual follow-up question.
Q9. Arden's theorem and regular expression from a finite automaton
Asked 16 times in 2022, 2023, 2024, 2025, 2026 · Unit 2
From the papers
“Explain Arden's theorem. Construct the RE of the automaton using it. Write its applications.” (2023, 2024)
“State and prove Arden's theorem.” (2026)
“Explain Arden's theorem and its use in obtaining regular expressions.” (2026)
The short answer
Arden's theorem: let P and Q be regular expressions over Σ where P does not contain ε. Then the equation R = Q + RP has exactly one solution, R = QP*.
Write these points
Proof that QP* is a solution: put R = QP* on the right side. Q + QP*P = Q(ε + P*P) = QP*.
Proof that it is the only one: expand R = Q + RP again and again. R = Q(ε + P + P² + ... + Pⁱ) + RPⁱ⁺¹.
Take any string w in R with length i. Every string of P has length 1 or more, so every string of RPⁱ⁺¹ is longer than i.
So w is in Q(ε + P + ... + Pⁱ), which is inside QP*.
The same expansion shows QP* is inside R. So R = QP*.
Method for an FA: it must have no ε-moves. Write one equation per state: qi = sum of qj·a over every edge from qj to qi on a. Add ε to the equation of the start state.
Solve the equations by substitution and Arden's rule. The answer is the sum of the expressions of all final states.
Uses: finding the RE of a finite automaton, proving two REs are equal and solving the state equations of a transition system.
Example.
For the figure: Q1 = ε + Q1·1 + Q2·1 and Q2 = Q1·0 + Q2·0. Arden on Q2 gives Q2 = Q1·00*. Put it in Q1: Q1 = ε + Q1(1 + 00*1), so Q1 = (1 + 00*1)*. The final state is Q2, so RE = (1 + 00*1)*00*. It is the set of strings that end in 0.
Real-life example
Tools like grep and form validators work with regular expressions. Arden's theorem turns a drawn automaton into such an expression, so a design on paper becomes a pattern a program can use.
One equation per state, then Arden's rule.
Same or opposite: finite automaton and regular expression
Point
Finite automaton
Regular expression
Same or opposite
Form
State diagram
Algebraic formula
Opposite
Used for
Running and testing
Writing patterns
Opposite
Describes regular languages
Yes
Yes
Same
Converted by
Arden's theorem gives an RE
Thompson's method gives an NFA
Opposite
Exam tip. Write the condition 'P does not contain ε'. Many students lose a mark here. Add ε only to the equation of the start state. With two final states, join their expressions with +.
Q10. Design a Turing machine (0ⁿ1ⁿ2ⁿ, aⁿbⁿ, 2's complement)
Asked 15 times in 2020, 2022, 2023, 2024, 2025 · Unit 5
From the papers
“Design a Turing machine that computes the 2's complement of a binary string. Show it on 00000.” (2023, 2025)
“Design a Turing machine that accepts 1^n 0^n, n > 0.” (2023, 2024)
“Construct a TM to accept L = {0^n 1^n 2^n | n > 0}.” (2022, 2024)
The short answer
A Turing machine is M = (Q, Σ, Γ, δ, q0, B, F) with δ: Q × Γ → Q × Γ × {L, R}. To design one, mark the symbols you have used and travel back and forth on the tape.
Write these points
Idea for 0ⁿ1ⁿ2ⁿ: change the leftmost 0 to X. Move right to the first 1 and change it to Y. Move right to the first 2 and change it to Z. Move left back to X and repeat.
When q0 sees Y, no 0 is left. Check that only Y and Z remain up to the blank, then accept.
Mark a 0: δ(q0, 0) = (q1, X, R). Skip right: δ(q1, 0) = (q1, 0, R) and δ(q1, Y) = (q1, Y, R).
Mark a 1: δ(q1, 1) = (q2, Y, R). Skip right: δ(q2, 1) = (q2, 1, R) and δ(q2, Z) = (q2, Z, R).
Mark a 2 and turn back: δ(q2, 2) = (q3, Z, L).
Go back left: δ(q3, s) = (q3, s, L) for s = 0, 1, Y, Z. Then δ(q3, X) = (q0, X, R).
Final check: δ(q0, Y) = (q4, Y, R), δ(q4, Y) = (q4, Y, R), δ(q4, Z) = (q4, Z, R) and δ(q4, B) = (q5, B, R).
δ(q0, B) = (q5, B, R) covers n = 0. q5 is final.
For aⁿbⁿ drop the third symbol. Mark an a with X, mark a b with Y, come back and repeat.
2's complement: move right to the last bit. Then move left and copy bits unchanged up to and including the first 1. After that, flip every bit until the blank.
A missing move means the machine halts and rejects.
Example.
Trace of 012: q0012 ⊢ Xq112 ⊢ XYq22 ⊢ Xq3YZ ⊢ q3XYZ ⊢ Xq0YZ ⊢ XYq4Z ⊢ XYZq4B ⊢ XYZBq5. The machine reaches q5, so 012 is accepted.
Real-life example
Every program on your laptop can be run by a Turing machine in principle. Marking symbols and moving back and forth on the tape is how the machine counts, much like ticking off names on a list.
A label s / t, D means: read s, write t, move D. B is the blank.
Same or opposite: Turing machine and PDA
Point
Turing machine
PDA
Same or opposite
Memory
Tape, read and write anywhere
Stack, top only
Opposite
Accepts 0ⁿ1ⁿ2ⁿ
Yes
No
Opposite
Head moves
Left and right
Reads input left to right
Opposite
Has a finite control
Yes
Yes
Same
Exam tip. Write the idea in two lines before the table. It earns marks even if one move is wrong. Give the transition table and an ID trace for one short string. The 2's complement of 00000 is 00000, because no 1 is found and nothing flips.
Q11. PDA model, instantaneous description, DPDA vs NPDA
Asked 15 times in 2020, 2023, 2024, 2025, 2026 · Unit 4
From the papers
“What is PDA? Explain instantaneous description of PDA.” (2020, 2023)
“Define the concept and working of push down automata.” (2026)
“Explain the difference between deterministic and non-deterministic PDA with examples.” (2026)
The short answer
A pushdown automaton is a finite automaton with an extra stack. M = (Q, Σ, Γ, δ, q0, Z0, F), where Γ is the stack alphabet and Z0 is the start stack symbol.
Write these points
Parts: an input tape read from left to right, a finite control and a stack of unlimited size (last in, first out).
A move depends on the state, the input symbol (or ε) and the top of the stack. It changes the state and replaces the top by a string, so it can push, pop or leave the stack as it is.
Instantaneous description (ID): a triple (q, w, γ) holding the state, the unread input and the stack with its top on the left. (q, aw, Xβ) ⊢ (p, w, αβ) when δ(q, a, X) contains (p, α).
Acceptance by final state: (q0, w, Z0) ⊢* (p, ε, γ) with p in F. Acceptance by empty stack: (q0, w, Z0) ⊢* (p, ε, ε). The two are equal in power.
DPDA: for each (q, a, X) there is at most one move. Also, if δ(q, ε, X) is defined, then δ(q, a, X) is empty for every a.
PDA and FA: an FA has no memory beyond its states, so it cannot count. The stack lets a PDA accept aⁿbⁿ.
Point
DPDA
NPDA
Choices per move
At most one
Many
Languages
Deterministic CFLs only
All CFLs
Example
wcwᴿ, aⁿbⁿ
wwᴿ
Used in
Parsers (LR)
Theory of CFLs
Instantaneous descriptions for aabb.
An ID is (state, input left, stack). Take the PDA for aⁿbⁿ from Q2.
(q0, aabb, Z0) ⊢ (q0, abb, aZ0) ⊢ (q0, bb, aaZ0).
(q0, bb, aaZ0) ⊢ (q1, b, aZ0) ⊢ (q1, ε, Z0) ⊢ (q2, ε, Z0). It ends in final state q2, so aabb is accepted.
wcwᴿ has a marker c, so a DPDA knows where to turn. wwᴿ has no marker, so the machine must guess the middle: it needs an NPDA.
Real-life example
When you press back in a browser, it pops the last page from a stack. A PDA uses the same stack idea to remember how many symbols it has read.
The control reads the input and pushes or pops the stack.
Same or opposite: DPDA and NPDA
Point
DPDA
NPDA
Same or opposite
Choices per move
At most one
Many
Opposite
Accepts wwᴿ
No
Yes
Opposite
Has a stack
Yes
Yes
Same
Used in
Parsers of programming languages
Theory of all CFLs
Opposite
Exam tip. NPDA and DPDA are not equal in power. This is unlike NFA and DFA, which are equal. Write the ID with the top of the stack on the left. Draw the model with tape, control and stack.
Asked 14 times in 2022, 2023, 2024, 2025, 2026 · Unit 5
From the papers
“Discuss the halting problem.” (2023, 2024, 2026)
“Prove that no algorithm decides whether an arbitrary TM halts on input 101.” (2022, 2024)
“Explain the halting problem in detail.” (2026)
The short answer
The halting problem asks: given a Turing machine M and an input w, will M halt on w? No Turing machine can answer this for every M and w, so the problem is undecidable.
Write these points
Suppose a machine H exists. H(M, w) always halts. It says yes if M halts on w. It says no if M does not halt on w.
Build a new machine D. On input M, D runs H(M, M). If H says yes, D loops for ever. If H says no, D halts.
Run D on its own code. If D halts on D, then H said no, so D does not halt. If D does not halt, then H said yes, so D halts.
Both cases are contradictions. So H cannot exist. This is the diagonal argument.
HALT = {(M, w) | M halts on w} is r.e. A universal TM simulates M on w and accepts when M halts. HALT is not recursive.
Many problems are proved undecidable by reduction from it: M halts on input 101, M halts on some input, L(M) is regular.
Example.
Halting on 101: from (M, w) build M' that ignores its own input, writes w on the tape and runs M. M' halts on 101 exactly when M halts on w. A decider for 'halts on 101' would then decide HALT, which is impossible.
Real-life example
No tool can check every program and say whether it will hang. IDEs warn about some infinite loops, but they cannot catch all of them. The halting problem proves that no perfect checker can exist.
D does the opposite of what H predicts about it.
Same or opposite: halting problem and a decidable problem
Point
Halting problem
Decidable problem
Same or opposite
TM that always answers
Does not exist
Exists
Opposite
Example
Will M halt on w?
Does a DFA accept w?
Opposite
Proof method
Contradiction (diagonal)
Give an algorithm
Opposite
Is a yes or no question
Yes
Yes
Same
Exam tip. Write the contradiction in both directions. Half the marks are there. HALT is r.e., but its complement is not r.e.
Asked 14 times in 2020, 2022, 2023, 2024, 2025 · Unit 5
From the papers
“Explain the concept of NP-complete problems with examples.” (2023, 2024, 2025)
“Explain the difference between tractable and intractable problems.” (2024)
“Explain NP hard problems in detail.” (2020)
The short answer
P is the class of decision problems a deterministic TM solves in polynomial time. NP is the class whose yes answers can be checked in polynomial time, or solved in polynomial time by a non-deterministic TM.
Write these points
P ⊆ NP. Whether P = NP is still an open question.
A problem X is NP-hard if every problem in NP reduces to X in polynomial time. X need not be in NP.
X is NP-complete if X is in NP and X is NP-hard.
Cook's theorem: SAT is NP-complete. To prove a new problem NP-complete, show it is in NP. Then reduce a known NP-complete problem to it.
In P: sorting, shortest path, minimum spanning tree. NP-complete: SAT, 3-SAT, clique, vertex cover, Hamiltonian cycle, TSP (decision form). NP-hard but not in NP: the halting problem.
Tractable problems have polynomial time algorithms. Intractable problems are believed to need exponential time.
If any NP-complete problem gets a polynomial time algorithm, then P = NP.
Certificate {4, 5}: one addition, 4 + 5 = 9, checks it. A quick check like this puts the problem in NP.
Finding it by trying every subset takes up to 2⁶ = 64 tries. With 100 numbers that is 2¹⁰⁰ tries.
SAT was the first NP-complete problem (Cook). The halting problem is NP-hard but not in NP, because it is not even decidable.
Real-life example
Checking a solved Sudoku is quick. Solving a large one from scratch can take very long. Problems that are quick to check but may be slow to solve are in NP.
NP-complete problems are the NP-hard problems that are inside NP.
Same or opposite: NP-complete and NP-hard
Point
NP-complete
NP-hard
Same or opposite
In NP
Yes
Not needed
Opposite
Every NP problem reduces to it
Yes
Yes
Same
Example
SAT, 3-colouring
Halting problem, TSP optimisation
Opposite
Polynomial algorithm known
No
No
Same
Exam tip. Draw the set diagram and write that it assumes P ≠ NP. The reduction goes from the known hard problem to the new problem. Give two examples for each class.
Q14. Finite automata as language acceptor and translator
Asked 14 times in 2020, 2023, 2024, 2025, 2026 · Unit 1
From the papers
“Explain finite automata as a language acceptor and translator with examples.” (2023, 2025, 2026)
“Explain the concept of finite automata as a language acceptor.” (2025, 2026)
“Explain different types of automata machines in detail.” (2026)
The short answer
A finite automaton is a machine with a finite number of states that reads its input one symbol at a time. As an acceptor it answers yes or no, while as a translator it produces an output string.
Write these points
Basic terms: an alphabet Σ is a finite set of symbols. A string is a finite sequence of symbols. A language is a set of strings over Σ.
Acceptor: M = (Q, Σ, δ, q0, F). A string w is accepted if δ*(q0, w) is in F. The set of accepted strings is L(M).
Parts of the model: an input tape divided into cells, with a reading head that moves right one cell per step.
A finite control holds the current state.
Translator: a machine with output (Mealy or Moore). It maps each input string to an output string, for example the 2's complement of a binary number or its residue mod 3.
Types of automata: finite automata (DFA, NFA, ε-NFA), machines with output (Mealy, Moore), pushdown automata, linear bounded automata and Turing machines.
Properties of δ: δ(q, ε) = q and δ(q, wa) = δ(δ(q, w), a). A trap (dead) state is a non-final state that loops to itself on every symbol.
Uses: lexical analysers in compilers, text search, vending machines, traffic lights and lift controllers.
An acceptor and a translator.
Acceptor: binary numbers divisible by 3. The state is the remainder r. Each bit b gives the new r = (2r + b) mod 3.
Input 110 (that is 6): r = 0, then 1, then (2 + 1) mod 3 = 0, then 0. It ends in r = 0, so it is accepted.
Translator: a Mealy machine that outputs 1 when the input bit differs from the last one.
Input 0110 gives output 0101. The first bit has no earlier bit, so its output is 0.
Real-life example
A login form that checks an email address works as an acceptor: valid or not. A coin machine that gives change works as a translator: it turns the input coins into an output.
The same model works as an acceptor or, with an output, as a translator.
Same or opposite: acceptor and translator
Point
Acceptor
Translator
Same or opposite
Output
Accept or reject
A string of symbols
Opposite
Has final states
Yes
Not needed
Opposite
Examples
DFA, NFA
Mealy, Moore machine
Opposite
Has finite states
Yes
Yes
Same
Exam tip. Draw the block diagram with tape, head and finite control. Give one acceptor example (a DFA) and one translator example (a Mealy machine) in the same answer.
Asked 13 times in 2022, 2023, 2024, 2025, 2026 · Unit 4
From the papers
“Explain the conversion of CFG into PDA with an example.” (2026)
“Describe the conversion from PDA to CFG using the standard algorithm.” (2025)
“Convert S -> 0S1 | A, A -> 1A0 | S | e into a PDA accepting by empty stack.” (2025)
The short answer
For every CFG there is a PDA that accepts the same language, while for every PDA there is a CFG. So PDAs accept exactly the context free languages.
Write these points
CFG to PDA (one working state, empty stack): first put S on the stack with δ(q, ε, Z0) = (q, SZ0).
Expand: for each production A → α add (q, α) to δ(q, ε, A).
Match: for each terminal a add δ(q, a, a) = (q, ε).
The PDA accepts when the input is read and the stack is empty. Its moves follow a leftmost derivation.
PDA to CFG (PDA accepting by empty stack): use variables [p X q]. It means the PDA starts in p with X on top, reads some input, pops X and ends in q.
Add S → [q0 Z0 q] for every state q. For δ(p, a, X) containing (r, ε) add [p X r] → a.
For δ(p, a, X) containing (r, Y1Y2...Yk) add [p X sk] → a[r Y1 s1][s1 Y2 s2]...[sk−1 Yk sk] for every choice of states s1 to sk. Then remove useless variables.
Example.
Grammar: S → aABB | aAA, A → aBB | a, B → bBB | A.
One move per variable: δ(q, ε, S) = {(q, aABB), (q, aAA)}, δ(q, ε, A) = {(q, aBB), (q, a)}.
Also δ(q, ε, B) = {(q, bBB), (q, A)}.
One move per terminal: δ(q, a, a) = (q, ε) and δ(q, b, b) = (q, ε).
Real-life example
A parser generator such as YACC takes a grammar and builds a stack-based parser from it. That is the CFG to PDA conversion done by a tool.
Expand moves replace a variable. Match moves pop a terminal.
Same or opposite: CFG to PDA and PDA to CFG
Point
CFG to PDA
PDA to CFG
Same or opposite
Input
Grammar
Automaton
Opposite
Difficulty
Simple, one state
Harder, variables [pXq]
Opposite
Shows CFG and PDA have equal power
Yes
Yes
Same
Result size
Small
Many productions
Opposite
Exam tip. In CFG to PDA write one expand move per production and one match move per terminal. In PDA to CFG a push of k symbols with n states gives nᵏ productions. Show the pattern, then drop the useless ones. Say which acceptance you use: empty stack is the usual one for these conversions.
RGPV teaches Theory of Computation to 6 branches under one syllabus. Each branch prints its own code on the paper, but the units are the same. So one page and one PDF serve all of them.
We counted every question in the Theory of Computation papers on this site by topic, from 2020 to 2026. A topic that keeps coming back is a topic RGPV likes, so it sits higher in the table. One branch alone has only a few papers. Counting them together gives a surer list.
Theory of Computation important questions by branch
CS-501Theory of Computation important questions for CSE, Semester 5
CS-501 follows the same RGPV syllabus as the other codes on this page. The 15 topics and answers above are the CS-501 important questions too.
Theory of Computation (CS-501) asks what a computer can and cannot do, using simple machines as models. It is a Semester 5 subject of RGPV B.Tech CSE with five units that climb from finite automata to the Turing machine. Draw each machine as you learn it, because most questions ask you to build one.
Theory of Computation unit-wise brief
Unit 1: Introduction to automata theory
This unit introduces automata with examples, finite automata as language acceptors and translators, Moore and Mealy machines, composite machines, and conversion between Mealy and Moore machines. Practise one conversion each way.
Unit 2: Types of finite automata
Here you study non-deterministic (NDFA) and deterministic (DFA) finite automata, converting an NDFA to a DFA, minimising automata, regular expressions and Arden's theorem. It also covers union, intersection, concatenation, closure and the 2-way DFA. NDFA to DFA conversion is a standard question, so learn the table method.
Unit 3: Grammars
This unit covers types of grammar (regular, context free and context sensitive), derivation trees, ambiguity, simplifying a context free grammar, converting between grammars and automata, the Chomsky hierarchy, removing null and unit productions, and Chomsky and Greibach normal forms. Do each simplification step in order.
Unit 4: Push down automata
A push down automaton (PDA) is a finite automaton with a stack. The unit covers examples of PDA, deterministic and non-deterministic PDA, converting a PDA into a context free grammar and back, and the Petri net model. Trace a PDA on a short string, writing the stack at every step.
Unit 5: Turing machine
The last unit covers how to build a Turing machine, the universal Turing machine, multitape, multihead and multidimensional machines, NP-complete problems, decidable and undecidable languages, recursively enumerable languages, the halting problem and the post correspondence problem. Know the halting problem's statement and why it cannot be solved.
Units follow the RGPV scheme and syllabus, B.Tech Computer Science and Engineering, Semester 5 (AICTE flexible curriculum, w.e.f. July 2019). For the full topic list of each unit, open the Theory of Computation notes.
What are the most important topics in Theory of Computation?
By how often they were asked in the papers on this site: Mealy and Moore machines: difference and conversion (24 times); Design a PDA for a given language (aⁿbⁿ, wwᴿ, wcwᴿ) (23 times); Chomsky normal form and Greibach normal form (20 times); NFA to DFA conversion (subset construction) (18 times); Design a DFA or NFA for a given language (17 times).
How were these Theory of Computation important questions chosen?
Each topic was counted from the questions in the past papers listed on this site (2020-2026). Repeated is the number of times the topic came. The counts come from keyword matching and the answers are not teacher-reviewed, so use them together with your syllabus.
Is there a PDF of Theory of Computation important questions with answers?
Yes. The Paperwala Imp Question & Answer PDF for Theory of Computation is free to download from this page.
The 15 most repeated topics of Theory of Computation (CS-501) for RGPV B.Tech CSE semester 5, counted from the previous year papers on this site. The same syllabus is taught under 6 codes: CS-501, AD-501, CD-501, AI-601, AL-601, IO-604-B. Theory of Computation is also searched for as CS-505.