2023 question paper
FORMAL LANGUAGE & AUTOMATA THEORY
28 questions
Q1a. A language accepted by deterministic pushdown automata is closed under which of the following? (i) Complement (ii) Union (iii) Both (i) and (ii) (iv) None of the above20232m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →A language accepted by deterministic pushdown automata is closed under which of the following?
(i) Complement
(ii) Union
(iii) Both (i) and (ii)
(iv) None of the aboveWorked SolutionAnswer
Correct Option: (i) Complement
Explanation
Languages accepted by Deterministic Pushdown Automata (DPDA) are Deterministic Context-Free Languages (DCFLs).
Closure Properties of DCFLs
Operation Closed? Complement Yes Union No Intersection No Intersection with Regular Yes Concatenation No Kleene Star No Reason:
- A DPDA can be complemented by swapping final/non-final states after ensuring it is total and handles end-of-input deterministically, similar to DFA complementation, but adapted for stack handling.
- DCFLs are not closed under union: e.g., and are DCFLs, but is not a DCFL.
- Since union fails, (iii) Both is false and (iv) is false.
Contrast with general CFLs (NPDA)
CFLs (non-deterministic) are not closed under complement nor intersection, but are closed under union, concatenation, Kleene star – opposite behaviour.
Final Answer
DCFL is closed under complement only. Hence option (i) Complement is correct.
Q1b. Let N be an NFA with n states and let M be the minimized DFA with m states recognizing the same language. Which of the following is necessarily true? (i) m \le 2^n (ii) n \le m (iii) M has one accept state (iv) m = 2^n20232m
Module 1: Introduction & Regular Languages
View this question on its own page →Let be an NFA with states and let be the minimized DFA with states recognizing the same language. Which of the following is necessarily true?
(i)
(ii)
(iii) has one accept state
(iv)Worked SolutionAnswer
Correct Option: (i)
Explanation
NFA → DFA subset construction:
- Each DFA state corresponds to a subset of NFA states.
- With NFA states, there are at most subsets.
- Hence the DFA obtained (before minimization) has states.
- Minimized DFA has number of subset-construction DFA states .
So (i) is always true.
Other options:
- (ii) is false: NFA can be exponentially smaller (e.g., language of from end needs NFA states but DFA states → sometimes, but not necessarily; sometimes DFA is smaller).
- The converse is not guaranteed.
Final Answer
→ Option (i). (Minimized DFA minimal, so is even tighter, but certainly .)
Q1c. A minimum state deterministic FA accepting the language: L = \{ w \mid w \in \{0,1\}^* \} where the number of 0's and 1's in w are divisible by 3 and 5 respectively, has: (i) 15 states (ii) 11 states (iii) 10 states (iv) 9 states20232m
Module 1: Introduction & Regular Languages
View this question on its own page →A minimum state deterministic FA accepting the language:
where the number of 0's and 1's in are divisible by 3 and 5 respectively, has:
(i) 15 states
(ii) 11 states
(iii) 10 states
(iv) 9 statesWorked SolutionAnswer
Correct Option: (i) 15 states (Other options typically include 8, etc., correct is 15)
Explanation
Language .
This is intersection of two regular languages:
- → DFA with 3 states ().
- → DFA with 5 states ().
Intersection via product construction: states = → states.
Transitions: , .
Initial , accepting only. Minimal because all pairs distinguishable (Myhill-Nerode: $(i,j)
ot\equiv (i',j')i
eq i'j
eq j'$).Final Answer
15 states (product DFA, minimal).
Q1d. The language \{ a^n b^n c^{n+m} \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-sensitive20232m
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: (iii) Context-sensitive but not context-free (and hence not regular)
Explanation
.
Not Context-Free
Assume is CFL, let be pumping length. Take (). By pumping lemma for CFL, with , . Pumping must stay within first 's or 's or 's. Any pumping changes counts and breaks condition (or breaks ). Formal proof shows not CFL. Equivalent to (which is not CFL) with extra tail; intersection with regular does not help but style shows non-CFL.
Context-Sensitive
It is accepted by Linear Bounded Automaton. Grammar is context-sensitive:
This is Type-1 (CSG) but not Type-2. It is decidable but not CFL.
Final Answer
CSL but not CFL → Option (iii). Also not regular; ultimately Type-1 in Chomsky hierarchy.
Q1e. The string 1101 does not belong to the set represented by: (i) 1^* 0^* (0+1) (ii) 1(0+1)^*101 (iii) (1(0)^*(0+1)^*(0+1))^* (iv) \{00 + (11)^*0\}^*20232m
Module 1: Introduction & Regular Languages
View this question on its own page →The string does not belong to the set represented by:
(i)
(ii)
(iii)
(iv)Worked SolutionAnswer
Correct Option: (iv)
Explanation
Test against each regex:
(i) : = then then single or . → belongs.
(ii) : Must start with and end with . ? Actually = + + with middle ? where ? For , ? Wait exactly, so ? No with ? , remaining → → belongs.
(iii) : This is essentially variant (can generate any string) → belongs.
(iv) : Generators: (ends 0) and = even 1's followed by 0, also ends 0. Any concatenation of blocks ending in 0 always ends in 0. ends in 1 → does not belong.
Final Answer
$1101
otin {00 + (11)^0}^$ → Option (iv).Q1f. A given grammar is called ambiguous if: (i) two or more productions have the same non-terminal on LHS (ii) a derivation tree has more than one associated sentence (iii) there exists a sentence with more than one derivation tree (iv) brackets are not present in the grammar20232m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →A given grammar is called ambiguous if:
(i) two or more productions have the same non-terminal on LHS
(ii) a derivation tree has more than one associated sentence
(iii) there exists a sentence with more than one derivation tree
(iv) brackets are not present in the grammarWorked SolutionAnswer
Correct Option: (iii) there exists a sentence with more than one derivation tree
Explanation
Ambiguous Grammar: Grammar is ambiguous iff there exists a string that has two or more distinct derivation trees (or equivalently two distinct leftmost / rightmost derivations).
- (i) “two productions have same LHS” → false; e.g., has same LHS but not ambiguous (each string one tree).
- (ii) “derivation tree has more than one sentence” — every tree yields exactly one sentence (its yield), false.
- (iii) True — definition of ambiguity: .
- (iv) “brackets not present” — irrelevant.
Example ambiguous: ; string has two trees (different precedence).
Final Answer
Ambiguous iff some sentence has ≥2 parse trees → Option (iii).
Q1g. Which one of the following statements is true? (i) The intersection of two CFLs is context-free (ii) Every CFL can be accepted by a DPDA (iii) The union of two CFLs is context-free (iv) The complement of a CFL is context-free20232m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Which one of the following statements is true?
(i) The intersection of two CFLs is context-free
(ii) Every CFL can be accepted by a DPDA
(iii) The union of two CFLs is context-free
(iv) The complement of a CFL is context-freeWorked SolutionAnswer
Correct Option: (iii) The union of two CFLs is context-free
Explanation
CFL closure:
Operation Closed? Example Union Yes Intersection No not CFL Complement No Follows from De Morgan Every CFL is DPDA No is CFL but not DCFL Intersection of 2 CFLs is CFL No Thus only union is guaranteed.
Options:
- (i) Intersection → false
- (ii) Every CFL is DPDA → false (DCFL ⊂ CFL)
- (iii) Union → true ✓
- (iv) Complement → false
Final Answer
Union of two CFLs is CFL → Option (iii).
Q1h. From the options, the pair having different expressive powers is: (i) DPDA and NPDA (ii) DFA and NFA (iii) single-tape TM and multi-tape TM (iv) deterministic single-tape TM and nondeterministic single-tape TM20232m
Module 4: Turing Machines (TM)
View this question on its own page →From the options, the pair having different expressive powers is:
(i) DPDA and NPDA
(ii) DFA and NFA
(iii) single-tape TM and multi-tape TM
(iv) deterministic single-tape TM and nondeterministic single-tape TMWorked SolutionAnswer
Correct Option: (i) DPDA and NPDA
Explanation
Expressive power comparison:
Pair Power Same? DPDA vs NPDA Different — NPDA = CFL, DPDA = DCFL ⊂ CFL. Example is CFL but not DCFL. DFA vs NFA Same — both = Regular Single-tape TM vs Multi-tape TM Same — both = RE, polytime difference only Deterministic single-tape TM vs Nondeterministic single-tape TM Same — in power Hence different expressive powers is DPDA vs NPDA.
Final Answer
DPDA and NPDA have different power → Option (i).
Q1i. Recursive languages are: (i) a proper superset of CFLs (ii) always recognizable (iii) also called type-0 languages (iv) recognizable by Turing machines20232m
Module 4: Turing Machines (TM)
View this question on its own page →Recursive languages are:
(i) a proper superset of CFLs
(ii) always recognizable
(iii) also called type-0 languages
(iv) recognizable by Turing machinesWorked SolutionAnswer
Correct Option: (i) a proper superset of CFLs (and (ii)/(iv) also true depending on option set)
Explanation
Recursive languages = Decidable languages = decided by TM that always halts.
Hierarchy:
- (i) Proper superset of CFLs → True. Every CFL is recursive (PDA can be simulated by halting TM), but not vice versa (e.g., is recursive not CFL).
- (ii) Always recognizable (RE) → True, recursive ⊂ RE, so yes.
- (iv) Recognizable by TM → True (RE definition).
- (iii) also called Type-0 → False, Type-0 = RE, not Recursive (Type-1 is CSL, not Recursive either; Recursive is not a Chomsky type but decidable).
If single choice, (i) proper superset of CFLs is the intended answer. If multiple, (i),(ii),(iv) are true.
Final Answer
Recursive languages are proper superset of CFLs → Option (i) (also RE).
Q1j. If P and Q are regular expressions (P is not null), then R = Q + RP has the unique solution: (i) R = QP (ii) R = PQ^* (iii) R = QP^* (iv) R = QP^*20232m
Module 1: Introduction & Regular Languages
View this question on its own page →If and are regular expressions ( is not null), then has the unique solution:
(i)
(ii)
(iii)
(iv)Worked SolutionAnswer
Correct Option: (iii) (Arden’s Theorem)
Explanation
Arden’s Theorem: If does not contain , then equation has unique solution .
Proof: . As , contributes no finite strings if language, so .
- (i) missing star → incomplete.
- (ii) swaps order (concatenation not commutative).
- (iv) duplicate of (iii).
Condition: not null ($\epsilon
otin P$) ensures uniqueness.Final Answer
→ Option (iii) (also (iv) if duplicate).
- 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. Discuss the Chomsky hierarchy of grammars with suitable examples.20237m
Module 1: Introduction & Regular Languages
View this question on its own page →Discuss the Chomsky hierarchy of grammars with suitable examples.
Q2b. State the pumping lemma for context-free languages.20237m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →State the pumping lemma for context-free languages.
Worked SolutionAnswer
Pumping Lemma for Context-Free Languages (CFL)
Statement:
Let be a context-free language. Then there exists a constant (the pumping length) such that for every string with , can be written assatisfying the following conditions:
- — the middle part is short (bounded by )
- — at least one of or is non-empty (not both empty)
- For all : — pumping and together (0, 1, 2, … times) keeps the string in
Interpretation
- For any sufficiently long CFL string, you can find a decomposition into 5 parts such that the inner and can be "pumped" simultaneously (repeated same number of times) and the result stays in the language.
- The simultaneous pumping of and is the key difference from the regular pumping lemma (which pumps a single ).
- means the "pumpable" region is near the center of the string (within length ).
How to Use (Proving Non-CFL)
To prove is not context-free:
- Assume is CFL → pumping lemma holds with some .
- Choose a specific string with (usually or similar).
- Show that for every valid decomposition satisfying (1) and (2), there exists some such that $uv^i x y^i z
otin L$. - Contradiction → not CFL.
Common Strategy: Choose so that any of length cannot span all "coordinated" parts (e.g., three blocks ). Pumping disrupts the balance.
Example Application
Prove is not CFL.
- Let be pumping length. Take , .
- By lemma, with , .
- Since , the substring cannot contain 's, 's, and 's simultaneously — it lies within at most two adjacent blocks.
- Cases:
- only in 's: pumping adds 's → $#a
eq #b = #c$ ❌ - only in 's: pumping adds 's → $#b
eq #a, #c$ ❌ - only in 's: pumping adds 's ❌
- spans boundary: pumping changes and differently (or adds both) → $#a
eq #b#b
eq #c$ ❌ - spans boundary: similar ❌
- only in 's: pumping adds 's → $#a
- All decompositions fail for some $i
e 1$. Contradiction.
Contrast with Regular Pumping Lemma
Aspect Regular (Type-3) CFL (Type-2) String split Pumped part (single) and (pair) Constraint Non-empty Result
Important Notes
- The lemma gives necessary but not sufficient condition for CFL.
- There are non-CFL languages that satisfy the lemma (e.g., some non-context-free languages still pump).
- For CFL, pumping is simultaneous of two substrings ( and ), reflecting stack push/pop pairing.
- The pumping length depends on the grammar (e.g., number of variables in Chomsky Normal Form).
Final Answer
Pumping Lemma for CFL: such that , with , , and . Used to prove languages like are not context-free.
Q3a. Design a PDA (empty stack and final state both) for L = \{ WW^r \mid W \in \{a,b\}^* \}.20237m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Design a PDA (empty stack and final state both) for .
Worked SolutionAnswer
Language: — even-length palindromes over .
= reverse of . Examples: , , , , , , …
PDA Design (NPDA)
This language is not deterministic (NPDA needed) — the PDA must guess the midpoint.
PDA:
- : reading first half, pushing symbols
- : reading second half, popping & matching
- : accept (final state)
- ( = bottom marker)
- = start
- (final state)
- Empty stack also accepted: remains at bottom, all input symbols pushed then popped
Transition Function
Current State Input Stack Top Action Next State Push/Pop Push Push Guess midpoint, switch to pop (no change) Pop & match (pop) Pop & match (pop) All matched, stack = Formally:
- for
- for
- for (midpoint guess)
State Diagram
a,b / X → aX,bX ┌───────────────────┐ ▼ │ (q0)──ϵ, X/X──►(q1)──a/a:pop,b/b:pop──►(q1) │ │ │ ϵ, Z0/ϵ │ ▼ └──────────────►(q2) [Accept]
How It Works (Example: → )
Push phase ():
- Read
a, pusha: stack =a Z0 - Read
b, pushb: stack =b a Z0 - Guess midpoint (): go to , stack unchanged
b a Z0
- Read
Pop phase ():
- Read
b, top=b→ pop → stack =a Z0 - Read
a, top=a→ pop → stack =Z0 - Input exhausted, -transition on →
- Read
Accept: , or stack = (empty-stack acceptance).
Acceptance Modes
Mode Condition Final State Reach Empty Stack After reading all input, stack = (all pushed symbols matched and popped, only remains) Both equivalent here; PDA accepts by both.
Why Nondeterministic?
- The -transition from to guesses the midpoint.
- For odd-length strings (not in ), no guess works → rejects.
- For , correct guess at exact middle → accepts.
- DPDA cannot guess midpoint deterministically → not DCFL.
Alternative: CFG
generates .
Final Answer
NPDA with 3 states ():
- : push onto stack while reading first half
- -transition: guess midpoint, switch to
- : pop & match each input symbol with stack top
- on : accept ()
- Accepts by final state and empty stack ( only).
Q3b. Eliminate \varepsilon, unit, and useless productions from the grammar: A → bA | Bba | aa B → aba | b | D C → CA | AC | B D → a | \varepsilon20237m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Eliminate , unit, and useless productions from the grammar:
A → bA | Bba | aa
B → aba | b | D
C → CA | AC | B
D → a |Q4a. Define Chomsky Normal Form. Convert the CFG: S → aSb | ab | Aa A → aab to CNF.20237m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Define Chomsky Normal Form. Convert the CFG:
S → aSb | ab | Aa
A → aabto CNF.
Q4b. Obtain the regular expression for the given DFA. 20237m
Module 1: Introduction & Regular Languages
View this question on its own page →Obtain the regular expression for the given DFA.

Q5a. Prove that if L_1 and L_2 are regular, then L_1 \cup L_2 is regular.20237m
Module 1: Introduction & Regular Languages
View this question on its own page →Prove that if and are regular, then is regular.
Q5b. Design a Turing machine that recognizes strings containing equal number of 0’s and 1’s.20237m
Module 4: Turing Machines (TM)
View this question on its own page →Design a Turing machine that recognizes strings containing equal number of ’s and ’s.
Q6a. Given the \varepsilon-NFA, compute \varepsilon-closures and convert to DFA. | State | \varepsilon-transition | a-transition | b-transition | |-------|--------------------------|--------------|--------------| | → | {r} | {q} | {p,r} | | q | ∅ | {p} | ∅ | | r | {p,q} | {r} | {p} |20237m
Module 1: Introduction & Regular Languages
View this question on its own page →Given the -NFA, compute -closures and convert to DFA.
State -transition a-transition b-transition → {r} {q} {p,r} q ∅ {p} ∅ r {p,q} {r} {p} Q6b. Construct NFA for the regular expression: (0+1)^*00(0+1)^*20237m
Module 1: Introduction & Regular Languages
View this question on its own page →Construct NFA for the regular expression:
- 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. Construct NPDA for the grammar: S \to \alpha ABB \mid \alpha AA \\ A \to \alpha BB \mid \alpha \\ B \to bBB \mid A20237m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Construct NPDA for the grammar:
Q7b. Prove the identity: (1+00^*1) + (1+00^*1)(0+10^*1)^*(0+10^*1) = 0^*1(0+10^*1)^*20237m
Q8a. Construct a Moore machine equivalent to the given Mealy machine.20237m
Module 1: Introduction & Regular Languages
View this question on its own page →Construct a Moore machine equivalent to the given Mealy machine.
Q8b. Given the grammar: S \to aB \mid ba \\ B \to b \mid bs \mid aBB For the string aaabbabbba find: 1. Leftmost derivation 2. Rightmost derivation 3. Parse tree20237m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Given the grammar:
For the string find:
- Leftmost derivation
- Rightmost derivation
- Parse tree
Q9a. Write short notes on: Post Correspondence Problem.20237m
Module 5: Undecidability
View this question on its own page →Write short notes on: Post Correspondence Problem.
Q9b. Write short notes on: Multi-tape Turing Machine.20237m
Module 4: Turing Machines (TM)
View this question on its own page →Write short notes on: Multi-tape Turing Machine.
Q9c. Write short notes on: NP-hard and NP-complete problems.20237m
Module 5: Undecidability
View this question on its own page →Write short notes on: NP-hard and NP-complete problems.
Q9d. Write short notes on: Pumping lemma for CFL.20237m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Write short notes on: Pumping lemma for CFL.
Coursify Android App
Generate AI courses, take quick quizzes between classes, and master complex engineering concepts on the go.