Worksheetsstandard input output
Total questions: 41
Worksheet time: 21mins
What is the word (command) used to display numbers and text on the screen?
show
output
command
What can be used to store information and values so that it can be used later?
Graphic
Variable
Output
What will be the output?
name = 'Dave'
print (name)
name
Dave
error
What would print (10 + 16) produce?
10
16
24
26
What is a input?
To plug in something.
A function that allows us to ask the user to enter some data.
Data displayed on a screen.
A function
name=input("What is your name? ")
print("Your name is " + name)
What will be displayed if the user types in "Bob"?
Your name is name
name
Bob
Your name is Bob
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, if anything, is wrong with the following?
x=input("Type your password: ")
print("You typed", x)
The variable should be switched with the input command
You can't use commas in print statements
You can't print x
Nothing is wrong
What, if anything, is wrong with the following?
x=input("Type your password: ")
print("You typed " + x)
The variable should be switched with the input command
You can't use + in print statements
You can't print x
Nothing is wrong
What is a programming language?
Written English
An artificial language used to program a computer
A language used in pseudocode
Machine code
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)
What is the term for an error that a programmer makes in their code so the program won't run?
Program error
Syntax error
Code error
Logic error
What data type would you use to represent the price of an item?
integer
float
Boolean
String
Which of the following variable names is NOT allowed to be used?
first_name
name1
name#1
lastName
What is the process of converting one data type to another called?
Data conversion.
Type Casting.
Type Conversion.
Concatenation.
What function converts the data in a variable into a 'integer'?
int()
str()
bool()
float()
What function converts the data in a variable into a 'float'?
int()
flt()
bool()
float()
What function converts the data in a variable into a 'string'?
str()
float()
bool()
string()
What does this built-in function do?
input()
Opens the CD tray.
Prompts the user to enter data.
Displays the word 'input'.
Exits the program.
How do you ask for the user to input their name?
name = int("what is your name")
print("What is your name?")
input = name("what is your name?")
name = input("what is your name?")
By default any data inputted by the user is of data type string in python.
True
False
What will be the output of the following command?
x = int(3.6)
print(x)
3
4
Logical error - Can't cast a float value to an integer as data will be lost.
What will be the output of the following command?
x = float(3)
print(x)
Logical error - Can't cast a integer value to an float as data will be added.
3.0
3
What will be the output of the following command?
x = str(3)
print(x)
3
3.0
'3'
What will be the output of the following program, if the user entered 20 and then 41?
Number1 = input("Enter the first number: ")
Number2 = input("Enter the second number: ")
print(Number1 + Number2)
20 41
Syntax error.
61
2041
What can you add to the following code so that python recognises that they are numbers?
Number1 = input("Enter the first number: ")
Number2 = input("Enter the second number: ")
print(Number1 + Number2)
int()
float()
Use a print statement to tell the user to enter a number.
integer()
Fill in the missing section for the code below:
areaOfSquare = (a) (input("Enter area of square: "))
What will be the output of the following program?
gameOnePoints = 200
gameTwoPoints = "456"
print(gameOnePoints + gameTwoPoints)
Logical error - Can't add an integer and string together.
656
"656"
Enter the missing keyword for the program below:
name =_____("Enter name: ")
input
Bob
Input
Which of the following input commands would allow the user to receive and store a character from the keyboard?
character = input("Please enter a character:")
character = int(input("Please enter a character:"))
character = float(input("Please enter a character:"))
character = bool(input("Please enter a character:"))
Which of the following input commands would allow the user to receive and store an integer from the keyboard?
integer = input("Please enter an integer:")
integer = int(input("Please enter an integer:"))
integer = float(input("Please enter an integer:"))
integer = bool(input("Please enter an integer:"))
Which of the following input commands would allow the user to receive and store a boolean value from the keyboard?
boolean_value = input("Please enter a boolean value:")
boolean_value = int(input("Please enter a boolean value:"))
boolean_value = float(input("Please enter a boolean value:"))
boolean_value = bool(input("Please enter a boolean value:"))
Which would be the correct way to display a concatenated message indicating a pupil's final score in an exam?
print ("Your final score is" + str(final_score))
print ("Your final score is" + int(final_score))
print ("Your final score is" + final_score)
display ("Your final score is" + str(final_score))
Which python command allows the program to display a value on the screen?
display
show
output
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.
