Python Programming Multiple Choice Question -
Regular Expressions

This section focuses on the "Regular Expressions" in Python programming. These Multiple Choice Questions (mcq) should be practiced to improve the Python programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

1. Python has a built-in package called?

A. reg
B. regex
C. re
D. regx

View Answer


2. Which function returns a list containing all matches?

A. findall
B. search
C. split
D. find

View Answer


3. Which character stand for Starts with in regex?

A. &
B. ^
C. $
D. #

View Answer


4. Which character stand for Zero or more occurrences in regex?

A. *
B. #
C. @
D. |

View Answer


5. In Regex, s stands for?

A. Returns a match where the string DOES NOT contain digits
B. Returns a match where the string DOES NOT contain a white space character
C. Returns a match where the string contains a white space character
D. Returns a match if the specified characters are at the end of the string

View Answer


6. In Regex, [a-n] stands for?

A. Returns a match for any digit between 0 and 9
B. Returns a match for any lower case character, alphabetically between a and n
C. Returns a match for any two-digit numbers from 00 and 59
D. Returns a match for any character EXCEPT a, r, and n

View Answer


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

A. 5 or less
B. exactly 5
C. 5 or more
D. exactly 4

View Answer


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

A. re.sub()
B. re.pos()
C. re.purge()
D. re.subn()

View Answer




Discussion



* You must be logged in to add comment.