WorksheetsPractice for 2nd Python Quiz Comp Prog B
Total questions: 12
Worksheet time: 10mins
What is 11//4?
2.75
2
3
11
What is 11%4?
2.75
2
3
11
This program is intended to display a random answer from the list answers. Which would be the best replacement for < missing code >?
randint(1,2)
randint(0,2)
randint(0,1)
randint(2,2)
What is printed by the following program?
first
second
third
nothing
A student programmer is writing a program to calculate the number of taxis that a group of p people would need. Taxis can carry up to a maximum of 5 people. Which would be the best replacement for < condition >?
p%5 > 0
p%5 == 0
p//5 > 0
p//5 == 0
The following program is to print each element of the list nums. Which would be the best replacement for < missing code >?
for n in nums
for nums in n
while n < nums
while nums < n
Which of the following is NOT a possible output of this program?
0
1
2
3
What is the output of this program?
5
6
15
21
How many variables are in this program?
0
1
2
3
What is the output of this program?
1 2 3
1 1 3
2 2 3
2 1 3
What is 1 % 9999999?
0
1
9999999
undefined
Which of the following would be a correct function definition for the isSum10 function which given two integer values return True if their sum is 10 and False otherwise?
A only
B only
C only
A B & C
