The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+12 votes
837 views

Which one of the following languages over the alphabet $\{0,1\}$ is described by the regular expression: $(0+1)^*0(0+1)^*0(0+1)^*$?

  1. The set of all strings containing the substring $\text{00}$
  2. The set of all strings containing at most two $\text{0}$'s
  3. The set of all strings containing at least two $\text{0}$'s
  4. The set of all strings that begin and end with either $\text{0}$ or $\text{1}$
asked in Theory of Computation by Veteran (69k points)
edited by | 837 views

3 Answers

+19 votes
Best answer
(C) is the answer.

Counter example for other choices:

(A) 1010 is accepted which doesn't contain 00
(B) 000 is accepted
(D) 01 is not accepted
answered by Veteran (346k points)
selected by
+6 votes

a) all string contain substring 00

regular expression = Anything 00 Anything  = (0+1)*00(0+1)*  

b)all string contain atmost two 0's

regular expression = only 2 zeros  + only 1 zero  + No zero = Anthing 0 Anything 0 Anything + Anything 0 Anything  + Anything = 1*01*01* + 1*01* + 1* 

here anything means that is made of only 1's bcoz we have to restrict 0 (only two or less) so anything cannot include 0.

c) all string contain atleast two 0's

regular expression = Anything 0 Anything 0 Anything = (0+1)*0(0+1)*0(0+1)*

d) all strings that begin and end with either 0 or 1

regular expression = either 0 or 1  Anything either 0 or 1 = (0+1)(0+1)*(0+1)

answered by Veteran (55.2k points)
All are same for strings containing atleast 2 0's.
+1 vote
The regular expression has two 0′s surrounded by (0+1)* which means accepted strings must have at least 2 0′s.

So, C is the answer
answered by Boss (8.3k points)


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

33,593 questions
40,128 answers
114,021 comments
38,389 users