Which command will display the text 'Hello world!' on the screen?
A) print(Hello world!)
B) print("Hello world!")
C) print "Hello world!"
D) print = "Hello world!"
The Correct Answer is :
B) print("Hello world!")
Which one of these is a string?
A) this_is_a_string
B) “No this is a string”
C) int(“1234”)
D) str(this is actually a string)
The correct answer is:
B) “No this is a string”
Which command will correctly ask the user for their age?
A) age = input(How old are you?)
B) input("How old are you?") = age
C) How old are you = input()
D) age = input("How old are you?")
The correct answer is:
D) age = input("How old are you?")
What is a variable?
A) A name that holds a bit of data that can be changed.
B) A name that holds a bit of data that can’t be changed.
C) A piece of code that tells Python to do something.
D) A name that holds a bit of text.
A) A name that holds a bit of data that can be changed.
myName = input() - Is myName a string, a function, a variable, or a method
A) String
B) Variable
C) Function
D) Method
The correct answer is:
B) Variable
What does input do?
A) It allows users to change the program
B) It allows a user to solve a task
C) It converts data types
D) It allows users to enter data
The correct answer is :
D) It allows users to enter data
What is the result of this command? print ("5" + "3")
A) 8
B) "8"
C) "5" + "3"
D) 53
The correct answer is :
D) 53
What is a bug (in coding)?
A) a creepy crawly
B) an error
C) when you do something inefficiently
D) when you make something that works
B) an error
Which function will convert a number to a string?
A) int()
B) chr()
C) str()
D) ord()
The correct answer is :
C) str()
what data type is 3.95?
A) Integer
B) Float
C) String
D) Character
The correct answer is:
B) Float
Which decision statement will be triggered if the variable x is less than 20?
A) if x > 20:
B) if x == 20:
C) if x <> 20:
D) if x < 20:
The correct answer is:
D) if x < 20:
What is a function?
A) A named “empty box” that stores a value.
B) Something that prints a value to be displayed to the user.
C) A named, self-contained block of reusable code designed to perform a specific task.
D) Something that takes an input from the user and stores it in a variable.
C) A named, self-contained block of reusable code designed to perform a specific task.
Which function will convert a string containing only digits into a number?
A) int()
B) ord()
C) chr()
D) str()
The correct answer is:
A) int()
What would the output of this code be if the user entered the value 70?
if grade >= 80:
print("Distinction")
elif grade >=70:
print("Merit")
elif grade >= 60:
print("Pass")
The correct answer is:
Merit
How would we fix this code?
name= "Bob"
print(Name)
The correct answer is:
Make 'Name' lower case
Which of the following is the name for the act of change the type of a piece of data?
A) Conversion
B) Data Changing
C) Type Switching
D) Type Casting
D) Type Casting
What effect does the \n character have?
A) Tells Python that this is a really important line of code.
B) Tells Python to tweet when this line of code gets run.
C) Tells Python to skip a line.
D) It does nothing, Python ignores this character.
The correct answer is:
C) Tells Python to skip a line.
Which of these codes tests whether the variable x is the same as 'Hello'?
A) x = "Hello"
B) x == "Hello"
C) x != "Hello"
D) x <> "Hello"
The correct answer is:
B) x == "Hello"
What would the output of this program be?
number1=7
number2=2
number3=5
number1=3print(number1+number2*number3)
The correct answer is:
11What is the thing you give to a function called?
A) The input.
B) The argument.
C) The parameter.
D) The definition.
B) The argument.