GATE Computer ScienceHardGATE CS (PYQ pattern)
Which one of the following languages is regular?
- A. { w ∈ {0, 1}* : #0(w) = #1(w) }
- B. { w ∈ {0, 1}* : #01(w) = #10(w) }
- C. { 0ⁿ1ᵐ : n ≠ m }
- D. { w wᴿ : w ∈ {0, 1}* }
Correct answer: B. { w ∈ {0, 1}* : #01(w) = #10(w) }
Occurrences of 01 and 10 alternate, so their counts differ by at most 1 and they are equal exactly when the first and last symbols are equal: a 5-state DFA. The other three languages are non-regular by pumping.
More Theory of Computation questions
- To show that L = { aⁱbʲ : i > j } is not regular by the pumping lemma with pumping length p, which string and pumping choice give a valid…
- Consider these problems about a Turing machine M (given as input): I. Does M ever move its head to the left when started on the blank…
- Which of the following problems is decidable?
- Which of the following problems is undecidable?
- Let TOTAL = { ⟨M⟩ : the Turing machine M halts on every input }. Which statement about TOTAL is correct?
- Let A = { ⟨M⟩ : the TM M halts on at least one input } and B = { ⟨M⟩ : M halts on no input }. Which statement is correct?