Regular Expressions
1.

Python has a built-in package called?

A.  

reg

B.  

regex

C.  

re

D.  

regx

2.

Which function returns a list containing all matches?

A.  

findall

B.  

search

C.  

split

D.  

find

3.

Which character stand for Starts with in regex?

A.  

&

B.  

^

C.  

$

D.  

#

4.

Which character stand for Zero or more occurrences in regex?

A.  

*

B.  

#

C.  

@

D.  

|

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

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

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

8.

Which of the following functions clears the regular expression cache?

A.  

re.sub()

B.  

re.pos()

C.  

re.purge()

D.  

re.subn()

9.

Which module in Python supports regular expressions?

A.  

re

B.  

regex

C.  

pyregex

D.  

none of the mentioned

10.

Which of the following creates a pattern object?

A.  

re.create(str)

B.  

re.regex(str)

C.  

re.compile(str)

D.  

re.assemble(str)