Regular Expression in Python

Regular Expression in Python

University

10 Qs

quiz-placeholder

Similar activities

Sostenido

Sostenido

5th Grade - University

10 Qs

Las notas musicales

Las notas musicales

8th Grade - University

10 Qs

CHAPTER 6 :MATERIAL PROCESSING (1)

CHAPTER 6 :MATERIAL PROCESSING (1)

University

15 Qs

Blender Basics

Blender Basics

6th Grade - University

10 Qs

Computational Thinking Quiz

Computational Thinking Quiz

6th Grade - University

10 Qs

Prosody Quiz

Prosody Quiz

University

10 Qs

B.COM III RETAIL MANAGEMENT

B.COM III RETAIL MANAGEMENT

University

15 Qs

Mental Toughness Check Point #4

Mental Toughness Check Point #4

University

5 Qs

Regular Expression in Python

Regular Expression in Python

Assessment

Quiz

Other

University

Hard

Created by

Shilpa Pande

Used 2+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which module in Python supports regular expressions?

re

regex

pyregex

none of the mentioned

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following creates a pattern object?

re.create(str)

re.regex(str)

re.compile(str)

re.assemble(str)

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the function re.match do?

matches a pattern at the start of the string

matches a pattern at any position in the string

such a function does not exist

none of the mentioned

4.

FILL IN THE BLANK QUESTION

30 sec • 1 pt

____________ character is used to represent zero or more occurrences of the preceding character in a regular expression

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code?

import re
pattern = r'\d+'
result = re.findall(pattern, 'The price is $25 and $50')
print(result)

['25', '50']

['$25', '$50']

['The', 'is', 'and']

[ ]

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the re.search() function in Python?

Searches for a pattern at the end of a string

Searches for a pattern anywhere in a string

Searches for a pattern at the beginning of a string

Searches for a pattern case-insensitively

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In a regular expression, what does [a-zA-Z] represent?

Matches any single character

Matches any lowercase letter

Matches any uppercase letter

Matches any letter

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?