Question 1 of 25
Hints left: 3
Q1
What does the findall() function in the re module do?
Q2
What does the function re.search do?
Q3
What is the purpose of the re.compile() function in Python?
Q4
What is a regular expression in Python?
Q5
What will be the output of the following code: import random print(random.choice([1, 2, 3, 4]))
Q6
How can you search for a specific pattern in a string using regular expressions in Python?
Q7
The sleep function (under the time module) is used to . . . . . . . .
Q8
Which of the following will throw an error if used after the following Python code? tday=datetime.date.today() bday=datetime.date(2017,9,18) t_day=bday-tday
Q9
What does the function re.match do?
Q10
What is the value of x if x = math.sqrt(4)?
Q11
What will be the output of the following Python code, if the code is run on Windows operating system? import sys if sys.platform[:2]== 'wi': print("Hello")
Q12
What does the match() function in the re module do?
Q13
What does os.close(f) do?
Q14
Which type of elements are accepted by random.shuffle()?
Q15
What will be the output of the following Python code? from math import factorial print(math.factorial(5))
Q16
What is math.floor(0o10)?
Q17
What is the output of the following code: import re result = re.findall(r'bw+b', 'Hello, world!') print(result)
Q18
What is the output of the following code: import re result = re.sub(r'd+', 'number', 'There are 5 apples and 3 oranges.') print(result)
Q19
How can you use regular expressions in Python?
Q20
What will be the output of the following Python function, assuming that the random library has already been included? random.shuffle[1,2,24]
Q21
State whether true or false. s = time.time() t= time.time() s == t
Q22
What is the purpose of the re.IGNORECASE flag in Python?
Q23
Which of the following creates a pattern object?
Q24
Which module in Python supports regular expressions?
Q25
Which of the following functions can be used to find the coordinated universal time, assuming that the datetime module has already been imported?