Regular Expressions 1-29 Flashcards

1
Q

What does λ mean?

A

Empty String

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does + mean?

A

Or

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does * mean?

A

any number of ( including zero )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

r = (λ + a)

A

Either a single a or nothing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

r = a*

A

Any number of a’s including no a’s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

r = (a + b)* (a + bb)

A

Any string of a’s and b’s ending in either a ‘a’ or ‘bb’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

r = (aa)* (bb)* b

A

Any zero or even number of a’s followed by an odd number of b’s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Create a regular expression for:
L(r) = {w ∈ {0, 1}* : w has no consecutive zeros}

A

r = (1 + 01)* (0 + λ)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A language that accepts any odd number of b’s

A

(bb)*b

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

An odd number of a’s followed by a single b

A

(aa)*ab

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A string of 0’s and 1’s that contains at least one 0 and one 1

A

(0+1)(01+10)(0+1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

A string of 0’s and 1’s with no consecutive 0’s or 1’s

A

(0+λ)(10)(1+λ) she said this technically works even though it’s odd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

(bb)(aa)

A

An even number of b’s followed by an even number of a’s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

01*0

A

0 followed by any number of 1’s followed by another 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

ab(ab)

A

a followed by any number of b’s followed by any number of ab’s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly