GATE Computer ScienceVery hardGATE CSE
The pumping lemma for regular languages states that some length p exists such that every w ∈ L with |w| ≥ p can be split w = xyz with |xy| ≤ p, |y| ≥ 1 and xyⁱz ∈ L for all i ≥ 0. What is the smallest valid p for L = { w ∈ {a, b}* : w contains aab as a substring }?
- A. 3
- B. 5
- C. 4
- D. 6
Correct answer: C. 4
A DFA for L has 4 states, so p = 4 works; p = 3 fails for the word aab itself (every non-empty y inside the first 3 symbols breaks the substring when removed or repeated). Hence 4.
More Theory of Computation questions
- For a context-free grammar G given as input, how many of the following problems are undecidable? (a) Is L(G) = Σ? (b) Is L(G) regular? (c)…
- A DFA reads a binary string most-significant bit first (leading zeros allowed) and tracks the value so far modulo 12, accepting exactly…
- Let L be the set of strings over {a, b} in which the third symbol from the right is a, or the last symbol is b (strings shorter than 3…
- An NFA over {a, b} has states 0–4, start state 0 and accepting state 4. Transitions: 0 –a→ {0,1}; 0 –b→ {0}; 1 –a,b→ {2}; 2 –a,b→ {3}; 3…
- A DFA over {a, b} has states 0–4, start 0 and accepting states {2, 4}. Transitions (on a, b): 0:(1,2), 1:(2,0), 2:(3,3), 3:(4,1), 4:(4,0)…
- Over {a, b}, L = { w : the number of a's in w is ≡ 1 (mod 4) and |w| ≡ 3 (mod 6) }. How many states does the minimal DFA of L have?