🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Regular Expressions: all 10 questions

Quiz: Regular Expressions · Question 4 of 10

Which regex describes strings with no two consecutive 1s (verified in the demo)?

Which regex describes strings with no two consecutive 1s (verified in the demo)?

  1. A.(0+1)11(0+1)
  2. B.(0 + 10)*(ε + 1)
  3. C.01
  4. D.(01)*
Answer & explanation

Correct answer: (0 + 10)*(ε + 1)

Every 1 (except possibly the last symbol) is followed by a 0.

Can you get the rest right without peeking?

Take the timed Quiz: Regular Expressions quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →