NEW
Font size
WorksheetsPython 2
Total questions: 10
Worksheet time: 5mins
What output does this code produce?
5
5
5
5
5
5
0
1
2
3
4
5
0
1
2
3
4
What output does this code produce?
HelloGuyHelloGuyHelloGuy
HelloGuy
HelloHelloHelloGuyGuyGuy
HelloGuy
HelloGuy
HelloGuy
What output does this code produce?
High
Low
Perfect
500
What would you use to repeat a block of code an indeterminate number of times . This means you don't know how many times it will repeat.
for loop
while loop
repeat loop
if statement
Which is a syntactically correct function definition header?
print_again(s)
print(s)
def print_again(s):
print_again(string):
Which is a valid assignment statement?
"x" = 5 * 7
5 = print_times
print_times = 5
print = 5
What does this function do?
Prints the value of the greater of the two parameters
Prints the value of the sum of the two parameters
Returns the value of the greater of the two parameters
Compares two integers and chooses the smaller
For this function, what would be the output of this call?
print(greater_value(5, 100))
100
5
105
500
For this function, which code would generate a Python error?
_var_name = greater_value(7.5, 9)
greater_value("7", 9)
greater_value(7, 9)
x = greater_value(7, 9)
Which code would definitely generate an error?
x = input("Enter a number")
print(x + 7)
x = input("Enter a number")
print(x*2)
x = input("Enter a number")
print(x + "7")
x = int(input("Enter a number"))
print(x + 7)
