GATE Computer ScienceHardGATE CSE · ISRO
Which of the following languages over {0, 1} is regular?
- A. { w : the number of 0s equals the number of 1s }
- B. { w : the number of occurrences of the substring 01 equals the number of occurrences of 10 }
- C. { 0^n 1^m 0^n : n, m ≥ 0 }
- D. { 0^p : p is a prime number }
Correct answer: B. { w : the number of occurrences of the substring 01 equals the number of occurrences of 10 }
Occurrences of 01 and 10 alternate, so their counts are equal exactly when w is empty or starts and ends with the same symbol, which is regular. The others fail the pumping lemma.
More Theory of Computation questions
- A single-tape TM (blank B) starts in q0 at the leftmost symbol of a binary string. Rules: δ(q0,0) = (q0,0,R); δ(q0,1) = (q0,1,R); δ(q0,B)…
- How many strings of length 10 over {a, b} have no three consecutive equal symbols (neither aaa nor bbb)?
- Over {a, b}, L = { w : w contains aab as a substring and |w| is odd }. What is the number of states in the minimal complete DFA for L?
- Decimal numerals are read most significant digit first (empty string = 0, leading zeros allowed). What is the number of states in the…
- Let L = { w ∈ {a, b} : the third symbol from the right end of w is a }; its minimal complete DFA has 8 states. How many states does the…
- Let L = { a^i b^j c^k : i ≠ j or j ≠ k, i, j, k ≥ 0 }. Which statement is correct?