wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

LECTURE 10 (09.12.2025)

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

True or False: In Python, the re module helps you use regular expressions.

a)

True

b)

False

2.

What does "RegEx" stand for?

a)

Regular Expressions

b)

Regular Example

c)

Register Exit

d)

Region Extra

3.

True or False: The "+" symbol in RegEx means "zero or more times".

a)

True

b)

False

4.

Which symbol in RegEx means "zero or more times"?

a)

+

b)

*

c)

?

d)

$

5.

True or False: The pattern \w matches any letter, number, or underscore.

a)

True

b)

False

6.

What is an API?

a)

A set of rules for programs to talk to each other

b)

A type of database

c)

A web browser

d)

A programming language

7.

Which Python web framework is simple and good for making APIs?

a)

Flask

b)

Django

c)

React

d)

Node

8.

True or False: Greedy matching in RegEx tries to match as much text as possible.

a)

True

b)

False

9.

Which pattern will match the smallest amount of text between two tags, like in "text"?

a)

.*

b)

.*?

c)

.+

d)

.?

10.

Which RegEx pattern matches exactly one digit?

a)

\d

b)

\d+

c)

\d*

d)

\w

11.

True or False: The "^" symbol in RegEx matches the start of a string.

a)

True

b)

False

12.

Which pattern matches one or more word characters (letters, numbers, or underscore)?

a)

\w*

b)

\w+

c)

\w?

d)

\d+

13.

If you want to match a real period (.) in text, which pattern should you use?

a)

.

b)

\.

c)

[.]

d)

\d

14.

Which of these is NOT a RegEx quantifier?

a)

*

b)

+

c)

?

d)

@

15.

Which function in Python's re module finds all matches in a string?

a)

re.match()

b)

re.findall()

c)

re.compile()

d)

re.replace()

16.

Write a Python RegEx pattern to match any three-letter word ending with "at" (like "cat", "bat", "rat"). Try your pattern in a Python compiler. Which pattern works?

a)

.at

b)

[a-z]at

c)

\wat

d)

[^ ]at

17.

Write a Python RegEx pattern to get all numbers from the string "abc123xyz456". Try it in a Python compiler. Which pattern works?

a)

[a-z]+

b)

\d+

c)

\w+

d)

[0-9a-z]+

18.

True or False: The "$" symbol in RegEx matches the end of a string.

a)

True

b)

False

19.

Write a RegEx pattern to match a string that starts with "API" and ends with a digit. Try it in a Python compiler. Which pattern works?

a)

^API\d$

b)

API\d

c)

^API.*\d$

d)

^API\d.*

20.

Make your own RegEx pattern to match any word that starts with "a" and ends with "z" (like "abz", "amazingz"). Try it in a Python compiler. Which pattern works?

a)

a.*z

b)

^a.*z$

c)

a.z

d)

^az$