GATE Computer ScienceVery hardGATE CSE · UGC NET
Which one of the following languages over {0, 1} is regular?
- A. { w : the number of occurrences of the substring 01 equals the number of occurrences of the substring 10 }
- B. { w : the number of 0s equals the number of 1s }
- C. { 0ⁿ1ⁿ : n ≥ 0 }
- D. { 0ᵖ : p is a prime number }
Correct answer: A. { w : the number of occurrences of the substring 01 equals the number of occurrences of the substring 10 }
Between consecutive blocks the substrings 01 and 10 alternate, so their counts are equal exactly when w is empty or its first and last symbols are equal — a regular condition (checked exhaustively up to length 14). The other three need unbounded counting and are not regular.
More Theory of Computation questions
- Let L = { w ∈ {a, b} : (na(w) − 2·nb(w)) mod 6 ∈ {0, 3} }, where na and nb count the a's and b's. How many states does the minimal…
- Let L = { w ∈ {a, b} : (2·na(w) + 4·nb(w)) mod 6 = 2 }. How many strings of length exactly 7 belong to L?
- A DFA reads ternary numerals over {0, 1, 2}, most significant digit first (leading zeros allowed; ε has value 0 and is accepted), and…
- Binary strings are read LSB first (the leftmost symbol is the least significant bit; ε has value 0 and is accepted). How many states does…
- Binary strings are read LSB first (the leftmost symbol is the least significant bit; ε has value 0 and is accepted). The minimal DFA for…
- A DFA over {0, 1} reads a binary numeral MSB first (leading zeros allowed, ε has value 0) and accepts iff the value ≡ 3 (mod 8). How many…