GATE Computer ScienceHardGATE CS
Which one of the following languages over the one-letter alphabet {a} is NOT context-free?
- A. { aⁿ : n is a perfect square }
- B. { aⁿ : n ≥ 8 and n ≡ 3 (mod 5) }
- C. { aⁿ : n ≡ 2 (mod 3) and (n ≤ 100 or n is even) }
- D. { aⁿ : n is divisible by 7 or by 11 }
Correct answer: A. { aⁿ : n is a perfect square }
By Parikh's theorem every context-free language over a one-letter alphabet is regular, so its length set is eventually periodic. The three other length sets are eventually periodic, while the gaps between successive squares keep growing.
More Theory of Computation questions
- How many strings of length 12 over {a, b} contain exactly three occurrences of aa as a substring (overlapping occurrences counted…
- L₁ is accepted by a minimal complete DFA with 4 states and L₂ by a minimal complete DFA with 3 states. What is the largest number of…
- The minimal complete DFA of a language L has 5 states. What is the largest number of states that the minimal complete DFA of the Kleene…
- Let L = { w ∈ {a, b} : every prefix u of w satisfies |na(u) − nb(u)| ≤ 2 }. How many states does the minimal complete DFA for L have?
- Let r = (aab + ab + b)(ba + a). The number of strings of length 7 over {a, b} that are NOT in L(r) is
- Consider the languages: I. HALT = { ⟨M, w⟩ : M halts on w }; II. EQTM = { ⟨M₁, M₂⟩ : L(M₁) = L(M₂) }; III. TOTAL = { ⟨M⟩ : M halts on…