Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Y13 Regular expressions

Total questions: 14

Worksheet time: 7mins

Name
Class
Date
1.

Select the 2 strings that are matched by the regular expression:

a(bc)*d

a)

abcbcbcbcd

b)

acd

c)

ad

d)

acccd

2.

Select the 2 strings that are matched by the regular expression:

a(b|c)?d

a)

abcbcbcbcd

b)

acd

c)

ad

d)

acccd

3.

Select the string that is NOT matched by the regular expression:

ab?c*d

a)

abcbcbcbcd

b)

acd

c)

ad

d)

acccd

4.

Which regular expression matches the FSM?

a)

a?bc(dc)*

b)

a|b(cd)+

c)

a+bc(dc)?

d)

a(b|c)d*c*

5.

Regular expression are used to...

a)

match patterns in text

b)

draw FSMs

c)

define programming language

d)

correct spellings

6.

Select the strings that match the regular expression

(D|d)is(c|k)

a)

disc

b)

disK

c)

is

d)

DisK

7.

Which regular expression matches the FSM?

a)

ab|cb+

b)

(a|b)+cb*

c)

(a|cb+)+

d)

a?c|b*

8.

Select the 2 strings that match the regular expression

(M|m)o+

a)

Mooo

b)

m

c)

Mmmmm

d)

mo

9.

Symbol used to represent zero or one of the preceding tokens

a)

?

b)

*

c)

^

d)

+

10.

Which symbol Separates alternatives (or, ⋁)

a)

|

b)

*

c)

+

d)

?

e)

()

11.

Which symbol Indicates that there are zero or more of the preceding element i.e. zero or more repetitions

a)

|

b)

*

c)

+

d)

?

e)

()

12.

Which symbol Indicates that there is one or more of the preceding element i.e. one or more repetitions

a)

|

b)

*

c)

+

d)

?

e)

()

13.

Which symbol Indicates that there are zero or one of the preceding element i.e. optional character

a)

|

b)

*

c)

+

d)

?

e)

()

14.

Which symbol is used to identify/capture groupings

a)

|

b)

*

c)

+

d)

?

e)

()