WorksheetsAMSI Python Quiz
Total questions: 21
Worksheet time: 11mins
What does the print command do?
Outputs a hard copy of a program to a printer
Outputs a message on screen
Print a hard copy of a flow chart to a printer
Prints out the the commands line by line on the screen
How do we get user input from the keyboard?
input = (What is your name?)
input = What is your name?
output = ("What is your name?")
name=input("What is your name? ")
Which data type would you use for the quantity of stock in a shop?
integer
float
string
boolean
What will be the output?
name = "Dave"
print (name)
Dave
'Dave'
name
(name)
Which of the following input commands would allow the user to receive and store a string from the keyboard?
string = input("Please enter a string:")
string = int(input("Please enter a string:"))
string = float(input("Please enter a string:"))
string = bool(input("Please enter a string:"))
What is type casting?
It allows a piece of data to have it's data type changed, e.g. an integer could be changed to a string.
It allows the program to display the value of a variable on the screen.
It allows the program to collect data from the keyboard.
It allows the programmer to display the value of a variable while the program is running.
What, if anything, is wrong with the following?
input=x("Type your password: ")
print(x)
The variable should be switched with the input command
Input commands don't need ( )
You can't print x
Nothing is wrong
What does int() represent?
internet
integer
intel
input
Why would I get a syntax error?
Line 1 doesn't make sense
Line 2 needs to be indented
No need for quotation marks on line 2
No such thing as an if statement
What would be printed to the screen for print(z)?
Orange
Banana
Cherry
Hello World!
Num = 90
Num = 20
print(Num)
90
4.5
20
1800
What is a definition of SELECTION?
A variable expression
A precise set of step-by-step instructions written in a programming language
When the program checks the conditions and chooses the path based on the outcome
This operator means that one value is equal to the other value
Which condition represents 'X is greater than Y'
X == Y
X > Y
X < Y
What will this code print?
access denied
access granted
error
password
If the user enters 60, what is the output?
You are old!
You are middle-aged!
You are young!
Error message
What will the code do?
nothing
display Hello Bob
display I don't know you
display Hello
What is the output?
next
stop
next
stop
syntax error - program doesn't work
What is my result?
"Mickey is a mouse"
"Minnie rules"
Nothing prints.
"Mickey is a mouse" & "Minnie rules"
What is my result?
John is getting ice cream
John is getting grapes
John is getting apple juice
John is getting grapes
John is getting apple juice
John is getting ice cream
