This quiz will test your understanding about Regular Expressions in Python. Please answer the following 10 questions.
Quiz Summary
0 of 10 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 10 Questions answered correctly
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- Current
- Review
- Answered
- Correct
- Incorrect
-
Question 1 of 10
1. Question
What will the following code print?
import re
hand = open(‘mbox-short.txt’)
for line in hand:
line = line.rstrip()
if re.search(‘^From:’, line):
print(line)CorrectIncorrect -
Question 2 of 10
2. Question
Which of the following options is the correct way to import the regex library?
CorrectIncorrect -
Question 3 of 10
3. Question
Consider this code: re.search(‘\$.+’, line)
Which of the following line will return a matchCorrectIncorrect -
Question 4 of 10
4. Question
The following code will match all the emails up to the last @ sign)?
True or false?
import re
string = ‘From: steve_doe@outlook.com, alex.drake@hotmail.fr, olivia.Montana123@gmail.com’
print(re.findall(‘From:.+?@’, string))CorrectIncorrect -
Question 5 of 10
5. Question
Which of these option(s) will match digits in a string?
CorrectIncorrect -
Question 6 of 10
6. Question
What does the re module in Python stand for?
CorrectIncorrect -
Question 7 of 10
7. Question
Which function is used to search for a pattern in a string using regular expressions?
CorrectIncorrect -
Question 8 of 10
8. Question
In a regular expression, what does the metacharacter . represent?
CorrectIncorrect -
Question 9 of 10
9. Question
Which quantifier specifies that a pattern should occur 0 or more times?
CorrectIncorrect -
Question 10 of 10
10. Question
What will the regex \\d{2,4} match in a string?
CorrectIncorrect