GATE Computer ScienceVery hardGATE CSE · UGC NET
Which regular expression (+ denotes union) denotes exactly the set of non-empty strings over {a, b} that start with a, end with a and contain no two consecutive b's?
- A. a(a + ba)*
- B. a(a + b)*a
- C. a(a + ba)*a
- D. (ab + a)*
Correct answer: A. a(a + ba)*
Every string in a(a+ba)* starts with a, each b is followed by a (so no bb, and it ends with a); a(a+ba)*a misses "a", a(a+b)*a allows bb, (ab+a)* allows ending in b. Verified by exhaustive comparison up to length 11.
More Theory of Computation questions
- How many strings of length 10 over {a, b} belong to the language of (a+b)(aab + bba)(a+b), that is, contain aab or bba as a substring?
- Let L = { w ∈ {a, b} : (|w|a + 2·|w|b) mod 12 ∈ {1, 5, 9} }, where |w|a and |w|b count the a's and b's. What is the number of equivalence…
- Consider these problems: (a) Given a DFA M, is L(M) empty? (b) Given two CFGs G₁, G₂, is L(G₁) ∩ L(G₂) = ∅? (c) Given a TM M and input w…
- How many of the following statements are true? (i) DCFLs are closed under complement. (ii) CFLs are closed under intersection with a…
- Among the six languages L₁ = {aⁱbʲcᵏdˡ : i = k and j = l}, L₂ = {aⁱbʲcᵏ : i = j or j = k}, L₃ = {wwᴿ : w ∈ {a,b}}, L₄ = complement of…
- A DFA reads a binary string least-significant bit first (so the first symbol read is the 2⁰ bit) and must accept exactly the strings whose…