GATE Computer ScienceHardGATE CS (PYQ pattern)
For the regular language L(r) with r = aaa* + bbbb* (that is, a's of length ≥ 2 or b's of length ≥ 3), the pumping lemma asks for a length p 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 such p?
- A. 4
- B. 3
- C. 2
- D. 5
Correct answer: A. 4
p = 3 fails: w = bbb has |w| ≥ 3 but every choice of y removes a b when pumped down, leaving bb or b ∉ L. p = 4 works: an a-string of length ≥ 4 pumps with x = a, y = a (pumping down still leaves ≥ 3 a's), and a b-string of length ≥ 4 pumps with x = ε, y = b (pumping down leaves ≥ 3 b's). Hence 4.
More Theory of Computation questions
- Consider these claims about regular expressions over {a, b} (each equation compares the two languages): I. (a + b) = (ab) II. (ab)a =…
- Consider these claims about regular expressions over {a, b} (each equation compares the two languages): I. (ab) = ε + (a + b)b II. (aa +…
- Consider these claims about regular expressions over {a, b} (each equation compares the two languages): I. (a + b) = (a + b) II. (a +…
- Consider these claims about regular expressions over {a, b} (each equation compares the two languages): I. (ba)b = b(ab) II. (a + b)ab =…
- Consider these claims about regular expressions over {a, b} (each equation compares the two languages): I. (a + b)b = (ab)⁺ II. (ab)(a +…
- Which one of the following context-free grammars (start symbol S, terminals a, b) is unambiguous?