2021 question paper
FORMAL LANGUAGE & AUTOMATA THEORY
27 questions
Q1a. Which of the following statements is/are false? A. For every nondeterministic TM, an equivalent deterministic TM exists. B. Turing recognizable languages are closed under union and complementation. C. Turing decidable languages are closed under intersection and complementation. D. Turing recognizable languages are closed under union and intersection. (i) A and D only (ii) A and C only (iii) B only (iv) C only20212m
Module 5: Undecidability
View this question on its own page →Which of the following statements is/are false?
A. For every nondeterministic TM, an equivalent deterministic TM exists.
B. Turing recognizable languages are closed under union and complementation.
C. Turing decidable languages are closed under intersection and complementation.
D. Turing recognizable languages are closed under union and intersection.(i) A and D only
(ii) A and C only
(iii) B only
(iv) C onlyWorked SolutionAnswer
Correct Option: (iii) B only
Explanation
Evaluate each statement:
A. For every nondeterministic TM, an equivalent deterministic TM exists.
True. Turing Machines are deterministic simulatable: a DTM can simulate an NTM via BFS over computation tree with at most exponential slowdown. NTM does not increase power, unlike for PDA. in language power.
B. Turing-recognizable (RE) languages are closed under union and complementation.
False.
- RE is closed under union and intersection: if recognizes and recognizes , a NTM can dovetail to recognize and .
- RE is NOT closed under complement. If is RE but not recursive, is not RE. Example is RE, is not RE. So the conjunction “union and complementation” fails.
C. Turing-decidable (Recursive) languages are closed under intersection and complementation.
True. Recursive languages are decidable by a TM that always halts. Deciders can be complemented by swapping accept/reject, and intersected via product construction. They are closed under all Boolean operations: union, intersection, complement, difference.
D. Turing-recognizable languages are closed under union and intersection.
True. As noted in B, RE retains closure under union and intersection, only complement fails.
Summary
Statement Truth A True B False C True D True Only B is false.
Final Answer
B only is false → Option (iii).
Q1b. Enumerator in a Turing machine is a TM with: (i) an output printer (ii) 5 input tapes (iii) a stack (iv) None of the above20212m
Module 4: Turing Machines (TM)
View this question on its own page →Enumerator in a Turing machine is a TM with:
(i) an output printer
(ii) 5 input tapes
(iii) a stack
(iv) None of the aboveWorked SolutionAnswer
Correct Option: (i) an output printer
Explanation
An Enumerator is a variant of Turing Machine that enumerates a language.
Formal definition (Sipser):
Enumerator is a TM with a work tape and a write-only output tape (printer). The printer head moves only right and cannot read. Whenever wants to output a string, it writes it on the printer and the string is considered enumerated.
- Enumerator has no input; it starts from blank tape.
- Language enumerated is .
- Theorem: is Turing-recognizable iff some enumerator enumerates .
Options:
- (ii) 5 tapes — multi-tape TM, not enumerator.
- (iii) stack — PDA, not enumerator.
- Hence (i) is correct.
Final Answer
Enumerator = TM with an output printer → Option (i).
Q1c. The language: L = \{ a^m b^n c^{m+n} \mid m,n \ge 1 \} is: (i) regular (ii) context-free but not regular (iii) context-sensitive but not context-free (iv) type-0 but not context-sensitive20212m
Module 3: Context-Sensitive Languages
View this question on its own page →The language:
is:
(i) regular
(ii) context-free but not regular
(iii) context-sensitive but not context-free
(iv) type-0 but not context-sensitiveWorked SolutionAnswer
Correct Option: (ii) Context-free but not regular
Explanation
.
Not Regular
Use Pumping Lemma. Let be pumping length, . Pumping in segment breaks balance.
Context-Free
PDA construction:
- Push ’s (m times) → stack .
- Push ’s (n times) → stack (or same symbol).
- For each , pop one symbol. Accept if empty after ’s and no extra input.
Alternatively grammar:
This generates .
Not context-sensitive requirement beyond; CFL suffices, but not regular. Not Type-0/1 only.
Final Answer
Context-free but not regular → Option (ii).
Q1d. The maximum number of states of a DFA converted from an NFA with n states is: (i) n (ii) n^2 (iii) 2^n (iv) None of the above20212m
Module 1: Introduction & Regular Languages
View this question on its own page →The maximum number of states of a DFA converted from an NFA with states is:
(i)
(ii)
(iii)
(iv) None of the aboveWorked SolutionAnswer
Correct Option: (iii)
Explanation
NFA with states → DFA via subset construction:
Each DFA state is a subset of NFA states. NFA states set , .
Number of distinct subsets = .
This includes (dead state).
Hence DFA has at most states. Upper bound is tight: there exist NFA families (e.g., language “th symbol from end is 1”) that require exactly DFA states.
Final Answer
Maximum states → Option (iii). (Minimal DFA may be smaller, but maximum is .)
Q1e. If L_1 and L_2 are CFLs, L_1 - L_2 is ____ context-free. (i) always (ii) sometimes (iii) never (iv) None of the above20212m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →If and are CFLs, is ____ context-free.
(i) always
(ii) sometimes
(iii) never
(iv) None of the aboveWorked SolutionAnswer
Correct Option: (ii) sometimes (i.e., not always — CFLs are not closed under difference)
Explanation
.
- CFLs are closed under union, concatenation, Kleene star, but NOT under intersection, complement, difference.
- Since complement of a CFL is not necessarily CFL, difference need not be CFL.
Counterexample:
(actually regular, also CFL)
Let (CFL) and (CFL)
not CFL.
Then style constructions show difference can be non-CFL.But sometimes it is CFL: e.g., if is regular, then is CFL because CFL ∩ Regular = CFL. So difference is sometimes CFL.
Many textbooks phrase options as:
- (i) always — false
- (ii) sometimes / not always closed
- (iii) never — false (counterexample above shows sometimes)
Hence correct is not necessarily CFL → Option (ii) sometimes (or “not always”). If exam key uses “never”, they mean “not closed”, also acceptable as (iii) in that phrasing — but strictly “sometimes” is precise.
Final Answer
is not guaranteed CFL → Not closed → Option (ii) sometimes / not always (exam may list as (iii) never in weaker phrasing).
Q1f. Which of the following does not have left recursion? (i) Chomsky Normal Form (ii) Greibach Normal Form (iii) Backus–Naur Form (iv) All of the above20212m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Which of the following does not have left recursion?
(i) Chomsky Normal Form
(ii) Greibach Normal Form
(iii) Backus–Naur Form
(iv) All of the aboveWorked SolutionAnswer
Correct Option: (i) Chomsky Normal Form and (ii) Greibach Normal Form — both have no left recursion; if single choice required, (i) CNF is the textbook answer, and BNF may contain left recursion.
Explanation
Left recursion: Production .
- Chomsky Normal Form (CNF): or , where , . No on RHS leftmost as non-terminal with same , and no . No left recursion.
- Greibach Normal Form (GNF): , where , . Starts with terminal → no left recursion by definition.
- Backus-Naur Form (BNF): General notation for CFG, e.g., . May contain left recursion (common in expression grammars).
Options:
- (i) CNF → no left recursion ✓
- (ii) GNF → no left recursion ✓
- (iii) BNF → can have left recursion ✗
- (iv) All of above → false because BNF can have it.
If exam expects single answer, CNF (and GNF) are correct; many keys mark (i) Chomsky Normal Form.
Final Answer
CNF / GNF have no left recursion → Option (i) (and (ii)). BNF can have left recursion.
Q1g. For an NFA with n states, the minimized DFA has: (i) m \le 2^n (ii) n \le m (iii) one accept state (iv) m = 2^n20212m
Module 1: Introduction & Regular Languages
View this question on its own page →For an NFA with states, the minimized DFA has:
(i)
(ii)
(iii) one accept state
(iv)Worked SolutionAnswer
Correct Option: (i)
Explanation
Same as Q28 / Q87: Subset construction.
NFA states → DFA has at most subsets. Minimized DFA ≤ subset DFA ≤ .
- (ii) is not necessarily true (NFA can be smaller).
- (iv) is not always (upper bound, but often smaller).
- (iii) one accept state is false (can be multiple).
Final Answer
→ Option (i).
Q1h. ____ is the acyclic graphical representation of a grammar. (i) Binary tree (ii) Octtree (iii) Parse tree (iv) None of the above20212m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →____ is the acyclic graphical representation of a grammar.
(i) Binary tree
(ii) Octtree
(iii) Parse tree
(iv) None of the aboveWorked SolutionAnswer
Correct Option: (iii) Parse tree
Explanation
Parse tree (derivation tree / syntax tree): Acyclic, rooted, ordered tree representing derivation.
- Root = start symbol
- Internal nodes = non-terminals
- Leaves = terminals (yield = derived string)
- No cycles (grammar is context-free, derivation finite).
Not binary tree specifically (parse tree can be -ary), not octtree. Binary tree is for CNF.
Final Answer
Parse tree → Option (iii).
Q1i. A minimum state DFA for the language: L = \{ w \in \{0,1\}^* : \#0(w) \equiv 0 \mod 3,\; \#1(w) \equiv 0 \mod 5 \} has: (i) 15 states (ii) 11 states (iii) 10 states (iv) 9 states20212m
Module 1: Introduction & Regular Languages
View this question on its own page →A minimum state DFA for the language:
has:
(i) 15 states
(ii) 11 states
(iii) 10 states
(iv) 9 statesWorked SolutionAnswer
Correct Option: (i) 15 states
Explanation
Language is same as Q92 / Q112.
As before: DFA for needs 3 states, for needs 5 states. Product → minimal states.
Transitions: .
Other options 11,10,9 would be for different moduli (e.g., 3+5=8) — incorrect; must multiply, not add.
Final Answer
15 states → Option (i).
Q1j. The construction time for DFA from NFA with m nodes is: (i) O(m^2) (ii) O(2^m) (iii) O(m) (iv) O(\log m)20212m
Module 1: Introduction & Regular Languages
View this question on its own page →The construction time for DFA from NFA with nodes is:
(i)
(ii)
(iii)
(iv)Worked SolutionAnswer
Correct Option: (ii)
Explanation
NFA with states → DFA via subset construction:
Number of DFA states in worst case, and constructing each state requires processing transitions for each symbol ().
Time is proportional to number of subsets times alphabet:
(If counting edges, but dominant exponential.)
Options:
- — polynomial, false for NFA→DFA
- — linear, false
- — false
Final Answer
→ Option (ii).
- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q2a. Tabulate the Chomsky hierarchy of grammars with an example for each.20217m
Module 1: Introduction & Regular Languages
View this question on its own page →Tabulate the Chomsky hierarchy of grammars with an example for each.
Worked SolutionAnswer
Chomsky Hierarchy of Grammars
Type Grammar Name Production Form Language Class Automaton Type-0 Unrestricted No restriction on (except $\alpha eq \epsilon$) Recursively Enumerable (RE) Turing Machine Type-1 Context-Sensitive , has in context Context-Sensitive (CSL) Linear Bounded Automaton Type-2 Context-Free , , Context-Free (CFL) Pushdown Automaton (PDA) Type-3 Regular / Right-Linear (or left-linear) Regular (REG) Finite Automaton (DFA/NFA) Examples
Type Example Grammar Language Generated Type-0 with unrestricted rules e.g. or any computable language Type-1 , , , , , Type-2 (balanced parentheses) Type-2 Balanced parentheses language Type-3 (all binary strings) Type-3 , (right-linear) Containment Relations
Each level strictly contained in the next (proper subsets).
Notes
- Type-0 = RE = recognized by TM; not all decidable.
- Type-1 = CSL = decided by LBA (PSPACE-complete membership).
- Type-2 = CFL = parsed in (CYK); inherently ambiguous CFLs exist.
- Type-3 = REG = recognized by FA/DFA; all decidable properties.
Final Answer
Table above summarizes all four Chomsky types with production forms, language classes, automata, and concrete grammar examples.
Q2b. Design a finite-state machine (FSM) for a parity checker.20217m
Module 1: Introduction & Regular Languages
View this question on its own page →Design a finite-state machine (FSM) for a parity checker.
Worked SolutionAnswer
Parity Checker FSM: Checks if number of
1s in input is even (even parity) or odd (odd parity). Common use: error detection in communication.Assumptions
- Input alphabet: (binary stream)
- Output: Even (0) or Odd (1) parity bit after each input, or final parity at end
- We present Moore and Mealy versions
1. Moore Machine (Output on State)
States:
- : Even number of 1's seen so far (initial, accepting for even parity)
- : Odd number of 1's seen so far
Output function :
- (even parity)
- (odd parity)
Transition function :
State Input 0 Input 1 State Diagram:
0 ┌────┐ │ ▼ (E)───►(O) ▲ │ └───1- On
0: stay in same parity state - On
1: flip parity
Formal Moore:
- , ,
2. Mealy Machine (Output on Transition)
States: (same states, no output on states)
Output on transition:
Transition Input Next State Output 0 0 1 1 0 1 1 0 State Diagram:
0/0 ┌─────┐ │ ▼ (E)──►(O) │1/1 │0/1 └─────1/0Formal Mealy: with .
3. Even Parity Generator (Output at End)
If only final parity needed (not running):
- Run Moore/Mealy above
- After last input, output (Moore) or last transition output (Mealy)
- Even parity = 0 if even # of 1's, 1 if odd
Test Sequence
Input Moore State Seq Moore Output Seq Mealy Output Seq 1011 0,1,1,1,0 1,1,1,0 Even # 1s: 1100 → ends in E, output 0 Odd # 1s: 110 → ends in O, output 1
Final Answer
Parity Checker FSM — 2-state Moore/Mealy machine tracking even/odd count of 1's.
- Moore: Output = state parity (E→0, O→1)
- Mealy: Output on each transition (flip on 1, hold on 0)
- Transitions:
0= stay,1= flip - Minimal: 2 states (even/odd are distinguishable)
Q3a. Construct an NFA accepting strings over \{0,1,2\} beginning with 0, followed by an odd number of 1s, ending with any number of 2s.20217m
Module 1: Introduction & Regular Languages
View this question on its own page →Construct an NFA accepting strings over beginning with 0, followed by an odd number of 1s, ending with any number of 2s.
Worked SolutionAnswer
Language:
Structure: starts with 0 → odd number of 1's → any number of 2's.
NFA Design
NFA:
- = start
- (final)
States meaning:
- : initial, expecting leading
0 - : saw
0, read first1(odd count = 1) - : in even number of 1's (after 2nd, 4th, ...)
- : in odd number of 1's (after 1st, 3rd, ...) — can transition to 2's
Transition Function
State Input Next State(s) No other transitions (missing transitions = dead/implicit reject).
State Diagram
0 ┌───────┐ │ ▼ (q0)──►(q1)──1──►(q2) │ ▲ │ │ │ │ └────1 │ 2 │ ▼ │ │ (q3)◄──2─────┘ 2
How It Works
Input Path Accept? 01→ no (ends in , even 1's) 011→ yes () 0111→ no (even) 012→ no ( has no 2-transition) 0112→ yes 01112→ no 01122→ yes 0→ no (no 1's, count=0 even)
Equivalent DFA (via Subset Construction)
States = subsets of NFA states:
- (accepting)
- Dead =
But NFA is simpler and sufficient.
Regular Expression
Verification:
01= ✓0111= ✓011122= ✓
Final Answer
NFA with 4 states ():
- (leading 0)
- (toggle odd/even 1's)
- (odd 1's → can start 2's)
- (any number of 2's)
- Final =
- Accepts exactly.
Q3b. Construct a PDA that accepts: L = \{ u a w b : u,w \in \{a,b\}^*,\; |u| = |w| \}20217m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Construct a PDA that accepts:
Q4a. Design a Turing Machine to compute n \bmod 2.20217m
Module 4: Turing Machines (TM)
View this question on its own page →Design a Turing Machine to compute .
Q4b. Design a DFA for the regular expression: 1^*(10)^*20217m
Module 1: Introduction & Regular Languages
View this question on its own page →Design a DFA for the regular expression:
Q5a. Using the CYK algorithm, determine whether baaba is in L(G) for the grammar: `` S → AB | BC A → BA | a B → CC | b C → AB | a ``202114m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Using the CYK algorithm, determine whether
baabais in for the grammar:S → AB | BC A → BA | a B → CC | b C → AB | aQ5b. Suppose L is CFL and R is regular: (i) Is L - R always CFL? (ii) Is R - L always CFL?202114m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Suppose is CFL and is regular:
(i) Is always CFL?
(ii) Is always CFL?Q6a. Show that the language: L = \{ a^{n!} : n \ge 0 \} is not regular or not context-free.20217m
Module 1: Introduction & Regular Languages
View this question on its own page →Show that the language:
is not regular or not context-free.
Q6b. Let G be a CFG in CNF with b variables. Show that if G derives any string using at least 2^b steps, then L(G) is infinite.20217m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Let be a CFG in CNF with variables. Show that if derives any string using at least steps, then is infinite.
- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q7a. State and prove the pumping lemma for regular languages.20217m
Module 1: Introduction & Regular Languages
View this question on its own page →State and prove the pumping lemma for regular languages.
Q7b. Check whether the grammar: S \to aSa \mid bSb \mid a \mid b is ambiguous.20217m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Check whether the grammar:
is ambiguous.
Q8a. Show that the function: f(x,y) = x + y is primitive recursive.20217m
Module 5: Undecidability
View this question on its own page →Show that the function:
is primitive recursive.
Q8b. Construct a PDA accepting: L = \{ a^{2n}bc : n \ge 0 \}20217m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Construct a PDA accepting:
Q9a. Write a short note on the Post Correspondence Problem.20213.5m
Module 5: Undecidability
View this question on its own page →Write a short note on the Post Correspondence Problem.
Q9b. Write a short note on Chomsky Normal Form.20213.5m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Write a short note on Chomsky Normal Form.
Q9d. Write a short note on the Pumping Lemma for CFL.20213.5m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Write a short note on the Pumping Lemma for CFL.
Pocketly — Personal Finance for Students
Keep your hostel and college expenses under control. Track accounts, log spending in seconds, and stay within your monthly budget.