Question 1 of 25
Hints left: 3
Q1
The expression a{5} will match . . . . . . . . characters with the previous regular expression.
Q2
What is the output of the following code: import re result = re.search(r'd{2}', 'There are 25 apples and 3 oranges.') print(result.group())
Q3
What will be the output of the following Python code? re.escape('new**world')
Q4
What will be the output of the following code: import re pattern = re.compile(r'd+') result = pattern.search('There are 5 apples and 3 oranges.') print(result.group())
Q5
What is the purpose of the re.VERBOSE flag in Python?
Q6
. . . . . . . . matches the start of the string. . . . . . . . . matches the end of the string.
Q7
What is the output of the following code: import re result = re.search(r'hello', 'Hello, world!', re.IGNORECASE) print(result.group())
Q8
What will be the output of the following Python code? sentence = 'horses are fast' regex = re.compile('(?P<animal>\w+) (?P<verb>\w+) (?P<adjective>\w+)') matched = re.search(regex, sentence) print(matched.groupdict())
Q9
What will be the output of the following Python code? m = re.search('a', 'The blue umbrella') m.re.pattern
Q10
How can you match the beginning of a string using regular expressions?
Q11
The function re.error raises an exception if a particular string contains no match for the given pattern.
Q12
What will be the output of the following Python code? re.split(r'\s+', 'Chrome is better than explorer', maxspilt=3)
-
A
-
B
-
C
-
D
Q13
What will be the output of the following Python code? import re re.ASCII
Q14
What will be the output of the following Python code? re.match('sp(.*)am', 'spam')
Q15
What will be the output of the following Python code? re.compile('hello', re.X)
Q16
What will be the output of the following Python code? re.split('\W+', 'Hello, hello, hello.')
-
A
-
B
-
C
-
D
Q17
Which of the following functions clears the regular expression cache?
Q18
Which of the following will result in an error?
Q19
How can you extract a group from a matched regular expression in Python?
Q20
The function of re.search is . . . . . . . .
Q21
Which of the following functions results in case insensitive matching?
Q22
Which of the codes shown below results in a match?
Q23
What is the purpose of the re.DOTALL flag in Python?
Q24
What is the purpose of the re.findall() function in Python?
Q25
What will be the output of the following Python code? re.subn('A', 'X', 'AAAAAA', count=4)