15 questions
What command will display the text 'Hello world!' on the screen?
print(Hello world!)
print "Hello world!"
print("Hello world!")
print = "Hello world!"
What command will ask the user his/her age correctly?
age = input("How old are you?")
age = input(How old are you?)
input("How old are you?") = age
how_old_are_you = input()
What function will convert a number to a string?
int()
str()
chr()
ord()
What is the result of this command: print ("5" + "3")
8
"8"
"5" + "3"
53
Which function will convert a string containing only digits to a number?
int()
srt()
chr()
ord()
Which conditional statement will be executed if the variable x is less than 20?
if x > 20:
if x <> 20:
if x == 20:
if x < 20:
Which of these tests checks if the variable x is the same as 'Hello'?
x = "Hello"
x != "Hello"
x == "Hello"
x <> "Hello"
What is the effect of the # character?
It tells Python that this is a very important line of code.
It tells Python to ignore the rest of the line.
It tells Python to tweet when this line of code is executed.
It does nothing. Python ignores this character
What is a variable (in Python)
A data "storage" that you can change
A data "storage" that you cannot change
A coding technique
A special file
What does the "input()" function do?
Allows users to change the program
Converts data types
Allows users to solve a task
Allows users to enter data
What data type is 3.95?
Integer
Float
String
Boolean
What output should this code give if the user enters the value 70?
Pass
Fail
Distinction
Merit
What is the output of this program?
22
50
38
Nothing, it will not be executed due to errors in the code.
myName = input()
Is myName a string, a function, a variable, or a method?
string
function
variable
method
How will we fix this code?
Remove the ' ' around Bob
Remove the '=' character
Remove the ( ) around Name
Make 'Name' lowercase