My Report

Python Regular Expression Test – 2


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. The character Dot (that is, ‘.’) in the default mode, matches any character other than _____________

2. Which of the following functions clears the regular expression cache?

3. ________ matches the start of the string.
________ matches the end of the string.

4. Which of the following will result in an error?

5. What will be the output of the following Python code?

re.split('\W+', 'Hello, hello, hello.')

6. The expression a{5} will match _____________ characters with the previous regular expression.

7. What will be the output of the following Python code?

import re
re.ASCII

8. What will be the output of the following Python function?

re.findall("hello world", "hello", 1)

9. Choose the function whose output can be: <_sre.SRE_Match object; span=(4, 8), match='aaaa'>.

10. Which of the following functions results in case insensitive matching?


 

Start practicing “1000 MCQs on Python”, and once you are ready, you can take tests on all topics by attempting our “Python Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.