GATE Computer ScienceVery hardGATE CS
Which of the following languages are deterministic context-free? I. { aⁱbʲcᵏ : i = j or j = k } II. { aⁱbʲcᵏ : i = j, k ≥ 0 } III. { w c wᴿ : w ∈ {a, b}* } IV. { w wᴿ : w ∈ {a, b}* }
- A. II, III and IV only
- B. I and III only
- C. II and III only
- D. I, II and III only
Correct answer: C. II and III only
II is checked with a single stack count and ignores c's afterwards; III has the marker c that tells a DPDA when to start popping. I needs the machine to guess whether to match a's with b's or b's with c's (non-deterministic, in fact inherently ambiguous), and IV has no centre marker, so a DPDA cannot know the midpoint.
More Theory of Computation questions
- Let L = { aⁿ : n ≥ 5 and (n is divisible by 4 or n is divisible by 6) }. How many states does the minimal complete DFA for L have?
- Which one of the following languages over the one-letter alphabet {a} is NOT context-free?
- 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?