2025 question paper

FORMAL LANGUAGE & AUTOMATA THEORY

28 questions

  1. 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)

    A language is said to be recursively enumerable if it is accepted by a

    (i) DFA
    (ii) Turing Machine
    (iii) PDA
    (iv) Linear Bounded Automaton

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (ii) Turing Machine

    Explanation

    A language LL is called Recursively Enumerable (RE) iff there exists a Turing Machine MM such that L=L(M)L = L(M), i.e., MM halts and accepts exactly the strings in LL. On strings not in LL, MM 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⊂CFL⊂CSL⊂RE⊂ALL \text{REG} \subset \text{CFL} \subset \text{CSL} \subset \text{RE} \subset \text{ALL}

    • 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.

  2. 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

    Regular languages belong to which type in the Chomsky hierarchy?

    (i) Type-0
    (ii) Type-2
    (iii) Type-1
    (iv) Type-3

    View this question on its own page →
    Worked Solution

    Answer

    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: A→aB∣a∣ϵA \rightarrow aB \mid a \mid \epsilon
    • Left-linear grammars
    • Regular expressions

    and recognized by DFA/NFA/ε-NFA.

    They are strictly contained:
    Type-3⊂Type-2⊂Type-1⊂Type-0 \text{Type-3} \subset \text{Type-2} \subset \text{Type-1} \subset \text{Type-0}

    Final Answer

    Regular languages are Type-3 languages. Correct option (iv).

  3. 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

    Which of the following languages is NOT regular?

    (i) {anbn∣n≥0a^n b^n | n \ge 0}
    (ii) {a,ba, b}*
    (iii) Finite languages
    (iv) Languages accepted by DFA

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (i) {anbn∣n≥0}\{a^n b^n \mid n \ge 0\}

    Explanation

    • (ii) {a,b}∗\{a,b\}^* → Regular, regex (a+b)∗(a+b)^*, 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) {anbn}\{a^n b^n\} → Classic non-regular. Requires counting unbounded nn and matching aa's with bb's. Pumping Lemma: let pp be pumping length, w=apbpw = a^p b^p, pumping yy (all aa's) breaks equality ∣w∣a=∣w∣b|w|_a = |w|_b.

    It is Context-Free (PDA can push aa's, pop for bb's) but not regular.

    Final Answer

    NOT regular is {anbn}\{a^n b^n\} → Option (i).

  4. 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

    Context-free languages are NOT closed under

    (i) Union
    (ii) Concatenation
    (iii) Intersection
    (iv) Kleene star

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (iii) Intersection

    Explanation

    Closure properties of Context-Free Languages (CFLs):

    Operation Closed?
    Union L1∪L2L_1 \cup L_2 Yes – S→S1∣S2S \rightarrow S_1 \mid S_2
    Concatenation L1L2L_1L_2 Yes – S→S1S2S \rightarrow S_1S_2
    Kleene star L∗L^* Yes – S→SS1∣ϵS \rightarrow SS_1 \mid \epsilon
    Intersection L1∩L2L_1 \cap L_2 No
    Complement L‾\overline{L} No

    Counterexample for intersection:
    L1={anbncm∣n,m≥0}L_1 = \{a^n b^n c^m \mid n,m\ge0\} (CFL), L2={ambncn∣n,m≥0}L_2 = \{a^m b^n c^n \mid n,m\ge0\} (CFL)
    L1∩L2={anbncn}L_1 \cap L_2 = \{a^n b^n c^n\} which is not CFL (pumping lemma).

    Since De Morgan: L1∩L2= L1‾∪L2‾ ‾L_1 \cap L_2 = \overline{\,\overline{L_1}\cup\overline{L_2}\,}, non-closure under intersection implies non-closure under complement.

    Final Answer

    CFLs are NOT closed under Intersection → Option (iii).

  5. 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

    Which production is not allowed in a CSG?

    (i) AB→BAAB \rightarrow BA
    (ii) A→ϵA \rightarrow \epsilon
    (iii) A→aA \rightarrow a
    (iv) aB→aba B \rightarrow a b

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (ii) A→ϵA \rightarrow \epsilon

    Explanation

    Context-Sensitive Grammar (CSG, Type-1): Production α→β\alpha \rightarrow \beta where α,β∈(V∪T)∗\alpha,\beta \in (V\cup T)^* and ∣α∣≤∣β∣|\alpha| \le |\beta| (non-contracting), except possibly S→ϵS \rightarrow \epsilon with SS not appearing on RHS.

    Check each:

    • (i) AB→BAAB \rightarrow BA : ∣α∣=2|\alpha|=2, ∣β∣=2|\beta|=2 → 2≤22 \le 2 allowed (context-sensitive, length-preserving).
    • (ii) A→ϵA \rightarrow \epsilon : ∣α∣=1|\alpha|=1, ∣β∣=0|\beta|=0 → 1≤01 \le 0 false, contracting, not allowed in CSG (unless A=SA=S and SS is start with special ϵ\epsilon rule).
    • (iii) A→aA \rightarrow a : 1≤11 \le 1 allowed.
    • (iv) aB→abaB \rightarrow ab : 2≤22 \le 2 allowed (context aa).

    Hence only A→ϵA \rightarrow \epsilon violates the monotonicity condition.

    Final Answer

    Not allowed: A→ϵA \rightarrow \epsilon → Option (ii).

  6. 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)

    A Turing Machine that prints strings of a language is called

    (i) Acceptor
    (ii) Transducer
    (iii) Generator
    (iv) Enumerator

    View this question on its own page →
    Worked Solution

    Answer

    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 w∈Lw\in L by accepting/rejecting (yes/no).
    Transducer Computes function f(w)f(w) on output tape.
    Generator / Enumerator Prints (generates) strings of LL 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.

  7. 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

    If Σ={a,b}\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 length

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (iii) All finite strings over Σ\Sigma including ϵ\epsilon

    Explanation

    Definition: Σ∗=⋃i=0∞Σi\Sigma^* = \bigcup_{i=0}^{\infty} \Sigma^i, where Σ0={ϵ}\Sigma^0 = \{\epsilon\}, Σ1=Σ\Sigma^1 = \Sigma, Σ2=ΣΣ\Sigma^2 = \Sigma\Sigma, ...

    For Σ={a,b}\Sigma = \{a,b\}:

    • ϵ\epsilon (empty string, length 0) ∈ Σ∗\Sigma^*
    • a,ba, b ∈ Σ∗\Sigma^*
    • aa,ab,ba,bbaa, ab, ba, bb ∈ Σ∗\Sigma^*
    • … 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 ϵ\epsilon → incomplete
    • (ii) Only infinite strings → false
    • (iv) Only equal length → false

    Final Answer

    All finite strings including ϵ\epsilon → Option (iii).

  8. 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

    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 states

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (i) The set of states reachable using ϵ\epsilon only

    Explanation

    ϵ\epsilon-closure ECLOSE(q)\text{ECLOSE}(q) for NFA-ϵ\epsilon:

    ECLOSE(q)={p∣q→ϵ∗p}\text{ECLOSE}(q) = \{ p \mid q \xrightarrow{\epsilon^*} p \} — all states reachable from qq by zero or more ϵ\epsilon-moves, including qq itself.

    Example: q0→ϵq1→ϵq2q_0 \xrightarrow{\epsilon} q_1 \xrightarrow{\epsilon} q_2 → ECLOSE(q0q_0) = {q0,q1,q2}\{q_0,q_1,q_2\}.

    Used in subset construction for ϵ\epsilon-NFA → DFA/NFA conversion: δD(S,a)=ECLOSE(⋃q∈Sδ(q,a))\delta_D(S,a) = \text{ECLOSE}(\bigcup_{q\in S} \delta(q,a)).

    Other options are incorrect: not unreachable, not just finals, not dead states.

    Final Answer

    ϵ\epsilon-closure = states via ϵ\epsilon only → Option (i).

  9. 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

    Which of the following CFLs is deterministic?

    (i) {anbna^n b^n}
    (ii) Arithmetic expressions
    (iii) Palindromes
    (iv) {wwRww^R}

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (i) {anbn}\{a^n b^n\}

    Explanation

    Deterministic CFL (DCFL): Accepted by DPDA (deterministic pushdown).

    • (i) {anbn}\{a^n b^n\}: DPDA can push aa's, then pop for bb's, deterministic (no choice). DCFL.
    • (ii) Arithmetic expressions (e.g., E→E+E∣E∗EE \rightarrow E+E \mid E*E) → inherently ambiguous, CFL but not deterministic (needs guessing).
    • (iii) Palindromes {wwR}\{ww^R\} → not deterministic (needs to guess middle). {w#wR}\{w\#w^R\} is DCFL, but plain palindromes is NPD A.
    • (iv) {wwR}\{ww^R\} similar to (iii) — not DCFL.

    Hence only {anbn}\{a^n b^n\} is deterministic.

    Final Answer

    {anbn}\{a^n b^n\} is DCFL → Option (i).

  10. 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)

    Multi-tape TM is

    (i) More powerful than single-tape TM
    (ii) Less powerful
    (iii) Equivalent in power
    (iv) Not equivalent

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (iii) Equivalent in power

    Explanation

    Multi-tape TM vs Single-tape TM:

    • Power: Equivalent. Any kk-tape TM can be simulated by single-tape TM with at most quadratic slowdown (or O(t2)O(t^2)). Both accept exactly RE languages; deciders both accept Recursive languages.
    • Efficiency: Multi-tape can be faster (e.g., palindrome O(n)O(n) vs O(n2)O(n^2) on single tape), but not more powerful in computability.
    • Construction: Single tape encodes kk tapes via tracks (kk-track tape) + markers for heads.

    Therefore they are equally powerful (Turing-equivalent).

    Final Answer

    Equivalent in power → Option (iii).

  11. Budget 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.

    Install Pocketly
  12. 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

    Given the grammar
    G=({S},{a,b},P,S)G = (\{S\}, \{a, b\}, P, S)
    P:S→aSb∣abP: S \rightarrow aSb | ab

    Derive the string aabb using leftmost derivation, rightmost derivation and also draw the parse tree.

    View this question on its own page →
    Worked Solution

    Answer

    Grammar: G=({S},{a,b},P,S)G = (\{S\}, \{a,b\}, P, S) with P:S→aSb∣abP: S \rightarrow aSb \mid ab

    1. Leftmost Derivation (LMD)

    At each step, replace the leftmost non-terminal.

    S⇒lmaSb(using S→aSb)⇒lmaaSbb(using S→aSb on leftmost S)⇒lmaabbb(using S→ab on leftmost S)=aabb\begin{aligned} S &\Rightarrow_{\text{lm}} aSb & \text{(using $S \rightarrow aSb$)} \\ &\Rightarrow_{\text{lm}} aaSbb & \text{(using $S \rightarrow aSb$ on leftmost $S$)} \\ &\Rightarrow_{\text{lm}} aabbb & \text{(using $S \rightarrow ab$ on leftmost $S$)} \\ &= \mathbf{aabb} \end{aligned}

    LMD Steps: S⇒lmaSb⇒lmaaSbb⇒lmaabbb=aabbS \xRightarrow{lm} aSb \xRightarrow{lm} aaSbb \xRightarrow{lm} aabbb = aabb

    2. Rightmost Derivation (RMD)

    At each step, replace the rightmost non-terminal.

    S⇒rmaSb(using S→aSb)⇒rmaaSbb(using S→aSb on rightmost S)⇒rmaabbb(using S→ab on rightmost S)=aabb\begin{aligned} S &\Rightarrow_{\text{rm}} aSb & \text{(using $S \rightarrow aSb$)} \\ &\Rightarrow_{\text{rm}} aaSbb & \text{(using $S \rightarrow aSb$ on rightmost $S$)} \\ &\Rightarrow_{\text{rm}} aabbb & \text{(using $S \rightarrow ab$ on rightmost $S$)} \\ &= \mathbf{aabb} \end{aligned}

    RMD Steps: S⇒rmaSb⇒rmaaSbb⇒rmaabbb=aabbS \xRightarrow{rm} aSb \xRightarrow{rm} aaSbb \xRightarrow{rm} aabbb = aabb

    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
                |
                ab
    

    Text/Mermaid representation:

    MermaidDiagram
    Rendering diagram…

    Tree structure:

    • Root: SS
    • Internal nodes: SS (non-terminals)
    • Leaves (yield): a,a,b,ba, a, b, b (reading left to right = aabb)
    • Height: 3 (excluding root)

    Verification

    • String generated: aabb ✓
    • Language of grammar: L(G)={anbn∣n≥1}L(G) = \{a^n b^n \mid n \ge 1\}
    • aabb corresponds to n=2n=2 ✓

    Final Answer

    LMD: S⇒lmaSb⇒lmaaSbb⇒lmaabbbS \xRightarrow{lm} aSb \xRightarrow{lm} aaSbb \xRightarrow{lm} aabbb
    RMD: S⇒rmaSb⇒rmaaSbb⇒rmaabbbS \xRightarrow{rm} aSb \xRightarrow{rm} aaSbb \xRightarrow{rm} aabbb
    Parse Tree: As shown above (yield = aabb).

  13. Q2b. Explain the Chomsky hierarchy of languages with examples.20257m

    Module 1: Introduction & Regular Languages

    Explain the Chomsky hierarchy of languages with examples.

    View this question on its own page →
    Worked Solution

    Answer

    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 \rightarrow \beta, α,β∈(V∪T)∗\alpha,\beta \in (V\cup T)^*, $\alpha
    eq \epsilon$ Recursively Enumerable (RE) Turing Machine (TM)
    Type-1 Context-Sensitive ∣α∣≤∣β∣|\alpha| \le |\beta|, α→β\alpha \rightarrow \beta with context Context-Sensitive (CSL) Linear Bounded Automaton (LBA)
    Type-2 Context-Free A→γA \rightarrow \gamma, A∈VA \in V, γ∈(V∪T)∗\gamma \in (V\cup T)^* Context-Free (CFL) Pushdown Automaton (PDA)
    Type-3 Regular A→aB∣aA \rightarrow aB \mid a (right-linear) or A→Ba∣aA \rightarrow Ba \mid a (left-linear) Regular (REG) Finite Automaton (DFA/NFA)

    Containment:
    REG⊂DCFL⊂CFL⊂CSL⊂RE⊂ALL \text{REG} \subset \text{DCFL} \subset \text{CFL} \subset \text{CSL} \subset \text{RE} \subset \text{ALL}
    Each is a proper subset of the next.


    Detailed Explanation with Examples

    Type-3: Regular Languages

    • Grammar: Right-linear (A→aB∣aA \rightarrow aB \mid a) or Left-linear.
    • Automaton: DFA/NFA/ϵ\epsilon-NFA (equivalent power).
    • Properties: Closed under union, intersection, complement, concatenation, star. Membership in O(n)O(n).
    • Example 1: L={ambn∣m,n≥0}L = \{a^m b^n \mid m,n \ge 0\}
      • Grammar: S→aS∣bA∣ϵS \rightarrow aS \mid bA \mid \epsilon, A→bA∣ϵA \rightarrow bA \mid \epsilon
    • Example 2: Binary strings with even number of 1's: (0∗10∗1)∗0∗(0^*10^*1)^*0^*
      • DFA: 2 states tracking parity

    Type-2: Context-Free Languages (CFL)

    • Grammar: A→γA \rightarrow \gamma (single non-terminal LHS).
    • Automaton: PDA (NPDA > DPDA in power).
    • Properties: Closed under union, concat, star. Not closed under intersection, complement. Parsing O(n3)O(n^3) (CYK).
    • Example 1: L={anbn∣n≥0}L = \{a^n b^n \mid n \ge 0\} (matching counts)
      • Grammar: S→aSb∣ϵS \rightarrow aSb \mid \epsilon
      • PDA: push aa's, pop for bb's
    • Example 2: Balanced parentheses
      • Grammar: S→(S)∣SS∣ϵS \rightarrow (S) \mid SS \mid \epsilon
    • Example 3: {wwR∣w∈{a,b}∗}\{ww^R \mid w \in \{a,b\}^*\} (palindromes)
      • NPDA guesses middle

    Type-1: Context-Sensitive Languages (CSL)

    • Grammar: ∣α∣≤∣β∣|\alpha| \le |\beta|, productions like αAβ→αγβ\alpha A \beta \rightarrow \alpha \gamma \beta (context around AA).
    • Automaton: LBA = TM with tape bounded by k∣w∣k|w|.
    • Properties: Membership decidable (PSPACE-complete). Closed under union, intersection, complement.
    • Example: L={anbncn∣n≥1}L = \{a^n b^n c^n \mid n \ge 1\}
      • Grammar: S→aBC∣aSBCS \rightarrow aBC \mid aSBC, CB→BCCB \rightarrow BC, aB→abaB \rightarrow ab, bB→bbbB \rightarrow bb, bC→bcbC \rightarrow bc, cC→cccC \rightarrow cc
      • Generates anbncna^n b^n c^n 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: L={⟨M⟩∣M halts on empty input}L = \{\langle M \rangle \mid M \text{ halts on empty input}\} (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) (a+b)∗(a+b)^* S→aS∣bS∣ϵS \rightarrow aS \mid bS \mid \epsilon DFA
    3 (REG) {w∣#0(w) even}\{w \mid \#_0(w) \text{ even}\} S→0S∣1AS \rightarrow 0S \mid 1A, A→0A∣1SA \rightarrow 0A \mid 1S DFA (2 states)
    2 (CFL) {anbn}\{a^n b^n\} S→aSb∣ϵS \rightarrow aSb \mid \epsilon PDA
    2 (CFL) {wwR}\{ww^R\} S→aSa∣bSb∣ϵS \rightarrow aSa \mid bSb \mid \epsilon NPDA
    1 (CSL) {anbncn}\{a^n b^n c^n\} (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.

  14. 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

    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).

    View this question on its own page →
  15. 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

    Given the regular expression:
    (0+1)∗01(0+1)(0+1)^*01(0+1)

    Describe the language generated, and construct an equivalent DFA.

    View this question on its own page →
  16. Q4a. Given a DFA D over the alphabet {a, b}, perform DFA minimization and draw the equivalent minimal DFA accepting the same language. ![image](https://res.cloudinary.com/djkpavwmp/image/upload/v1766402014/portfolio_assets/ixqepvuicnt6ji19qb3o.png)20257m

    Module 1: Introduction & Regular Languages

    Given a DFA D over the alphabet {a, b}, perform DFA minimization and draw the equivalent minimal DFA accepting the same language. image

    View this question on its own page →
  17. 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

    Use the pumping lemma to prove that the language L={anbn:n≥1}L = \{a^n b^n : n \ge 1\} is not regular.

    View this question on its own page →
  18. Q5a. Show that the following grammar is ambiguous: S \rightarrow SS | aSb | bSa | \epsilon20257m

    Module 2: Context-Free Languages (CFL) and PDA

    Show that the following grammar is ambiguous:
    S→SS∣aSb∣bSa∣ϵS \rightarrow SS | aSb | bSa | \epsilon

    View this question on its own page →
  19. 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

    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.

    View this question on its own page →
  20. 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

    Prove that every context-free language is context-sensitive, but the converse is not true. Support your answer with a suitable language example.

    View this question on its own page →
  21. 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

    Given the following context-sensitive grammar:
    S→aSBC∣abcS \rightarrow aSBC | abc
    CB→BCCB \rightarrow BC
    aB→abaB \rightarrow ab
    bB→bbbB \rightarrow bb
    bC→bcbC \rightarrow bc
    cC→cccC \rightarrow cc

    Identify the language generated by the grammar. Derive the string aabbcc step by step.

    View this question on its own page →
  22. Budget 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.

    Install Pocketly
  23. 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

    Define a Linear Bounded Automaton (LBA). Design an LBA that accepts the language L={anbncn∣n≥1}L = \{a^n b^n c^n | n \ge 1\}. Explain how tape length is restricted.

    View this question on its own page →
  24. 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)

    Design a Turing Machine that enumerates all strings over {a, b} in lexicographic order. Explain the working of the machine.

    View this question on its own page →
  25. 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)

    Design a single-tape Turing Machine that multiplies two unary numbers, where the input is of the form 1m01n1^m 0 1^n and the output is 1m×n1^{m \times n}. Clearly define the input alphabet, tape alphabet, and halting condition. Simulate the working of the Turing Machine on the input string 11011101.

    View this question on its own page →
  26. 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

    Given the regular expression r=(a+b)∗r = (a+b)^*

    (i) Construct a context-free grammar that generates the language described by rr.
    (ii) Explain why the grammar correctly represents the given regular expression.

    View this question on its own page →
  27. Q9a. Write a short note on Rice's Theorem with an application.20254.66m

    Module 5: Undecidability

    Write a short note on Rice's Theorem with an application.

    View this question on its own page →
  28. Q9b. Write a short note on Deterministic vs Nondeterministic PDA.20254.66m

    Module 2: Context-Free Languages (CFL) and PDA

    Write a short note on Deterministic vs Nondeterministic PDA.

    View this question on its own page →
  29. Q9c. Write a short note on Universal Turing Machine.20254.66m

    Module 5: Undecidability

    Write a short note on Universal Turing Machine.

    View this question on its own page →
  30. Q9d. Write a short note on Greibach Normal Form (GNF).20254.66m

    Module 2: Context-Free Languages (CFL) and PDA

    Write a short note on Greibach Normal Form (GNF).

    View this question on its own page →
Official AppAndroid App

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.