2025 question paper
FORMAL LANGUAGE & AUTOMATA THEORY
28 questions
Q1a. A language is said to be recursively enumerable if it is accepted by a (i) DFA (ii) Turing Machine (iii) PDA (iv) Linear Bounded Automaton20252m
Module 4: Turing Machines (TM)
View this question on its own page →A language is said to be recursively enumerable if it is accepted by a
(i) DFA
(ii) Turing Machine
(iii) PDA
(iv) Linear Bounded AutomatonWorked SolutionAnswer
Correct Option: (ii) Turing Machine
Explanation
A language is called Recursively Enumerable (RE) iff there exists a Turing Machine such that , i.e., halts and accepts exactly the strings in . On strings not in , may either reject or loop forever. This is the most general language class in the Chomsky hierarchy (Type-0).
Why other options are incorrect
- (i) DFA : Accepts Regular languages (Type-3), strictly smaller than RE.
- (iii) PDA : Accepts Context-Free Languages (Type-2), also properly contained in RE.
- (iv) Linear Bounded Automaton (LBA) : Accepts Context-Sensitive Languages (Type-1), also a proper subset of RE.
Hierarchy recall
- REG → DFA
- CFL → PDA
- CSL → LBA
- RE → Turing Machine
- Recursive → Decidable TM (always halts)
Final Answer
Hence, Recursively Enumerable Languages are exactly those accepted by Turing Machines. Correct answer is (ii) Turing Machine.
Q1b. Regular languages belong to which type in the Chomsky hierarchy? (i) Type-0 (ii) Type-2 (iii) Type-1 (iv) Type-320252m
Module 1: Introduction & Regular Languages
View this question on its own page →Regular languages belong to which type in the Chomsky hierarchy?
(i) Type-0
(ii) Type-2
(iii) Type-1
(iv) Type-3Worked SolutionAnswer
Correct Option: (iv) Type-3
Explanation
Chomsky Hierarchy (Noam Chomsky, 1956)
Type Language Class Grammar Automaton Type-0 Recursively Enumerable Unrestricted Turing Machine Type-1 Context-Sensitive Context-Sensitive Linear Bounded Automaton Type-2 Context-Free Context-Free Pushdown Automata Type-3 Regular Regular (Left/Right-linear) Finite Automaton (DFA/NFA) Regular languages are the most restricted class, generated by:
- Right-linear grammars:
- Left-linear grammars
- Regular expressions
and recognized by DFA/NFA/ε-NFA.
They are strictly contained:
Final Answer
Regular languages are Type-3 languages. Correct option (iv).
Q1c. Which of the following languages is NOT regular? (i) {a^n b^n | n \ge 0} (ii) {a, b}* (iii) Finite languages (iv) Languages accepted by DFA20252m
Module 1: Introduction & Regular Languages
View this question on its own page →Which of the following languages is NOT regular?
(i) {}
(ii) {}*
(iii) Finite languages
(iv) Languages accepted by DFAWorked SolutionAnswer
Correct Option: (i)
Explanation
- (ii) → Regular, regex , DFA with 1 state.
- (iii) Finite languages → Regular: any finite set is regular (union of finitely many strings).
- (iv) Languages accepted by DFA → Definition of regular.
- (i) → Classic non-regular. Requires counting unbounded and matching 's with 's. Pumping Lemma: let be pumping length, , pumping (all 's) breaks equality .
It is Context-Free (PDA can push 's, pop for 's) but not regular.
Final Answer
NOT regular is → Option (i).
Q1d. Context-free languages are NOT closed under (i) Union (ii) Concatenation (iii) Intersection (iv) Kleene star20252m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Context-free languages are NOT closed under
(i) Union
(ii) Concatenation
(iii) Intersection
(iv) Kleene starWorked SolutionAnswer
Correct Option: (iii) Intersection
Explanation
Closure properties of Context-Free Languages (CFLs):
Operation Closed? Union Yes – Concatenation Yes – Kleene star Yes – Intersection No Complement No Counterexample for intersection:
(CFL), (CFL)
which is not CFL (pumping lemma).Since De Morgan: , non-closure under intersection implies non-closure under complement.
Final Answer
CFLs are NOT closed under Intersection → Option (iii).
Q1e. Which production is not allowed in a CSG? (i) AB \rightarrow BA (ii) A \rightarrow \epsilon (iii) A \rightarrow a (iv) a B \rightarrow a b20252m
Module 3: Context-Sensitive Languages
View this question on its own page →Which production is not allowed in a CSG?
(i)
(ii)
(iii)
(iv)Worked SolutionAnswer
Correct Option: (ii)
Explanation
Context-Sensitive Grammar (CSG, Type-1): Production where and (non-contracting), except possibly with not appearing on RHS.
Check each:
- (i) : , → allowed (context-sensitive, length-preserving).
- (ii) : , → false, contracting, not allowed in CSG (unless and is start with special rule).
- (iii) : allowed.
- (iv) : allowed (context ).
Hence only violates the monotonicity condition.
Final Answer
Not allowed: → Option (ii).
Q1f. A Turing Machine that prints strings of a language is called (i) Acceptor (ii) Transducer (iii) Generator (iv) Enumerator20252m
Module 4: Turing Machines (TM)
View this question on its own page →A Turing Machine that prints strings of a language is called
(i) Acceptor
(ii) Transducer
(iii) Generator
(iv) EnumeratorWorked SolutionAnswer
Correct Option: (iii) Generator (also enumerated as Transducer/Enumerator in some texts — “Generator” is the term for printing strings)
Explanation
TM views:
Mode Description Acceptor / Recognizer Decides by accepting/rejecting (yes/no). Transducer Computes function on output tape. Generator / Enumerator Prints (generates) strings of one after another on output tape (printer). Decider Acceptor that always halts. A TM that prints strings of a language is called Generator (or Enumerator if it lists all). Many textbooks list (iii) Generator and (iv) Enumerator as synonyms; exam key typically Generator.
Final Answer
Generator (prints strings) → Option (iii). Enumerator is equivalent variant.
Q1g. If \Sigma = \{a, b\}, then \Sigma^* contains (i) Only finite strings (ii) Only infinite strings (iii) All finite strings over \Sigma including \epsilon (iv) Only strings of equal length20252m
Module 1: Introduction & Regular Languages
View this question on its own page →If , then contains
(i) Only finite strings
(ii) Only infinite strings
(iii) All finite strings over including
(iv) Only strings of equal lengthWorked SolutionAnswer
Correct Option: (iii) All finite strings over including
Explanation
Definition: , where , , , ...
For :
- (empty string, length 0) ∈
- ∈
- ∈
- … all finite concatenations.
Properties:
- Countably infinite set.
- Does not contain infinite strings (each string is finite; there are infinitely many strings, but each has finite length).
- Not limited to equal length.
Options:
- (i) Only finite strings but missing → incomplete
- (ii) Only infinite strings → false
- (iv) Only equal length → false
Final Answer
All finite strings including → Option (iii).
Q1h. The \epsilon-closure of a state is (i) The set of states reachable using \epsilon only (ii) The set of unreachable states (iii) The set of final states (iv) The dead states20252m
Module 1: Introduction & Regular Languages
View this question on its own page →The -closure of a state is
(i) The set of states reachable using only
(ii) The set of unreachable states
(iii) The set of final states
(iv) The dead statesWorked SolutionAnswer
Correct Option: (i) The set of states reachable using only
Explanation
-closure for NFA-:
— all states reachable from by zero or more -moves, including itself.
Example: → ECLOSE() = .
Used in subset construction for -NFA → DFA/NFA conversion: .
Other options are incorrect: not unreachable, not just finals, not dead states.
Final Answer
-closure = states via only → Option (i).
Q1i. Which of the following CFLs is deterministic? (i) {a^n b^n} (ii) Arithmetic expressions (iii) Palindromes (iv) {ww^R}20252m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Which of the following CFLs is deterministic?
(i) {}
(ii) Arithmetic expressions
(iii) Palindromes
(iv) {}Worked SolutionAnswer
Correct Option: (i)
Explanation
Deterministic CFL (DCFL): Accepted by DPDA (deterministic pushdown).
- (i) : DPDA can push 's, then pop for 's, deterministic (no choice). DCFL.
- (ii) Arithmetic expressions (e.g., ) → inherently ambiguous, CFL but not deterministic (needs guessing).
- (iii) Palindromes → not deterministic (needs to guess middle). is DCFL, but plain palindromes is NPD A.
- (iv) similar to (iii) — not DCFL.
Hence only is deterministic.
Final Answer
is DCFL → Option (i).
Q1j. Multi-tape TM is (i) More powerful than single-tape TM (ii) Less powerful (iii) Equivalent in power (iv) Not equivalent20252m
Module 4: Turing Machines (TM)
View this question on its own page →Multi-tape TM is
(i) More powerful than single-tape TM
(ii) Less powerful
(iii) Equivalent in power
(iv) Not equivalentWorked SolutionAnswer
Correct Option: (iii) Equivalent in power
Explanation
Multi-tape TM vs Single-tape TM:
- Power: Equivalent. Any -tape TM can be simulated by single-tape TM with at most quadratic slowdown (or ). Both accept exactly RE languages; deciders both accept Recursive languages.
- Efficiency: Multi-tape can be faster (e.g., palindrome vs on single tape), but not more powerful in computability.
- Construction: Single tape encodes tapes via tracks (-track tape) + markers for heads.
Therefore they are equally powerful (Turing-equivalent).
Final Answer
Equivalent in power → Option (iii).
- 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. Given the grammar G = (\{S\}, \{a, b\}, P, S) P: S \rightarrow aSb | ab Derive the string aabb using leftmost derivation, rightmost derivation and also draw the parse tree.20257m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Given the grammar
Derive the string aabb using leftmost derivation, rightmost derivation and also draw the parse tree.
Worked SolutionAnswer
Grammar: with
1. Leftmost Derivation (LMD)
At each step, replace the leftmost non-terminal.
LMD Steps:
2. Rightmost Derivation (RMD)
At each step, replace the rightmost non-terminal.
RMD Steps:
Note: Since this grammar is unambiguous and has only one non-terminal, LMD and RMD coincide in the sequence of sentential forms.
3. Parse Tree (Derivation Tree)
S /|\ a S b | S /|\ a S b | abText/Mermaid representation:
MermaidDiagramRendering diagram…Tree structure:
- Root:
- Internal nodes: (non-terminals)
- Leaves (yield): (reading left to right =
aabb) - Height: 3 (excluding root)
Verification
- String generated:
aabb✓ - Language of grammar:
aabbcorresponds to ✓
Final Answer
LMD:
RMD:
Parse Tree: As shown above (yield =aabb).Q2b. Explain the Chomsky hierarchy of languages with examples.20257m
Module 1: Introduction & Regular Languages
View this question on its own page →Explain the Chomsky hierarchy of languages with examples.
Worked SolutionAnswer
Chomsky Hierarchy (Noam Chomsky, 1956) classifies formal grammars and their languages by production rule restrictions into 4 types, forming a strict containment hierarchy.
Hierarchy Overview
Type Name Production Form Language Class Recognizing Automaton Type-0 Unrestricted , , $\alpha eq \epsilon$ Recursively Enumerable (RE) Turing Machine (TM) Type-1 Context-Sensitive , with context Context-Sensitive (CSL) Linear Bounded Automaton (LBA) Type-2 Context-Free , , Context-Free (CFL) Pushdown Automaton (PDA) Type-3 Regular (right-linear) or (left-linear) Regular (REG) Finite Automaton (DFA/NFA) Containment:
Each is a proper subset of the next.
Detailed Explanation with Examples
Type-3: Regular Languages
- Grammar: Right-linear () or Left-linear.
- Automaton: DFA/NFA/-NFA (equivalent power).
- Properties: Closed under union, intersection, complement, concatenation, star. Membership in .
- Example 1:
- Grammar: ,
- Example 2: Binary strings with even number of 1's:
- DFA: 2 states tracking parity
Type-2: Context-Free Languages (CFL)
- Grammar: (single non-terminal LHS).
- Automaton: PDA (NPDA > DPDA in power).
- Properties: Closed under union, concat, star. Not closed under intersection, complement. Parsing (CYK).
- Example 1: (matching counts)
- Grammar:
- PDA: push 's, pop for 's
- Example 2: Balanced parentheses
- Grammar:
- Example 3: (palindromes)
- NPDA guesses middle
Type-1: Context-Sensitive Languages (CSL)
- Grammar: , productions like (context around ).
- Automaton: LBA = TM with tape bounded by .
- Properties: Membership decidable (PSPACE-complete). Closed under union, intersection, complement.
- Example:
- Grammar: , , , , ,
- Generates by expanding and reordering
Type-0: Recursively Enumerable (RE)
- Grammar: No restrictions (unrestricted).
- Automaton: Turing Machine (TM).
- Properties: Not closed under complement. Halting problem undecidable. Semi-decidable.
- Example: (Halting problem)
- Note: All computable languages are RE; recursive (decidable) are subset where TM always halts.
Summary Table with Examples
Type Language Grammar Example Automaton 3 (REG) DFA 3 (REG) , DFA (2 states) 2 (CFL) PDA 2 (CFL) NPDA 1 (CSL) (as above) LBA 0 (RE) Halting Problem Unrestricted TM
Practical Implications
- Type-3: Lexical analysis, regex matching
- Type-2: Syntax analysis (parsers), programming language grammars
- Type-1: Rare in practice; natural language features
- Type-0: Theoretical limits, computability
Final Answer
Chomsky hierarchy organizes languages by grammar restrictiveness: Type-3 (Regular) ⊂ Type-2 (CFL) ⊂ Type-1 (CSL) ⊂ Type-0 (RE), each with corresponding automaton (FA, PDA, LBA, TM). Examples: REG → DFA, CFL → PDA, CSL → LBA, RE → TM.
Q3a. Design a context-free grammar (CFG) that generates all palindromes over the alphabet {0, 1}. The grammar should generate both even-length palindromes (e.g., 0110) and odd-length palindromes (e.g., 010).20257m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Design a context-free grammar (CFG) that generates all palindromes over the alphabet {0, 1}. The grammar should generate both even-length palindromes (e.g., 0110) and odd-length palindromes (e.g., 010).
Q3b. Given the regular expression: (0+1)^*01(0+1) Describe the language generated, and construct an equivalent DFA.20257m
Module 1: Introduction & Regular Languages
View this question on its own page →Given the regular expression:
Describe the language generated, and construct an equivalent DFA.
Q4a. Given a DFA D over the alphabet {a, b}, perform DFA minimization and draw the equivalent minimal DFA accepting the same language. 20257m
Module 1: Introduction & Regular Languages
View this question on its own page →Given a DFA D over the alphabet {a, b}, perform DFA minimization and draw the equivalent minimal DFA accepting the same language.

Q4b. Use the pumping lemma to prove that the language L = \{a^n b^n : n \ge 1\} is not regular.20257m
Module 1: Introduction & Regular Languages
View this question on its own page →Use the pumping lemma to prove that the language is not regular.
Q5a. Show that the following grammar is ambiguous: S \rightarrow SS | aSb | bSa | \epsilon20257m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Show that the following grammar is ambiguous:
Q5b. Construct an NFA that accepts all strings over the alphabet {0, 1, 2} that begin with one or more 0s, followed by an odd number of 1s, and end with any number of 2s.20257m
Module 1: Introduction & Regular Languages
View this question on its own page →Construct an NFA that accepts all strings over the alphabet {0, 1, 2} that begin with one or more 0s, followed by an odd number of 1s, and end with any number of 2s.
Q6a. Prove that every context-free language is context-sensitive, but the converse is not true. Support your answer with a suitable language example.20257m
Module 3: Context-Sensitive Languages
View this question on its own page →Prove that every context-free language is context-sensitive, but the converse is not true. Support your answer with a suitable language example.
Q6b. Given the following context-sensitive grammar: S \rightarrow aSBC | abc CB \rightarrow BC aB \rightarrow ab bB \rightarrow bb bC \rightarrow bc cC \rightarrow cc Identify the language generated by the grammar. Derive the string aabbcc step by step.20257m
Module 3: Context-Sensitive Languages
View this question on its own page →Given the following context-sensitive grammar:
Identify the language generated by the grammar. Derive the string aabbcc step by step.
- 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. Define a Linear Bounded Automaton (LBA). Design an LBA that accepts the language L = \{a^n b^n c^n | n \ge 1\}. Explain how tape length is restricted.20257m
Module 3: Context-Sensitive Languages
View this question on its own page →Define a Linear Bounded Automaton (LBA). Design an LBA that accepts the language . Explain how tape length is restricted.
Q7b. Design a Turing Machine that enumerates all strings over {a, b} in lexicographic order. Explain the working of the machine.20257m
Module 4: Turing Machines (TM)
View this question on its own page →Design a Turing Machine that enumerates all strings over {a, b} in lexicographic order. Explain the working of the machine.
Q8a. Design a single-tape Turing Machine that multiplies two unary numbers, where the input is of the form 1^m 0 1^n and the output is 1^{m \times n}. Clearly define the input alphabet, tape alphabet, and halting condition. Simulate the working of the Turing Machine on the input string 1101.20257m
Module 4: Turing Machines (TM)
View this question on its own page →Design a single-tape Turing Machine that multiplies two unary numbers, where the input is of the form and the output is . Clearly define the input alphabet, tape alphabet, and halting condition. Simulate the working of the Turing Machine on the input string .
Q8b. Given the regular expression r = (a+b)^* (i) Construct a context-free grammar that generates the language described by r. (ii) Explain why the grammar correctly represents the given regular expression.20257m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Given the regular expression
(i) Construct a context-free grammar that generates the language described by .
(ii) Explain why the grammar correctly represents the given regular expression.Q9a. Write a short note on Rice's Theorem with an application.20254.66m
Module 5: Undecidability
View this question on its own page →Write a short note on Rice's Theorem with an application.
Q9b. Write a short note on Deterministic vs Nondeterministic PDA.20254.66m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Write a short note on Deterministic vs Nondeterministic PDA.
Q9c. Write a short note on Universal Turing Machine.20254.66m
Module 5: Undecidability
View this question on its own page →Write a short note on Universal Turing Machine.
Q9d. Write a short note on Greibach Normal Form (GNF).20254.66m
Module 2: Context-Free Languages (CFL) and PDA
View this question on its own page →Write a short note on Greibach Normal Form (GNF).
PYQDeck for Android
Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.