Py4e part 10- Questions and Answers 100%
Solved
What is the 'wild card' character in a regular expression (i.e.. the character that matches any
character)?
A. +
B. .
C. *
D. $
E. ^
F. ? Correct Ans-B
What is the difference between the '+' and '*' character in regular expression?
A. The '+' matches at least one character and the '*' matches zero or more characters
B. The '+' matches upper case characters and the '*' matches lowercase characters
C. The '+' matches the beginning of a line and the '*' matches the end of a line
D. The '+' matches the actual plus character and the '*' matches any character
E. The '+' indicates 'start of extraction' and the '*' indicates the 'end of extraction' Correct Ans-
A
What does the '[0-9]+' match in a regular expression?
, A. Several digits followed by a plus sign
B. Any mathematical expression
C. One or more digits
D. Zero or more digits
E. Any number of digits at the beginning of a line Correct Ans-C
What does the following Python sequence print out?
x = 'From: Using the : character'
y = re.findall('^F.+:', x)
print(y)
A. ['From:']
B. ^F.+:
C. From:
D. ['From: Using the :']
E. : Correct Ans-D
What character do you add to the '+' or '*' to indicate that the match is to be done in a non-greedy
manner?
A. \g
Solved
What is the 'wild card' character in a regular expression (i.e.. the character that matches any
character)?
A. +
B. .
C. *
D. $
E. ^
F. ? Correct Ans-B
What is the difference between the '+' and '*' character in regular expression?
A. The '+' matches at least one character and the '*' matches zero or more characters
B. The '+' matches upper case characters and the '*' matches lowercase characters
C. The '+' matches the beginning of a line and the '*' matches the end of a line
D. The '+' matches the actual plus character and the '*' matches any character
E. The '+' indicates 'start of extraction' and the '*' indicates the 'end of extraction' Correct Ans-
A
What does the '[0-9]+' match in a regular expression?
, A. Several digits followed by a plus sign
B. Any mathematical expression
C. One or more digits
D. Zero or more digits
E. Any number of digits at the beginning of a line Correct Ans-C
What does the following Python sequence print out?
x = 'From: Using the : character'
y = re.findall('^F.+:', x)
print(y)
A. ['From:']
B. ^F.+:
C. From:
D. ['From: Using the :']
E. : Correct Ans-D
What character do you add to the '+' or '*' to indicate that the match is to be done in a non-greedy
manner?
A. \g