IT-503 (A) · Theory of Computation/Unsolved PYQ Paper
IT-503-A Theory of Computation - Jun 2025 Question Paper
Under each question, How to answer lists the points an answer should cover, outlined by CampusPrep from the syllabus. Check the details against your textbook.
-
7 MarksaConstruct a NFA second last symbol is zero over the alphabet $(0, 1)$ than convert in DFA?
How to answer
- Define NFA with 3-4 states for second-last symbol 0 over {0,1}
- Show NFA transition table/diagram
- Apply subset construction to get DFA states
- Show DFA transition table/diagram and final states
-
7 MarksbDesign a DFA to accept string of 0's and 1's when interpreted as binary numbers would be multiple of 4.
How to answer
- Interpret binary value modulo 4
- Use 4 states for remainders 0,1,2,3
- Define transitions on 0 as 2*r mod 4 and on 1 as 2*r+1 mod 4
- Mark remainder-0 state as final with diagram
-
7 MarksaWrite CFG to accept the language defined by, $L \{a^i b^j c^k \, i \, j \, k, >= 0, i = j + k.$
How to answer
- Interpret condition $i=j+k$ for $a^i b^j c^k$
- Split into $a^j b^j$ and $a^k c^k$ parts
- Give productions e.g. S -> AB, A -> aAb|epsilon, B -> aBc|epsilon
- Verify with example strings
-
7 MarksbDerive Regular Expression from this Finite Automata.

How to answer
- Write state equations for q0 and q1
- Apply Arden's theorem / state elimination
- Eliminate q1 using self-loop 1
- Obtain final regular expression for accepted language
-
7 MarksaHow $\epsilon$-productions are eliminated from a grammar whose language doesn't have empty string? Remove $\epsilon$-productions from the grammar given below. $S \to a|aA|B|C, A \to aB | \epsilon, B \to Aa, C \to aCD,$ $D \to ddd$
How to answer
- Define nullable variables and epsilon-productions
- Compute nullable set: A nullable, then B, S nullable
- Add productions with nullable occurrences omitted
- Write final epsilon-free grammar
-
7 MarksbConstruct an equivalent FA for the given regular expression $(101)^*(01 + 11)(10 + 10)^*$
How to answer
- Break expression $(101)^*(01+11)(10+10)^*$ into three parts
- Construct NFA using Thompson construction for each part
- Concatenate the three automata
- Convert to DFA/FA if required and show final diagram
-
14 MarksConsider the following productions, $S \to aB|bA, A \to aS|bAA|a, B \to bS|aBB|b$ For the string aabbabbba, find the :
- i)Leftmost derivation
- ii)Rightmost derivation
- iii)Parse Tree
How to answer
- Start from S and repeatedly replace leftmost variable to get aabbabbba
- Start from S and repeatedly replace rightmost variable to get same string
- Draw parse tree with S,A,B as interior nodes and terminals as leaves
- Verify yield equals aabbabbba
-
14 MarksConstruct the PDA accepting the language.
- i)$L = \{(a^n b^{2n}) \mid n >= 1\}$ by empty stack.
- ii)$L = \{wC w^R \mid w \text{ is in } (a+b)^*\}$ by empty stack.
- iii)$L = \{a^n b^n c^{2m} \mid n >= 1\}$ by empty stack.
How to answer
- Describe PDA model and acceptance by empty stack
- Give transitions pushing a's and popping on b's for each language
- Handle center marker C for wCw^R
- Show stack behavior for sample strings
-
7 MarksaLet G be the grammar given by $S \to aABB/aAA, A \to aBB/a, B \to bBB/A$ construct the PDA that accepts the language generated by this grammar G.
How to answer
- Recall CFG to PDA construction using stack
- Create PDA states q0,q1,q2 with push of start symbol
- Add transitions for productions S->aABB/aAA etc.
- Show acceptance of generated language
-
7 MarksbDefine ambiguous grammar. Show that the following grammar is ambiguous $S \to aSbS | bSaS | \epsilon$
How to answer
- Define ambiguous grammar with two parse trees/derivations
- Take string from S->aSbS|bSaS|epsilon e.g. abab
- Show two distinct leftmost derivations/parse trees
- Conclude grammar is ambiguous
-
7 MarksaWhat is the difference between a recursive and recursively enumerable Languages?
How to answer
- Define recursive language with halting TM deciding membership
- Define recursively enumerable with TM enumerating/accepting
- Compare decidability vs semi-decidability
- Give examples e.g. halting language for RE but not recursive
-
7 MarksbWhat are NP-complete and NP-hard problems? Explain them with examples.
How to answer
- Define NP, NP-hard via polynomial reduction
- Define NP-complete as NP and NP-hard
- Explain reducibility with examples SAT, TSP, clique
- Distinguish with diagram of complexity classes
-
14 MarksWrite a short notes (any three):
- i)Decidability
- ii)Universal Turing Machine
- iii)2 Way DFA
- iv)Petrinet Model
How to answer
- Define decidability with decider TM
- Describe universal Turing machine simulating any TM
- Explain 2-way DFA head movement
- Describe Petri net places, transitions, tokens with example
Go to where you left off?
Quick Add to Notes
Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.
Create free accountHave an account? Log in
Notes Panel