Question discussion

Which of the following languages over the alphabet {0, 1} is regular?

2590Medium DSSSB TGT Computer Science 0 replies

Which of the following languages over the alphabet {0, 1} is regular?

  • A{0ⁿ1ⁿ | n ≥ 0}
  • B{ww | w is any string over {0, 1}}
  • CThe set of all strings that contain an even number of 0s
  • D{0ⁿ | n is a prime number}
Correct answer: C

Explanation

A two-state DFA that changes state on every 0 accepts the language in option C, while the other three languages need unbounded counting or comparison and can be shown to be non-regular by the pumping lemma.

Discussion 0

Nobody has replied yet. Start the discussion!