FORMAL LANGUAGE & AUTOMATA THEORY

100406
Back to FORMAL LANGUAGE & AUTOMATA THEORY

Module 1: Introduction & Regular Languages

  1. Q1a. The minimum number of states required to recognize an octal number divisible by 3 is: (i) 1 (ii) 3 (iii) 5 (iv) 720222m

    Module 1: Introduction & Regular Languages

    The minimum number of states required to recognize an octal number divisible by 3 is:

    (i) 1
    (ii) 3
    (iii) 5
    (iv) 7

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (ii) 3

    Explanation

    To check divisibility by 33, we only need the remainder modulo 3 of the number. Whether the input is binary, decimal, or octal does not change the number of remainders.

    For modulus 33, there are exactly 33 possible remainders:

    • r=0r = 0 → number divisible by 3 (accepting state)
    • r=1r = 1 → remainder 1
    • r=2r = 2 → remainder 2

    DFA Construction for Octal Alphabet

    • Alphabet: Σ={0,1,2,3,4,5,6,7}\Sigma = \{0,1,2,3,4,5,6,7\}
    • States: q0,q1,q2q_0, q_1, q_2 representing remainder 0,1,20,1,2
    • Start state: q0q_0 (value 0)
    • Accepting state: q0q_0
    • Transition: On reading octal digit dd from state qrq_r,
      δ(qr,d)=q(r×8+d) mod 3 \delta(q_r, d) = q_{(r \times 8 + d) \bmod 3}
      Since 8≡2(mod3)8 \equiv 2 \pmod 3, this simplifies to q(2r+d) mod 3q_{(2r + d) \bmod 3}.

    This DFA is complete and minimal – each remainder is distinguishable (Myhill-Nerode equivalence).

    Why other options are wrong

    • (i) 1 state: would accept all or no strings, cannot distinguish remainders.
    • (iii) 5 and (iv) 7: unnecessary extra states; ⌈log⁡23⌉\lceil \log_2 3 \rceil is not relevant.

    Final Answer

    Minimum number of states = 3 (one per residue class mod 3).

  2. Q1b. Which of the following is a regular language? (i) Strings whose length is a sequence of prime numbers (ii) Palindrome strings (iii) Strings containing substring ww^r (iv) Strings with even number of 0’s20242m

    Module 1: Introduction & Regular Languages

    Which of the following is a regular language?

    (i) Strings whose length is a sequence of prime numbers
    (ii) Palindrome strings
    (iii) Strings containing substring wwrww^r
    (iv) Strings with even number of 00’s

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (iv) Strings with even number of 00’s

    Explanation

    (iv) Even number of 00’s — Regular

    Language L4={w∈{0,1}∗∣#0(w) is even}L_4 = \{ w \in \{0,1\}^* \mid \#_0(w) \text{ is even} \} is regular. DFA with 2 states suffices:

    • q0q_0: even count (start, accepting)
    • q1q_1: odd count
      δ(q0,0)=q1,  δ(q1,0)=q0,  δ(q,1)=q\delta(q_0,0)=q_1,\;\delta(q_1,0)=q_0,\;\delta(q,1)=q.

    Regular expression: (1∗0 1∗0)∗1∗(1^*0\,1^*0)^*1^* or (1∗01∗01∗)∗(1^*01^*01^*)^*.

    By Myhill-Nerode, only 2 equivalence classes.

    (i) Length is prime — Not regular

    L1={w∣∣w∣∈PRIMES}L_1 = \{ w \mid |w| \in \text{PRIMES} \}. Use Pumping Lemma. Let pp be pumping length, choose w=0pw = 0^p where pp prime, pump gives length p+k∣y∣p + k|y| which will be composite for suitable kk (e.g., k=pk=p). So not regular. Primes set not ultimately periodic.

    (ii) Palindromes — Not regular

    L2={wwr∣w∈Σ∗}?L_2 = \{ ww^r \mid w\in\Sigma^*\}^{? } Classic non-regular. Requires unbounded stack to compare second half with first reversed. Pumping lemma: w=0p1 0pw = 0^p1\,0^p in palindrome form fails. Needs PDA, is CFL but not regular.

    (iii) Contains wwrww^r as substring — also Not regular

    L3={x wwr y∣… }L_3 = \{ x \, ww^r \, y \mid \dots\} Need to remember arbitrarily long ww to check wrw^r follows. This is not regular (can be shown via Myhill-Nerode with infinitely many distinct suffixes). It is context-sensitive.

    Final Answer

    Only (iv) is regular.

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

    Let NN be an NFA with nn states and let MM be the minimized DFA with mm states recognizing the same language. Which of the following is necessarily true?

    (i) m≤2nm \le 2^n
    (ii) n≤mn \le m
    (iii) MM has one accept state
    (iv) m=2nm = 2^n

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (i) m≤2nm \le 2^{n}

    Explanation

    NFA → DFA subset construction:

    • Each DFA state corresponds to a subset of NFA states.
    • With nn NFA states, there are at most 2n2^{n} subsets.
    • Hence the DFA obtained (before minimization) has ≤2n\le 2^{n} states.
    • Minimized DFA MM has m≤m \le number of subset-construction DFA states ≤2n\le 2^{n}.

    So (i) is always true.

    Other options:

    • (ii) n≤mn \le m is false: NFA can be exponentially smaller (e.g., language of nthn^{th} from end needs n+1n+1 NFA states but 2n2^{n} DFA states → n<mn < m sometimes, but not necessarily; sometimes DFA is smaller).
    • The converse m≥nm \ge n is not guaranteed.

    Final Answer

    m≤2nm \le 2^{n} → Option (i). (Minimized DFA minimal, so mm is even tighter, but certainly ≤2n\le 2^{n}.)

  4. Q1b. For a given Moore machine, given input = 101010, the output would be of length: (i) |Input| + 1 (ii) |Input| (iii) |Input| − 1 (iv) Cannot be predicted20222m

    Module 1: Introduction & Regular Languages

    For a given Moore machine, given input = 101010, the output would be of length:

    (i) |Input| + 1
    (ii) |Input|
    (iii) |Input| − 1
    (iv) Cannot be predicted

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (i) ∣Input∣+1|Input|+1

    Explanation

    Moore Machine: Output depends only on present state, and output is associated with state entry, including the initial state before any input is consumed.

    • For input length nn, the machine visits n+1n+1 states: q0q_0 (initial, no input) →a1q1→a2⋯→anqn\xrightarrow{a_1} q_1 \xrightarrow{a_2} \dots \xrightarrow{a_n} q_n.
    • Each state produces one output symbol λ(qi)\lambda(q_i).
    • Hence output string length = n+1n+1.

    Mealy Machine contrast: Output depends on transition (state + input), so output length = ∣Input∣|Input| = nn (one per input symbol).

    Given input 101010, ∣Input∣=6|Input|=6 → Moore output length = 77.

    Final Answer

    Moore machine output length is ∣Input∣+1|Input|+1 → Option (i).

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

  6. Q1c. The total number of states and transitions required to form a Moore machine that produces residue mod 3 are: (i) 3 and 6 (ii) 3 and 5 (iii) 2 and 4 (iv) 2 and 520222m

    Module 1: Introduction & Regular Languages

    The total number of states and transitions required to form a Moore machine that produces residue mod 3 are:

    (i) 3 and 6
    (ii) 3 and 5
    (iii) 2 and 4
    (iv) 2 and 5

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (i) 3 states and 6 transitions (for residue mod 3 Moore machine)

    Explanation

    To produce residue mod 3, need 3 states corresponding to remainders 0,1,20,1,2.

    • Alphabet: e.g., binary or unary? For general input, Moore machine that outputs residue after each symbol needs 3 states.
    • Transitions: For binary alphabet {0,1}\{0,1\}, from each of 3 states there are 2 outgoing transitions (00 and 11): 3×2=63 \times 2 =6 transitions. Formula: new remainder r′=(r×base+digit) mod 3r' = (r \times base + digit) \bmod 3.

    If alphabet were {0}\{0\} unary, transitions =3; but typical exam assumes binary/decimal digit input, hence 6.

    Other options (3,5), (2,4) insufficient to represent 3 residues.

    Final Answer

    3 states, 6 transitions → Option (i). If input alphabet size ∣Σ∣=k|\Sigma|=k, transitions =3k=3k.

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

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

    A minimum state deterministic FA accepting the language:

    L={w∣w∈{0,1}∗}L = \{ w \mid w \in \{0,1\}^* \}

    where the number of 0's and 1's in ww are divisible by 3 and 5 respectively, has:

    (i) 15 states
    (ii) 11 states
    (iii) 10 states
    (iv) 9 states

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (i) 15 states (Other options typically include 8, etc., correct is 15)

    Explanation

    Language L={w∈{0,1}∗∣#0(w) mod 3=0  ∧  #1(w) mod 5=0}L = \{ w \in \{0,1\}^* \mid \#_0(w) \bmod 3 =0 \;\land\; \#_1(w) \bmod 5 =0 \}.

    This is intersection of two regular languages:

    • L0={w∣#0(w)≡0(mod3)}L_0 = \{ w \mid \#_0(w) \equiv 0 \pmod 3 \} → DFA with 3 states (r0=0,1,2r_0=0,1,2).
    • L1={w∣#1(w)≡0(mod5)}L_1 = \{ w \mid \#_1(w) \equiv 0 \pmod 5 \} → DFA with 5 states (s0=0..4s_0=0..4).

    Intersection via product construction: states = Q0×Q1Q_0 \times Q_1 → 3×5=153 \times 5 =15 states.

    Transitions: δ((r,s),0)=((r+1) mod 3,s)\delta((r,s),0) = ((r+1)\bmod 3, s), δ((r,s),1)=(r,(s+1) mod 5)\delta((r,s),1) = (r, (s+1)\bmod5).

    Initial (0,0)(0,0), accepting (0,0)(0,0) only. Minimal because all pairs distinguishable (Myhill-Nerode: $(i,j)
    ot\equiv (i',j')if if i
    eq i'or or j
    eq j'$).

    Final Answer

    15 states (product DFA, minimal).

  9. Q1c. NFA has 'non-deterministic' in its name because: (i) The result is undetermined (ii) The choice of path is nondeterministic (iii) The next state is nondeterministic (iv) All of the mentioned20242m

    Module 1: Introduction & Regular Languages

    NFA has 'non-deterministic' in its name because:

    (i) The result is undetermined
    (ii) The choice of path is nondeterministic
    (iii) The next state is nondeterministic
    (iv) All of the mentioned

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (ii) The choice of path is nondeterministic (and equivalently (iii); if “All of the mentioned” is offered, (iv) is also defensible)

    Explanation

    Deterministic FA: δ:Q×Σ→Q\delta: Q \times \Sigma \rightarrow Q — exactly one next state for each (q,a)(q,a).

    Nondeterministic FA: δ:Q×Σ→2Q\delta: Q \times \Sigma \rightarrow 2^{Q} — a set of possible next states. The machine may:

    • be in several states simultaneously (subset view), or
    • guess a path.

    So “non-deterministic” means:

    • Next state is not uniquely determined → (iii)
    • Choice of computation path is nondeterministic → (ii)

    The “result” (accept/reject) is determined (exists some accepting path ⇔ accept), so (i) “result undetermined” is misleading.

    In many textbooks the canonical answer is (ii) Choice of path is nondeterministic (or (iii)). If option (iv) “All of the mentioned” lumps (ii)+(iii), some keys mark (iv) as correct.

    Formal

    N=(Q,Σ,δ,q0,F)N = (Q,\Sigma,\delta,q_0,F), δ(q,a)={p1,p2,… }\delta(q,a) = \{p_1,p_2,\dots\}. On input ww, NN accepts iff there exists a path q0→wf∈Fq_0 \xrightarrow{w} f\in F.

    Final Answer

    NFA is nondeterministic because the next state / path is not uniquely determined → Option (ii) (and (iii)).

  10. Q1d. Which of the following is NOT a component of a finite automaton? (i) States (ii) Input alphabet (iii) Transition function (iv) Output tape20242m

    Module 1: Introduction & Regular Languages

    Which of the following is NOT a component of a finite automaton?

    (i) States
    (ii) Input alphabet
    (iii) Transition function
    (iv) Output tape

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (iv) Output tape (is NOT a component)

    Explanation

    Finite Automaton (DFA/NFA) formal definition: M=(Q,Σ,δ,q0,F)M = (Q, \Sigma, \delta, q_0, F)

    Components:

    1. QQ: Finite set of states
    2. Σ\Sigma: Input alphabet
    3. δ\delta: Transition function Q×Σ→QQ\times\Sigma \rightarrow Q (or 2Q2^Q for NFA)
    4. q0∈Qq_0 \in Q: Start state
    5. F⊆QF \subseteq Q: Set of accepting states

    Output tape belongs to Turing Machine or Transducer (Mealy/Moore), not to basic finite automaton. FA has no output tape; it only accepts/rejects.

    Note: ϵ\epsilon and stack are for PDA, tape for TM.

    Final Answer

    Output tape is not a component of FA → Option (iv).

  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. Q1d. Which of the following is a correct statement? (i) Moore machine has no accepting states. (ii) Mealy machine has accepting states. (iii) We can convert Mealy to Moore but not vice versa. (iv) All of the above20222m

    Module 1: Introduction & Regular Languages

    Which of the following is a correct statement?

    (i) Moore machine has no accepting states.
    (ii) Mealy machine has accepting states.
    (iii) We can convert Mealy to Moore but not vice versa.
    (iv) All of the above

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (i) Moore machine has no accepting states (in transducer sense; strictly all (i)-(iii) as stated are inaccurate, so if “None of the above” were an option it would be correct — see note)

    Explanation

    Moore vs Mealy as Transducers

    • Moore: Output λ:Q→Γ\lambda: Q \rightarrow \Gamma (state output). Mealy: λ:Q×Σ→Γ\lambda: Q \times \Sigma \rightarrow \Gamma (transition output).
    • In classical transducer definition (Hopcroft-Ullman), they are not acceptors — they have no FF set. They translate every input to an output, not accept/reject. In that sense (i) “Moore has no accepting states” is true for the pure transducer, and similarly Mealy also has none, making (ii) false.

    Convertibility

    • Mealy ↔ Moore are interconvertible:
      • Mealy → Moore: expand states (at most ∣Q∣⋅∣Γ∣|Q|\cdot|\Gamma|), output delayed by one symbol.
      • Moore → Mealy: keep same states, shift output to transitions.
      • So (iii) “Mealy to Moore but not vice versa” is false. Both directions possible.

    Evaluation

    Statement Truth
    (i) Moore has no accepting states (pure transducer) True
    (ii) Mealy has accepting states False (pure Mealy also has none)
    (iii) Mealy→Moore only one way False
    (iv) All of above False

    If the question is asked in the acceptor + transducer mixed sense where Moore/Mealy can be defined with FF, then (i) and (ii) are both false and no option is strictly correct; the intended exam key is usually (i).

    Final Answer

    Per standard syllabus, (i) is the expected correct choice. Rigorously, pure Moore/Mealy are transducers without FF, and they are mutually convertible.

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

    The maximum number of states of a DFA converted from an NFA with nn states is:

    (i) nn
    (ii) n2n^2
    (iii) 2n2^n
    (iv) None of the above

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (iii) 2n2^{n}

    Explanation

    NFA with nn states → DFA via subset construction:

    Each DFA state is a subset of NFA states. NFA states set QNQ_N, ∣QN∣=n|Q_N|=n.

    Number of distinct subsets = ∣P(QN)∣=2n|\mathcal{P}(Q_N)| = 2^{n}.

    This includes ∅\emptyset (dead state).

    Hence DFA has at most 2n2^{n} states. Upper bound is tight: there exist NFA families (e.g., language “nnth symbol from end is 1”) that require exactly 2n2^{n} DFA states.

    Final Answer

    Maximum 2n2^{n} states → Option (iii). (Minimal DFA may be smaller, but maximum is 2n2^{n}.)

  14. Q1e. A DFA can have: (i) Multiple start states (ii) Multiple accepting states (iii) Transitions on \varepsilon (iv) None of the above20242m

    Module 1: Introduction & Regular Languages

    A DFA can have:

    (i) Multiple start states
    (ii) Multiple accepting states
    (iii) Transitions on ε\varepsilon
    (iv) None of the above

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (ii) Multiple accepting states

    Explanation

    DFA definition: M=(Q,Σ,δ,q0,F)M = (Q,\Sigma,\delta,q_0,F)

    • q0q_0: Exactly one start state → (i) multiple start states false. (NFA can have multiple, DFA has one).
    • F⊆QF \subseteq Q: Set of final/accepting states. Can be 0, 1, or multiple → (ii) true. Example even number of 0's DFA has 1 accept, but language (a+b)∗ab(a+b)^*ab needs 1, language “ends with 00 or 11” needs 2.
    • Transitions: δ:Q×Σ→Q\delta: Q \times \Sigma \rightarrow Q is total deterministic, no ϵ\epsilon-moves. ϵ\epsilon-transitions allowed only in ϵ\epsilon-NFA → (iii) false.

    Final Answer

    DFA can have multiple accepting states → Option (ii).

  15. Q1e. The minimum number of transitions to reach the final state as per the regular expression: \{a, b\}^* baaa is: (i) 4 (ii) 5 (iii) 6 (iv) 320222m

    Module 1: Introduction & Regular Languages

    The minimum number of transitions to reach the final state as per the regular expression:

    {a,b}∗baaa \{a, b\}^* baaa

    is:

    (i) 4
    (ii) 5
    (iii) 6
    (iv) 3

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (i) 4

    Explanation

    Regular expression: {a,b}∗baaa\{a,b\}^* baaa — language is all strings over {a,b}\{a,b\} ending with suffix baaa.

    To accept, a DFA must detect suffix b a a a (length 4).

    Minimal DFA (suffix automaton)

    States represent longest suffix of processed prefix that is prefix of baaa:

    • q0q_0: no part matched (or last bb irrelevant)
    • q1q_1: suffix b
    • q2q_2: suffix ba
    • q3q_3: suffix baa
    • q4q_4: suffix baaa (accepting)

    Transitions: each new character extends/collapses the match. From q0q_0, on b → q1q_1, on a → q0q_0; etc.

    Number of transitions on the shortest path from start q0q_0 to final q4q_4 is 4 (b→a→a→a).

    Number of states =5, transitions to reach final =4. Some keys count states=5 as “transitions”, but minimum edge traversals is 4.

    Final Answer

    4 transitions (5 states) to reach final — Option (i) 4. If counting states, answer is 5.

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

    The string 11011101 does not belong to the set represented by:

    (i) 1∗0∗(0+1)1^* 0^* (0+1)
    (ii) 1(0+1)∗1011(0+1)^*101
    (iii) (1(0)∗(0+1)∗(0+1))∗(1(0)^*(0+1)^*(0+1))^*
    (iv) {00+(11)∗0}∗\{00 + (11)^*0\}^*

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (iv) {00+(11)∗0}∗\{00 + (11)^*0\}^*

    Explanation

    Test w=1101w=1101 against each regex:

    (i) 1∗0∗(0+1)1^*0^*(0+1): = 1∗1^* then 0∗0^* then single 00 or 11. 1101=11⏟1∗0⏟0∗1⏟(0+1)1101 = \underbrace{11}_{1^*} \underbrace{0}_{0^*} \underbrace{1}_{(0+1)} → belongs.

    (ii) 1(0+1)∗1011(0+1)^*101: Must start with 11 and end with 101101. 1101=11⏟(0+1)∗1011101 = 1 \underbrace{1}_{(0+1)^*}101? Actually 11011101 = 11 + ϵ\epsilon + 101101 with middle 11? 1(0+1)∗101=1 x 1011(0+1)^*101 = 1\,x\,101 where x=0x=0? For w=1101w=1101, x=0x=0? Wait 1+0+101=11011+0+101 =1101 exactly, so w=1⋅0⋅101w = 1\cdot0\cdot101? No 1⋅101=11011\cdot101 =1101 with x=ϵx=\epsilon? 1(0+1)∗=11(0+1)^* =1, remaining 101=101101 =101 → 11011101 → belongs.

    (iii) (1(0)∗(0+1)∗(0+1))∗(1(0)^*(0+1)^*(0+1))^*: This is essentially Σ∗\Sigma^* variant (can generate any string) → belongs.

    (iv) {00+(11)∗0}∗\{00 + (11)^*0\}^*: Generators: 0000 (ends 0) and (11)∗0(11)^*0 = even 1's followed by 0, also ends 0. Any concatenation of blocks ending in 0 always ends in 0. 11011101 ends in 1 → does not belong.

    Final Answer

    $1101
    otin {00 + (11)^0}^$ → Option (iv).

  17. Q1f. Let w = xyz, y is the middle portion and |y| > 0. Repeating y zero or more times before checking membership in L is known as: (i) Generating (ii) Pumping (iii) Producing (iv) None of the above20222m

    Module 1: Introduction & Regular Languages

    Let w=xyzw = xyz, yy is the middle portion and ∣y∣>0|y| > 0. Repeating yy zero or more times before checking membership in LL is known as:

    (i) Generating
    (ii) Pumping
    (iii) Producing
    (iv) None of the above

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (ii) Pumping

    Explanation

    Pumping Lemma concept: For regular/CFL languages, any long string w=xyzw = xyz (with ∣y∣>0|y|>0, ∣xy∣≤p|xy|\le p) can be pumped: xyiz∈Lxy^i z \in L for all i≥0i \ge 0 (repeating yy zero, one, or more times).

    • Pumping = repeating the middle portion yy zero or more times and checking membership.
    • Generating is general derivation.
    • Producing is vague.

    The lemma is used to prove non-regularity/non-CFL by contradiction.

    Final Answer

    Repeating yy is Pumping → Option (ii).

  18. Q1f. Which of the following is a type of grammar in the Chomsky hierarchy? (i) Regular (ii) Context-Free (iii) Context-Sensitive (iv) All of the above20242m

    Module 1: Introduction & Regular Languages

    Which of the following is a type of grammar in the Chomsky hierarchy?

    (i) Regular
    (ii) Context-Free
    (iii) Context-Sensitive
    (iv) All of the above

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (iv) All of the above

    Explanation

    Chomsky Hierarchy classifies grammars into 4 types:

    Type Name Production Form Language Class
    Type-0 Unrestricted α→β\alpha \rightarrow \beta, no restriction Recursively Enumerable (TM)
    Type-1 Context-Sensitive ∣α∣≤∣β∣|\alpha| \le |\beta|, α→β\alpha \rightarrow \beta with context CSL (LBA)
    Type-2 Context-Free A→γA \rightarrow \gamma, A∈VA\in V CFL (PDA)
    Type-3 Regular A→aB∣aA \rightarrow aB \mid a, A→aA\rightarrow a Regular (FA)
    • (i) Regular → Type-3 ✓
    • (ii) Context-Free → Type-2 ✓
    • (iii) Context-Sensitive → Type-1 ✓

    All three are in Chomsky hierarchy (Type-0 is the super-set).

    Final Answer

    All are types → Option (iv) All of the above.

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

    For an NFA with nn states, the minimized DFA has:

    (i) m≤2nm \le 2^n
    (ii) n≤mn \le m
    (iii) one accept state
    (iv) m=2nm = 2^n

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (i) m≤2nm \le 2^{n}

    Explanation

    Same as Q28 / Q87: Subset construction.

    NFA nn states → DFA has at most 2n2^{n} subsets. Minimized DFA mm ≤ subset DFA ≤ 2n2^{n}.

    • (ii) n≤mn \le m is not necessarily true (NFA can be smaller).
    • (iv) m=2nm =2^{n} is not always (upper bound, but often smaller).
    • (iii) one accept state is false (can be multiple).

    Final Answer

    m≤2nm \le 2^{n} → Option (i).

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

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

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

    A minimum state DFA for the language:

    L={w∈{0,1}∗:#0(w)≡0mod  3,  #1(w)≡0mod  5} 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 states

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (i) 15 states

    Explanation

    Language L={w∣#0 mod 3=0,  #1 mod 5=0}L = \{ w \mid \#_0 \bmod 3 =0,\; \#_1 \bmod 5 =0\} is same as Q92 / Q112.

    As before: DFA for #0 mod 3\#_0 \bmod 3 needs 3 states, for #1 mod 5\#_1 \bmod 5 needs 5 states. Product → 3×5=153 \times 5 =15 minimal states.

    Transitions: 15×2=3015 \times 2 =30.

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

  24. Q1i. Which of these represents a regular language? (i) \{ a^n b^n \mid n \ge 0 \} (ii) Strings with equal number of a’s and b’s (iii) \{ a^n \mid n \text{ is prime} \} (iv) \{ w \mid w \text{ starts with 'a' and ends with 'b'} \}20242m

    Module 1: Introduction & Regular Languages

    Which of these represents a regular language?

    (i) {anbn∣n≥0}\{ a^n b^n \mid n \ge 0 \}
    (ii) Strings with equal number of aa’s and bb’s
    (iii) {an∣n is prime}\{ a^n \mid n \text{ is prime} \}
    (iv) {w∣w starts with ’a’ and ends with ’b’}\{ w \mid w \text{ starts with 'a' and ends with 'b'} \}

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (iv) {w∣w starts with ’a’ and ends with ’b’}\{ w \mid w \text{ starts with 'a' and ends with 'b'} \}

    Explanation

    Test each:

    • (i) {anbn}\{a^n b^n\} → Not regular (needs stack, CFL).
    • (ii) Equal number of aa's and bb's → {w∣#a=#b}\{ w \mid \#_a = \#_b \} not regular (needs counting). Pumping fails.
    • (iii) {an∣n prime}\{a^n \mid n \text{ prime}\} → Not regular (non-periodic), also not CFL.
    • (iv) Starts with a and ends with b → Regular.

    DFA for (iv): 3 states

    • q0q_0 start (no symbol yet, non-accepting)
    • q1q_1 = last symbol a? Actually needs start a, so q0→aq1q_0 \xrightarrow{a} q_1, q0→bqdeadq_0 \xrightarrow{b} q_{dead}.
    • q1q_1 = seen start a, last is a (non-accepting)
    • q2q_2 = seen start a, last is b (accepting)
      Transitions: q1→aq1q_1 \xrightarrow{a} q_1, q1→bq2q_1 \xrightarrow{b} q_2, q2→aq1q_2 \xrightarrow{a} q_1, q2→bq2q_2 \xrightarrow{b} q_2.

    Regular expression: a(a+b)∗ba(a+b)^*b (plus handle length 1? Actually abab inclusive). More precisely aΣ∗ba\Sigma^*b.

    Hence regular.

    Final Answer

    Only (iv) is regular.

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

    If PP and QQ are regular expressions (PP is not null), then R=Q+RPR = Q + RP has the unique solution:

    (i) R=QPR = QP
    (ii) R=PQ∗R = PQ^*
    (iii) R=QP∗R = QP^*
    (iv) R=QP∗R = QP^*

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (iii) R=QP∗R = QP^* (Arden’s Theorem)

    Explanation

    Arden’s Theorem: If PP does not contain ϵ\epsilon, then equation R=Q+RPR = Q + RP has unique solution R=QP∗R = QP^*.

    Proof: R=Q+(Q+RP)P=Q(ϵ+P)+RP2=⋯=Q(ϵ+P+P2+⋯+Pk)+RPk+1R = Q + (Q + RP)P = Q(\epsilon + P) + RP^2 = \dots = Q(\epsilon + P + P^2 + \dots + P^{k}) + RP^{k+1}. As k→∞k \to \infty, RPk+1RP^{k+1} contributes no finite strings if language, so R=QP∗R = QP^*.

    • (i) QPQP missing star → incomplete.
    • (ii) PQ∗PQ^* swaps order (concatenation not commutative).
    • (iv) duplicate of (iii).

    Condition: PP not null ($\epsilon
    otin P$) ensures uniqueness.

    Final Answer

    R=QP∗R = QP^* → Option (iii) (also (iv) if duplicate).

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

    The construction time for DFA from NFA with mm nodes is:

    (i) O(m2)O(m^2)
    (ii) O(2m)O(2^m)
    (iii) O(m)O(m)
    (iv) O(log⁡m)O(\log m)

    View this question on its own page →
    Worked Solution

    Answer

    Correct Option: (ii) O(2m)O(2^{m})

    Explanation

    NFA with mm states → DFA via subset construction:

    Number of DFA states =2m= 2^{m} in worst case, and constructing each state requires processing transitions for each symbol (∣Σ∣|\Sigma|).

    Time is proportional to number of subsets times alphabet:

    T=O(∣Σ∣⋅2m)=O(2m)T = O(|\Sigma| \cdot 2^{m}) = O(2^{m})

    (If counting edges, O(m⋅2m)O(m \cdot 2^{m}) but dominant exponential.)

    Options:

    • O(m2)O(m^2) — polynomial, false for NFA→DFA
    • O(m)O(m) — linear, false
    • O(log⁡m)O(\log m) — false

    Final Answer

    O(2m)O(2^{m}) → Option (ii).

  27. Q2a. Design a DFA for strings over \{a, b\} containing at least three occurrences of bbb (overlapping allowed). Example: bbbbbb is accepted.20227m

    Module 1: Introduction & Regular Languages

    Design a DFA for strings over {a,b}\{a, b\} containing at least three occurrences of bbb (overlapping allowed). Example: bbbbbb is accepted.

    View this question on its own page →
    Worked Solution

    Answer

    Design a DFA for at least three occurrences of substring bbb (overlapping allowed). Example bbbbbb accepted.

    1. Language

    L={w∈{a,b}∗∣w contains bbb at least 3 times, overlapping counts}L = \{ w \in \{a,b\}^* \mid w \text{ contains } bbb \text{ at least 3 times, overlapping counts} \}.

    Occurrences are counted with overlap: bbbb contains 2 occurrences (bbb at positions 1-3 and 2-4), bbbbbb contains 4 occurrences.

    We need to count up to 3 and stay in accepting state after.

    2. Construction Idea

    Track:

    • suffix of consecutive bb's (0,1,2) and number of bbbbbb seen so far (0,1,2,≥3).

    States: qc,kq_{c,k} where cc = trailing bb run capped at 2, kk = count of bbbbbb seen (0-2, ≥3). But we can compress to 7 states:

    State Meaning kk, trailing bb’s
    q0q_0 no bbbbbb yet, ends with aa or start k=0k=0, c=0c=0
    q1q_{1} ends with bb (c=1c=1) k=0k=0, c=1c=1
    q2q_{2} ends with bbbb (c=2c=2) k=0k=0, c=2c=2
    q3q_{3} seen 1 bbbbbb, ends with bbbbbb (c=3→2) k=1k=1, c=2c=2
    q4q_{4} 11 bbbbbb + ends with bb (after aa) k=1k=1, c=1c=1? etc. Simpler: count after detection
    q5q_{5} seen 2 bbbbbb k=2k=2
    q6q_{6} seen ≥3 bbbbbb (accepting, trap) k≥3k\ge3

    Simplified minimal DFA with 7 states (q0q_0–q6q_6, q6q_6 accepting):

    Transitions (partial, showing bb-chain):

    q0 --a--> q0 , q0 --b--> q1
    q1 --a--> q0 , q1 --b--> q2
    q2 --a--> q0 , q2 --b--> q3   // first bbb detected, k=1
    q3 --a--> q4 , q3 --b--> q5   // bbbb: overlapping second bbb (q3 --b--> q5)
    q4 --a--> q0 , q4 --b--> q1? Actually after a, reset; need systematic.
    

    Full systematic table (compressed):

    State aa bb
    q0(0)q_0 (0) q0q_0 q1q_1
    q1q_1 q0q_0 q2q_2
    q2q_2 q0q_0 q3q_3
    q3(1)q_3 (1) q4aq_{4a} q5q_5
    q4q_4 (1 with reset) q0q_0 q1′q_1'?
    q5(2)q_5 (2) q4bq_{4b} q6q_6
    q6(≥3)q_6 (≥3) q6q_6 q6q_6

    For exam, you can draw diagram:

    MermaidDiagram
    Rendering diagram…

    Set initial q0q_0, final F={q6}F=\{q_6\}.

    Test: bbbbbb:
    q0→bq1→bq2→bq3→bq5→bq6→bq6q_0 \xrightarrow{b} q_1 \xrightarrow{b} q_2 \xrightarrow{b} q_3 \xrightarrow{b} q_5 \xrightarrow{b} q_6 \xrightarrow{b} q_6 → accepted (4 occurrences ≥3).

    3. Minimality

    77 states are minimal (need to distinguish counts 0,1,2 and trailing run). Could be reduced to 6 with optimization but 7 is clear for exam.

    Final Answer

    DFA with 7 states, one accepting trap q6q_6 that counts overlapping bbbbbb occurrences ≥3, as above. Regular expression: (a+ba+bba)∗bbb(a+ba+bba)∗bbb(a+ba+bba)∗bbb(a+b)∗(a+ba+bba)^* bbb (a+ba+bba)^* bbb (a+ba+bba)^* bbb (a+b)^* (overlap makes regex messy, DFA preferred).

  28. Q2a. Discuss the Chomsky hierarchy of grammars with suitable examples.20237m

    Module 1: Introduction & Regular Languages

    Discuss the Chomsky hierarchy of grammars with suitable examples.

    View this question on its own page →
  29. Q2a. What is Automata? Explain classification of Automata.20247m

    Module 1: Introduction & Regular Languages

    What is Automata? Explain classification of Automata.

    View this question on its own page →
    Worked Solution

    Answer

    1. What is Automata?

    Automata (plural of Automaton) is an abstract mathematical model of computation. It is a finite representation of an infinite computation that reads input symbols, changes states according to transition rules, and decides acceptance. It is the theoretical foundation for compiler design, lexical analysis, and computability.

    Formally, automaton = (Input + Finite Control + Memory + Output/Acceptance).

    No physical infinite hardware is needed; the model studies what can be computed with given memory.

    2. Classification of Automata

    Classification follows memory power and matches Chomsky hierarchy:

    MermaidDiagram
    Rendering diagram…

    A. Finite Automata (FA) — Type-3, Regular

    • Memory: Only finite control (QQ), no auxiliary memory.
    • Types: DFA (δ:Q×Σ→Q \delta: Q\times\Sigma\rightarrow Q), NFA, ϵ\epsilon-NFA (all equivalent).
    • Power: Regular languages. Example: L={w∣#0(w) even}L = \{ w \mid \#_0(w) \text{ even}\}, (a+b)∗ab(a+b)^*ab.
    • Use: Lexical analyzer, pattern matching.

    B. Pushdown Automata (PDA) — Type-2, Context-Free

    • Memory: Stack (LIFO). P=(Q,Σ,Γ,δ,q0,Z0,F)P = (Q,\Sigma,\Gamma,\delta,q_0,Z_0,F).
    • Types: DPDA vs NPDA (different power).
    • Power: CFLs. Example: L={anbn∣n≥0}L = \{a^n b^n \mid n\ge0\}, balanced parentheses, arithmetic expressions.
    • Use: Syntax analysis (parsing).

    C. Linear Bounded Automaton (LBA) — Type-1, Context-Sensitive

    • Memory: Tape bounded by input length ∣w∣|w| (plus two endmarkers). Can read/write but not beyond bounds.
    • Power: CSLs. Example: L={anbncn}L = \{a^n b^n c^n\}, {an2}\{a^{n^2}\}.
    • Use: Rare in practice, studies context-sensitive features.

    D. Turing Machine (TM) — Type-0, RE

    • Memory: Infinite tape, read/write head, finite control.
    • Types: Deterministic, Nondeterministic, Multi-tape, Universal (all equivalent in power).
    • Power: Recursively Enumerable (Type-0) and Recursive (Decidable) with always-halting variant.
    • Example: L={ww∣w∈{a,b}∗}L = \{ ww \mid w\in\{a,b\}^*\}, Halting, any computable function.
    • Use: Model of general-purpose computer.

    Summary Table

    Automaton Memory Grammar Type Language Decidability
    FA (DFA/NFA) QQ Type-3 Regular Regular Decidable (all properties)
    PDA QQ + Stack Type-2 CFG CFL Emptiness decidable, equivalence undecidable
    LBA QQ + tape ∣w∣|w| Type-1 CSG CSL Membership decidable (PSPACEPSPACE)
    TM QQ + ∞\infty tape Type-0 unrestricted RE Halting undecidable

    Hierarchy: FA⊂PDA⊂LBA⊂TM\text{FA} \subset \text{PDA} \subset \text{LBA} \subset \text{TM} and Regular⊂CFL⊂CSL⊂RE\text{Regular} \subset \text{CFL} \subset \text{CSL} \subset \text{RE}.

    Final Answer

    Automata are abstract computing models; classification by memory gives FA → PDA → LBA → TM corresponding to Chomsky Types 3→2→1→0.

  30. Q2a. Tabulate the Chomsky hierarchy of grammars with an example for each.20217m

    Module 1: Introduction & Regular Languages

    Tabulate the Chomsky hierarchy of grammars with an example for each.

    View this question on its own page →
    Worked Solution

    Answer

    Chomsky Hierarchy of Grammars

    Type Grammar Name Production Form α→β\alpha \rightarrow \beta Language Class Automaton
    Type-0 Unrestricted No restriction on α,β\alpha,\beta (except $\alpha
    eq \epsilon$) Recursively Enumerable (RE) Turing Machine
    Type-1 Context-Sensitive ∣α∣≤∣β∣|\alpha| \le |\beta|, β\beta has α\alpha in context Context-Sensitive (CSL) Linear Bounded Automaton
    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 / Right-Linear A→aB∣aA \rightarrow aB \mid a (or left-linear) Regular (REG) Finite Automaton (DFA/NFA)

    Examples

    Type Example Grammar Language Generated
    Type-0 S→aSb∣ϵS \rightarrow aSb \mid \epsilon with unrestricted rules e.g. aB→BaaB \rightarrow Ba {anbncn∣n≥0}\{a^n b^n c^n \mid n\ge0\} or any computable language
    Type-1 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 {anbncn∣n≥1}\{a^n b^n c^n \mid n\ge1\}
    Type-2 S→aSb∣SS∣ϵS \rightarrow aSb \mid SS \mid \epsilon {w∣#a(w)=#b(w)}\{w \mid \#_a(w) = \#_b(w)\} (balanced parentheses)
    Type-2 S→(S)∣SS∣ϵS \rightarrow (S) \mid SS \mid \epsilon Balanced parentheses language
    Type-3 S→0S∣1S∣ϵS \rightarrow 0S \mid 1S \mid \epsilon {0,1}∗\{0,1\}^* (all binary strings)
    Type-3 S→aS∣bAS \rightarrow aS \mid bA, A→bA∣bA \rightarrow bA \mid b {ambn∣m,n≥1}\{a^m b^n \mid m,n\ge1\} (right-linear)

    Containment Relations

    REG⊂DCFL⊂CFL⊂CSL⊂RE⊂ALL \text{REG} \subset \text{DCFL} \subset \text{CFL} \subset \text{CSL} \subset \text{RE} \subset \text{ALL}

    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 O(n3)O(n^3) (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.

  31. Q2b. Tabulate the Chomsky hierarchy of grammars with an example of each.20247m

    Module 1: Introduction & Regular Languages

    Tabulate the Chomsky hierarchy of grammars with an example of each.

    View this question on its own page →
  32. Q2b. Let L \subseteq \{0,1,2\}^* be strings without consecutive identical symbols (no 00, no 11, no 22). Design a DFA for L.20227m

    Module 1: Introduction & Regular Languages

    Let L⊆{0,1,2}∗L \subseteq \{0,1,2\}^* be strings without consecutive identical symbols (no 0000, no 1111, no 2222). Design a DFA for LL.

    View this question on its own page →
    Worked Solution

    Answer

    Language: L={w∈{0,1,2}∗∣no 00,11,22 as substring}L = \{ w \in \{0,1,2\}^* \mid \text{no } 00, 11, 22 \text{ as substring} \}

    DFA Construction

    Idea: Track the last symbol seen (0, 1, or 2) or "none yet" (start). Forbid transition on same symbol as last.

    States:

    • qϵq_\epsilon : start, no symbol yet (also accepting)
    • q0q_0 : last symbol was 0 (accepting)
    • q1q_1 : last symbol was 1 (accepting)
    • q2q_2 : last symbol was 2 (accepting)
    • q×q_\times : dead/reject state (non-accepting)

    Alphabet: Σ={0,1,2}\Sigma = \{0,1,2\}

    Transition Function δ\delta:

    State \\backslash Input 0 1 2
    qϵq_\epsilon q0q_0 q1q_1 q2q_2
    q0q_0 q×q_\times q1q_1 q2q_2
    q1q_1 q0q_0 q×q_\times q2q_2
    q2q_2 q0q_0 q1q_1 q×q_\times
    q×q_\times q×q_\times q×q_\times q×q_\times

    Formal DFA: M=(Q,Σ,δ,qϵ,F)M = (Q, \Sigma, \delta, q_\epsilon, F) where

    • Q={qϵ,q0,q1,q2,q×}Q = \{q_\epsilon, q_0, q_1, q_2, q_\times\}
    • Σ={0,1,2}\Sigma = \{0,1,2\}
    • qϵq_\epsilon initial
    • F={qϵ,q0,q1,q2}F = \{q_\epsilon, q_0, q_1, q_2\} (all except dead)
    • δ\delta as table above

    State Diagram (Mermaid)

    MermaidDiagram
    Rendering diagram…

    Regular Expression (for verification)

    L=ϵ+(0+1+2)((0+1+2)−(00+11+22))∗L = \epsilon + (0+1+2)( (0+1+2) - (00+11+22) )^*
    More compactly using complement:
    L=Σ∗∖Σ∗(00+11+22)Σ∗L = \Sigma^* \setminus \Sigma^*(00+11+22)\Sigma^*

    Test Cases

    Input Path Accept?
    ϵ\epsilon qϵq_\epsilon Yes
    012012 qϵ→0q0→1q1→2q2q_\epsilon \xrightarrow{0} q_0 \xrightarrow{1} q_1 \xrightarrow{2} q_2 Yes
    010010 q0→q1→q0q_0 \to q_1 \to q_0 Yes
    0000 q0→0q×q_0 \xrightarrow{0} q_\times No
    101101 q1→q0→q1q_1 \to q_0 \to q_1 Yes
    21212121 q2→q1→q2→q1q_2 \to q_1 \to q_2 \to q_1 Yes

    Minimality

    5 states are minimal (Myhill-Nerode: ϵ,0,1,2\epsilon, 0, 1, 2 are pairwise distinguishable; dead state needed).

    Final Answer

    DFA with 5 states (qϵ,q0,q1,q2,q×q_\epsilon, q_0, q_1, q_2, q_\times), accepting all except q×q_\times, transitions as table above. Rejects any string with 00,11,00, 11, or 2222.

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

  35. Q2b. Design a finite-state machine (FSM) for a parity checker.20217m

    Module 1: Introduction & Regular Languages

    Design a finite-state machine (FSM) for a parity checker.

    View this question on its own page →
    Worked Solution

    Answer

    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: Σ={0,1}\Sigma = \{0, 1\} (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: Q={E,O}Q = \{E, O\}

    • EE: Even number of 1's seen so far (initial, accepting for even parity)
    • OO: Odd number of 1's seen so far

    Output function λ\lambda:

    • λ(E)=0\lambda(E) = 0 (even parity)
    • λ(O)=1\lambda(O) = 1 (odd parity)

    Transition function δ\delta:

    State Input 0 Input 1
    EE EE OO
    OO OO EE

    State Diagram:

            0
         ┌────┐
         │    ▼
      (E)───►(O)
         ▲   │
         └───1
    
    • On 0: stay in same parity state
    • On 1: flip parity

    Formal Moore: M=(Q,Σ,Δ,δ,λ,q0)M = (Q, \Sigma, \Delta, \delta, \lambda, q_0)

    • Q={E,O}Q = \{E, O\}, Σ={0,1}\Sigma = \{0,1\}, Δ={0,1}\Delta = \{0,1\}
    • δ(E,0)=E,δ(E,1)=O,δ(O,0)=O,δ(O,1)=E\delta(E,0)=E, \delta(E,1)=O, \delta(O,0)=O, \delta(O,1)=E
    • λ(E)=0,λ(O)=1\lambda(E)=0, \lambda(O)=1
    • q0=Eq_0 = E

    2. Mealy Machine (Output on Transition)

    States: Q={E,O}Q = \{E, O\} (same states, no output on states)

    Output on transition:

    Transition Input Next State Output
    E→0EE \xrightarrow{0} E 0 EE 0
    E→1OE \xrightarrow{1} O 1 OO 1
    O→0OO \xrightarrow{0} O 0 OO 1
    O→1EO \xrightarrow{1} E 1 EE 0

    State Diagram:

          0/0
       ┌─────┐
       │     ▼
      (E)──►(O)
      │1/1   │0/1
       └─────1/0
    

    Formal Mealy: M=(Q,Σ,Δ,δ,λ,q0)M = (Q, \Sigma, \Delta, \delta, \lambda, q_0) with λ:Q×Σ→Δ\lambda: Q\times\Sigma \to \Delta.


    3. Even Parity Generator (Output at End)

    If only final parity needed (not running):

    • Run Moore/Mealy above
    • After last input, output λ(q)\lambda(q) (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 E→O→O→E→OE \to O \to O \to E \to O 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)
  36. 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

    Construct an NFA accepting strings over {0,1,2}\{0,1,2\} beginning with 0, followed by an odd number of 1s, ending with any number of 2s.

    View this question on its own page →
    Worked Solution

    Answer

    Language: L={0 12k+1 2∗∣k≥0}={01 2∗, 0111 2∗, 011111 2∗,… }L = \{ 0\, 1^{2k+1}\, 2^* \mid k \ge 0 \} = \{ 01\, 2^*,\, 0111\, 2^*,\, 011111\, 2^*, \dots \}

    Structure: starts with 0 → odd number of 1's → any number of 2's.


    NFA Design

    NFA: N=(Q,Σ,δ,q0,F)N = (Q, \Sigma, \delta, q_0, F)

    • Σ={0,1,2}\Sigma = \{0,1,2\}
    • Q={q0,q1,q2,q3}Q = \{q_0, q_1, q_2, q_3\}
    • q0q_0 = start
    • F={q3}F = \{q_3\} (final)

    States meaning:

    • q0q_0: initial, expecting leading 0
    • q1q_1: saw 0, read first 1 (odd count = 1)
    • q2q_2: in even number of 1's (after 2nd, 4th, ...)
    • q3q_3: in odd number of 1's (after 1st, 3rd, ...) — can transition to 2's

    Transition Function δ\delta

    State Input Next State(s)
    q0q_0 00 {q1}\{q_1\}
    q1q_1 11 {q2}\{q_2\}
    q2q_2 11 {q1}\{q_1\}
    q1q_1 22 {q3}\{q_3\}
    q3q_3 22 {q3}\{q_3\}

    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 q0→0q1→1q2q_0 \xrightarrow{0} q_1 \xrightarrow{1} q_2 → no (ends in q2q_2, even 1's)
    011 q0→q1→1q2→1q1q_0 \to q_1 \xrightarrow{1} q_2 \xrightarrow{1} q_1 → yes (q1→2q3∈Fq_1 \xrightarrow{2} q_3 \in F)
    0111 q0→q1→1q2→1q1→1q2q_0 \to q_1 \xrightarrow{1} q_2 \xrightarrow{1} q_1 \xrightarrow{1} q_2 → no (even)
    012 q0→q1→1q2→2q_0 \to q_1 \xrightarrow{1} q_2 \xrightarrow{2} → no (q2q_2 has no 2-transition)
    0112 q0→q1→1q2→1q1→2q3q_0 \to q_1 \xrightarrow{1} q_2 \xrightarrow{1} q_1 \xrightarrow{2} q_3 → yes
    01112 q0→q1→1q2→1q1→1q2→2q_0 \to q_1 \xrightarrow{1} q_2 \xrightarrow{1} q_1 \xrightarrow{1} q_2 \xrightarrow{2} → no
    01122 q0→q1→1q2→1q1→2q3→2q3q_0 \to q_1 \xrightarrow{1} q_2 \xrightarrow{1} q_1 \xrightarrow{2} q_3 \xrightarrow{2} q_3 → yes
    0 q0→0q1q_0 \xrightarrow{0} q_1 → no (no 1's, count=0 even)

    Equivalent DFA (via Subset Construction)

    States = subsets of NFA states:

    • A={q0}A = \{q_0\}
    • B={q1}B = \{q_1\}
    • C={q2}C = \{q_2\}
    • D={q1,q3}D = \{q_1, q_3\}
    • E={q3}E = \{q_3\} (accepting)
    • Dead = ∅\emptyset

    But NFA is simpler and sufficient.


    Regular Expression

    0(11)∗1 2∗=0 (11)∗ 1 2∗0(11)^*1\,2^* = 0\,(11)^*\,1\,2^*

    Verification:

    • 01 = 0⋅(11)0⋅1⋅200 \cdot (11)^0 \cdot 1 \cdot 2^0 ✓
    • 0111 = 0⋅(11)1⋅10 \cdot (11)^1 \cdot 1 ✓
    • 011122 = 0⋅(11)1⋅1⋅220 \cdot (11)^1 \cdot 1 \cdot 2^2 ✓

    Final Answer

    NFA with 4 states (q0,q1,q2,q3q_0,q_1,q_2,q_3):

    • q0→0q1q_0 \xrightarrow{0} q_1 (leading 0)
    • q1→1q2→1q1q_1 \xrightarrow{1} q_2 \xrightarrow{1} q_1 (toggle odd/even 1's)
    • q1→2q3q_1 \xrightarrow{2} q_3 (odd 1's → can start 2's)
    • q3→2q3q_3 \xrightarrow{2} q_3 (any number of 2's)
    • Final = {q3}\{q_3\}
    • Accepts 0(11)∗12∗0(11)^*1 2^* exactly.
  37. Q3a. Construct DFA for all strings over \{0,1\} interpreted as binary numbers divisible by 4.20247m

    Module 1: Introduction & Regular Languages

    Construct DFA for all strings over {0,1}\{0,1\} interpreted as binary numbers divisible by 44.

    View this question on its own page →
    Worked Solution

    Answer

    Language: L={w∈{0,1}∗∣value2(w)≡0(mod4)}L = \{ w \in \{0,1\}^* \mid \text{value}_2(w) \equiv 0 \pmod 4 \}

    Interpret string as binary number (most significant bit first), check divisibility by 4.


    Key Observation

    A binary number is divisible by 4 iff its last two bits are 00 (or the string is just "0" or empty, treated as 0).

    • Binary x≡0(mod4)  ⟺  xx \equiv 0 \pmod 4 \iff x ends in 00.
    • Special case: empty string ϵ\epsilon and "0" represent 0, divisible by 4.

    DFA Construction (4 states)

    Track value modulo 4. States = residues {0,1,2,3}\{0,1,2,3\}.

    DFA: M=(Q,Σ,δ,q0,F)M = (Q, \Sigma, \delta, q_0, F)

    • Q={q0,q1,q2,q3}Q = \{q_0, q_1, q_2, q_3\} where qrq_r = value ≡r(mod4)\equiv r \pmod 4
    • Σ={0,1}\Sigma = \{0,1\}
    • q0q_0 = start (value 0)
    • F={q0}F = \{q_0\} (residue 0)

    Transition: On input bit b∈{0,1}b \in \{0,1\}:

    δ(qr,b)=q(2r+b) mod 4\delta(q_r, b) = q_{(2r + b) \bmod 4}

    Transition Table:

    State \ Input 0 1
    q0q_0 (0) q0q_0 q1q_1
    q1q_1 (1) q2q_2 q3q_3
    q2q_2 (2) q0q_0 q1q_1
    q3q_3 (3) q2q_2 q3q_3

    Derivation:

    • 2×0+0=0→q02 \times 0 + 0 = 0 \to q_0
    • 2×0+1=1→q12 \times 0 + 1 = 1 \to q_1
    • 2×1+0=2→q22 \times 1 + 0 = 2 \to q_2
    • 2×1+1=3→q32 \times 1 + 1 = 3 \to q_3
    • 2×2+0=4≡0→q02 \times 2 + 0 = 4 \equiv 0 \to q_0
    • 2×2+1=5≡1→q12 \times 2 + 1 = 5 \equiv 1 \to q_1
    • 2×3+0=6≡2→q22 \times 3 + 0 = 6 \equiv 2 \to q_2
    • 2×3+1=7≡3→q32 \times 3 + 1 = 7 \equiv 3 \to q_3

    State Diagram

    MermaidDiagram
    Rendering diagram…

    Simplified 3-State DFA (Using Last-Two-Bits Insight)

    Since divisibility by 4 depends only on last 2 bits = 00:

    DFA with 3 states:

    • q0q_0: start, also accept (0 or empty or ...00)
    • q1q_1: last bit = 1
    • q2q_2: last bit = 0, previous ≠ 0 (i.e., ends in 10)
    State \ Input 0 1
    q0q_0 (accept) q0q_0 q1q_1
    q1q_1 q2q_2 q1q_1
    q2q_2 q0q_0 q1q_1

    F={q0}F = \{q_0\}. q0q_0 = last two bits 00 (or empty/"0").

    Why 3 states minimal: Myhill-Nerode: ϵ,1,10\epsilon, 1, 10 are pairwise distinguishable mod 4.


    Test Cases

    Input Value Path Accept?
    ϵ\epsilon 0 q0q_0 Yes
    0 0 q0→0q0q_0 \xrightarrow{0} q_0 Yes
    100 4 q0→q1→0q2→0q0q_0 \to q_1 \xrightarrow{0} q_2 \xrightarrow{0} q_0 Yes
    1000 8 q0→q1→q2→q0→q0q_0 \to q_1 \to q_2 \to q_0 \to q_0 Yes
    10 2 q0→q1→0q2q_0 \to q_1 \xrightarrow{0} q_2 No ($q_2
    otin F$)
    101 5 q0→q1→0q2→1q1q_0 \to q_1 \xrightarrow{0} q_2 \xrightarrow{1} q_1 No
    1100 12 ends in q0q_0 Yes

    Regular Expression

    (0+1)∗00+0(0+1)^*00 + 0

    (All strings ending in 00 plus the single 0; ϵ\epsilon can be included as (0+1)*00 | 0 | \epsilon)


    Final Answer

    DFA with 4 states (mod 4 tracking) or minimal 3 states:

    • States: residues 0,1,2,3 (or 3-state: 00, ends-in-1, ends-in-10)
    • Transitions: δ(qr,b)=q(2r+b) mod 4\delta(q_r, b) = q_{(2r+b)\bmod 4}
    • Accept: q0q_0 only
    • Binary divisible by 4 ⇔ ends in 00 (or is 0/ε)
    DFA(3 states):
    q0 --0--> q0
    q0 --1--> q1
    q1 --0--> q2
    q1 --1--> q1
    q2 --0--> q0
    q2 --1--> q1
    Accept: q0
    
  38. Q3b. Construct DFA that accepts strings over \Sigma = \{a,b\} which start with aba.20247m

    Module 1: Introduction & Regular Languages

    Construct DFA that accepts strings over Σ={a,b}\Sigma = \{a,b\} which start with abaaba.

    View this question on its own page →
  39. 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 →
  40. Q4a. Design Mealy and Moore machines to detect the sequence 1010 (overlapping allowed). Then convert the Moore machine into a Mealy machine and prove equivalence.20227m

    Module 1: Introduction & Regular Languages

    Design Mealy and Moore machines to detect the sequence 1010 (overlapping allowed). Then convert the Moore machine into a Mealy machine and prove equivalence.

    View this question on its own page →
  41. Q4a. Prove that L = \{ a^i b^i \mid i \ge 0 \} is not regular using the pumping lemma.20247m

    Module 1: Introduction & Regular Languages

    Prove that L={aibi∣i≥0}L = \{ a^i b^i \mid i \ge 0 \} is not regular using the pumping lemma.

    View this question on its own page →
  42. 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 →
  43. Q4b. Convert the following NFA to DFA. ![NFA](https://res.cloudinary.com/djkpavwmp/image/upload/v1764448480/portfolio_assets/iu08cu9n2cx5gpr1qvv5.png)20247m

    Module 1: Introduction & Regular Languages

    Convert the following NFA to DFA.

    NFA

    View this question on its own page →
  44. 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
  45. Q4b. Design a DFA for the regular expression: 1^*(10)^*20217m

    Module 1: Introduction & Regular Languages

    Design a DFA for the regular expression:

    1∗(10)∗ 1^*(10)^*

    View this question on its own page →
  46. 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 →
  47. Q4b. Obtain the regular expression for the given DFA. ![image](https://res.cloudinary.com/djkpavwmp/image/upload/v1766231140/portfolio_assets/fbcklkz4il80phefuvuo.png)20237m

    Module 1: Introduction & Regular Languages

    Obtain the regular expression for the given DFA.

    image

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

    Prove that if L1L_1 and L2L_2 are regular, then L1∪L2L_1 \cup L_2 is regular.

    View this question on its own page →
  49. Q5a. Give examples of L_1 and L_2 such that: (i) L_1 is regular, L_2 is not regular, and L_1 - L_2 is regular. (ii) L_1 and L_2 are not regular but L_1 \cup L_2 is regular.20227m

    Module 1: Introduction & Regular Languages

    Give examples of L1L_1 and L2L_2 such that:

    (i) L1L_1 is regular, L2L_2 is not regular, and L1−L2L_1 - L_2 is regular.
    (ii) L1L_1 and L2L_2 are not regular but L1∪L2L_1 \cup L_2 is regular.

    View this question on its own page →
  50. 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 →
  51. Q5b. Show that the language of palindromes over \{a, b\} is not regular.20227m

    Module 1: Introduction & Regular Languages

    Show that the language of palindromes over {a,b}\{a, b\} is not regular.

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

    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}
    View this question on its own page →
  53. Q6a. Show that the language: L = \{ a^{n!} : n \ge 0 \} is not regular or not context-free.20217m

    Module 1: Introduction & Regular Languages

    Show that the language:

    L={an!:n≥0} L = \{ a^{n!} : n \ge 0 \}

    is not regular or not context-free.

    View this question on its own page →
  54. Q6b. Construct NFA for the regular expression: (0+1)^*00(0+1)^*20237m

    Module 1: Introduction & Regular Languages

    Construct NFA for the regular expression:

    (0+1)∗00(0+1)∗ (0+1)^*00(0+1)^*

    View this question on its own page →