CARVIEW |
Python RegEx MCQ
Question 1
What method is used to find all occurrences of a pattern in a string using RegEx?
findall()
finditer()
searchall()
matchall()
Question 2
What does the "re.split()" method do in Python RegEx?
Matches a pattern anywhere in the string
Splits a string based on a pattern
Returns the first occurrence of a pattern
Performs a case-sensitive search
Question 3
Which method is used to check if a pattern is present at the beginning of a string using RegEx?
matchstart()
startswith()
findstart()
match()
Question 4
What does the "re.DEBUG" flag do in Python RegEx?
Enables debug mode
Disables debug mode
Prints debugging information
Compiles patterns faster
Question 5
What does the "re.fullmatch()" method do in Python RegEx?
Matches a pattern anywhere in the string
Matches the entire string against a pattern
Returns the first occurrence of a pattern
Performs a case-sensitive search
Question 6
Which method is used to split a string using a RegEx pattern in Python?
split()
divide()
break()
slice()
Question 7
In RegEx, what does the "(?<=...)" construct represent?
Positive lookahead
Positive lookbehind
Negative lookahead
Negative lookbehind
Question 8
Which function is used to check if a string starts with a specified pattern using RegEx?
startswith()
beginswith()
matchstart()
patternstart()
Question 9
In RegEx, what does the "\s" pattern represent?
Space character
Any character
Special character
Non-space character
Question 10
How can you capture a group of characters in RegEx for later use?
(group)
{group}
[group]
<group>
There are 25 questions to complete.