NEW
Font size
WorksheetsPython Quiz
Total questions: 12
Worksheet time: 6mins
Which keyword allows us to load a module in Python?
Import
Load
Include
Library
What will be the output of the following code snippet?
print(2**3 + (5 + 6)**(1 + 1))
8
121
129
127
How is a code block indicated in Python?
Brackets
Indentation
Key pair
colon
What will be the output of the following code snippet?
Infinite Loop
0 3 6 9 12
0 3 6 9 12 15
0 2 3 ... 15
Which of the following types of loops are not supported in Python?
do while
while
for
None
a = [1, 2]
print(a * 3)
Error
[1,2]
[1,2,1,2]
[1,2,1,2,1,2]
All keywords in Python are in _________
Capitalized
lowercase
UPPERCASE
NONE MENTIONED
What will be the value of the following Python expression?
4 + 3 % 5
4
2
1
7
What will be the output of the following Python code?
import datetime
print(datetime.date(2016,7,24))
Error
2016-07-24
2017-7-24
24-7-2016
Which module in Python supports regular expressions?
regex
re
pyregrex
ree
What does the function re.match do?
matches a pattern at the start of the string
matches a pattern at any position in the string
such a function does not exist
none mentioned
Which of the following can be used to open a file called myText.txt in read-only mode?
infile = open("myText.txt", “w”)
infile = open("myText.txt", r)
infile = open("myText.txt", “read”)
infile = open("myText.txt")
