CS-501 · Theory of Computation/Unsolved PYQ Paper
CS-501 Theory of Computation - Nov 2023 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 MarksaDraw a DFA to accept string of 0's and 1's not ending with the string 01.
How to answer
- Define DFA 5-tuple and acceptance condition for complement of suffix 01
- Construct states tracking last symbols: start/no-01-ending, seen-0, trap for ending-01
- Give transition table for 0,1 and mark accepting vs non-accepting states
- Show state diagram and argue correctness with examples
-
7 MarksbDesign a DFA to accept string of 0's and 1's when interpreted as binary numbers would be multiple of 3.
How to answer
- Use remainders 0,1,2 modulo 3 as three states with 0 as start and accept
- Apply transition delta(q,r) on bit b = (2*r + b) mod 3
- Give full transition table/diagram
- Test with examples e.g. 0, 11 (=3), 110 (=6)
-
7 MarksaFind the context free grammar with no useless symbols equivalent to $S \to AB/Ca, B \to BC/AB, A \to a, C \to aB/b$
How to answer
- Identify generating and reachable symbols from S -> AB/Ca etc.
- Remove non-generating / non-reachable productions step by step
- Rewrite reduced grammar with only useful symbols
- Verify language preserved
-
7 MarksbDerive regular expression from this finite automata.

How to answer
- Write state equations R_q using Arden's theorem for q0,q1,q2
- Eliminate q2 and q0 to solve for final state q2
- Simplify regular expression
- State final RE for strings reaching q2
-
7 MarksaWhat is meant by ambiguous grammar? Test whether the grammar is ambiguous or not $S \to SS/a/b$
How to answer
- Define ambiguous grammar: two distinct parse trees/leftmost derivations
- Give two derivations/trees for a string e.g. aab using S->SS/a/b
- Conclude grammar is ambiguous
- Mention removal if needed
-
7 MarksbConstruct an equivalent FA for the given regular expression $(0+1)^{*}(00+11)(0+1)^{*}$
How to answer
- Interpret RE (0+1)*(00+11)(0+1)* as containing 00 or 11
- Design NFA then convert to DFA via subset construction
- Give transition diagram with trap/accept states
- Justify acceptance of strings containing double 0 or double 1
-
14 MarksConstruct the following CFG grammar
- i)$a^{n} b^{m} c^{n}$ where $m, n \ge 1$
- ii)Obtain a CFG to generate a integer
How to answer
- Give CFG productions for a^n b^m c^n with matched a,c and independent b
- Give CFG for signed/unsigned integer (digits, optional sign)
- Present in 4-tuple form if required
- Show sample derivations
-
14 MarksConstruct the PDA accepting the language.
- i)$L = \{(ab)^{n} \mid n >= 1\}$ by empty stack.
- ii)$L = \{ww^{R} \mid w \text{ is in } (a+b)^{*}\}$ by empty stack.
- iii)$L = \{a^{2n} b^{n} \mid n >= 1\}$ by empty stack.
How to answer
- Define PDA 7-tuple and empty-stack acceptance
- Give transitions pushing for first half and popping for second half for each L
- Handle (ab)^n, ww^R over (a+b)*, and a^{2n} b^n
- Trace acceptance on example string
-
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
- Use standard CFG-to-PDA construction with single state pushing start symbol
- Add transitions for S->aABB/aAA, A->aBB/a, B->bBB/A
- Explain push/pop on terminals vs variables
- Show acceptance of sample string
-
7 MarksbDefine the context free grammars in the 4 tuple from (V, T, P, S) for the given languages on $\Sigma(a, b)$.
- i)All strings having atleast two 'a's.
- ii)All possible strings not containing triple 'b's.
How to answer
- Define CFG as (V,T,P,S) over Sigma={a,b}
- Give productions for at least two a's: e.g. S->XaXaX
- Give productions avoiding bbb using states for 0,1,2 consecutive b's
- List V,T,P,S explicitly
-
7 MarksaWhat is the difference between a recursive and recursively enumerable languages?
How to answer
- Define recursive = decided by halting TM; RE = semi-decided/accepted by TM
- Compare closure and complement properties
- Give examples: Halting language is RE but not recursive
- Tabulate differences
-
7 MarksbWhat do you mean by saying that the halting problem of TM is undecidable?
How to answer
- State halting problem: decide if TM halts on given input
- Outline diagonalization/reduction proof of undecidability
- Explain no total TM can decide it
- Mention implication for decidability
-
14 MarksWrite short notes on : (Any three)
- i)Post correspondence problem
- ii)Halting problem
- iii)Closure property of regular grammar
- iv)Turing machine
How to answer
- Define each: PCP, Halting problem, closure properties, TM model
- Give formal statement/example and significance
- Mention decidability/undecidability results
- Conclude with applications
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