WorksheetsInt to Comp Sci Python Quiz 1
Total questions: 23
Worksheet time: 12mins
What output would be returned when the following code is run?
print(6 x 3)
6 x 3
syntax error
18
concatenation error
What is the word (command) used to display numbers and text on the screen?
input
output
conversion
A syntax error means your code has a 'text-based' mistake or you used symbols/operations incorrectly
True
False
What will be the output?
name = "Dave"
print (name)
Dave
"Dave"
name
(name)
What will be the output?
name = "Dave"
greeting = "Good morning " + name
print (greeting)
"Good morning Dave"
Good morning Dave
Good morning name
Good morning "Dave"
print("Hello" + str(2) + "world!")
What does the following code do? myAge = int (myAge)
Converts the variable myAge to a string
Converts the variable myAge to a integer
Converts the variable myAge from a integer to a string
Converts the variable myAge to an operator
print(Hello world!)
What output would be returned when the following code is run?
name = "NicK"
print(name * 3)
syntax error
Nick*3
concatenation error
NickNickNick
If the desired output is:
Which number value meal would you like to order? (user enters 2)
I would like to order a number 2 meal
Does the print statement need to be changed to one of 3 answer choices or can it remain as it is displayed below?
num = input("Which number value meal would you like to order?) 2
print("I would like a number " + num + " meal")
print ("I would like a number + num")
print("I would like a number " + str(num) + " meal"))
print("I would like a number " + int(num) + " meal))
The print statement can remain the same
How would you output new_var = 123 as a text string?
print str(new_var)
print new_var(str)
print (str)new_var
print (new_var).str()
What output will the console show, if 15 and 30 are entered by the user?
Syntax error
The sum of the two numbers - 45
The concatenation of the two numbers - 1530
Complier error
What output will display if 15 then 20 is entered by the user?
"num1 + num2"
1520
35
What will the output be if the user enters 15 then 30?
15.0 30.0
15.0 + 30.0
1530
45.0
What is the output of this program?
number1 = 90
number2 = 10
print("Hello")
100
Hello
100 Hello
Hello 100
