Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

standard input output

Total questions: 41

Worksheet time: 21mins

Name
Class
Date
1.

What is the word (command) used to display numbers and text on the screen?

a)

print

b)

show

c)

output

d)

command

2.

What can be used to store information and values so that it can be used later?

a)

Graphic

b)

Variable

c)

Print

d)

Output

3.

What will be the output?

name = 'Dave'

print (name)

a)

name

b)

print

c)

Dave

d)

error

4.

What would print (10 + 16) produce?

a)

10

b)

16

c)

24

d)

26

5.

What is a input?

a)

To plug in something.

b)

A function that allows us to ask the user to enter some data.

c)

Data displayed on a screen.

d)

A function

6.

name=input("What is your name? ")

print("Your name is " + name)

What will be displayed if the user types in "Bob"?

a)

Your name is name

b)

name

c)

Bob

d)

Your name is Bob

7.

What, if anything, is wrong with the following?

input=x("Type your password: ")

print(x)

a)

The variable should be switched with the input command

b)

Input commands don't need ( )

c)

You can't print x

d)

Nothing is wrong

8.

What, if anything, is wrong with the following?

x=input("Type your password: ")

print("You typed", x)

a)

The variable should be switched with the input command

b)

You can't use commas in print statements

c)

You can't print x

d)

Nothing is wrong

9.

What, if anything, is wrong with the following?

x=input("Type your password: ")

print("You typed " + x)

a)

The variable should be switched with the input command

b)

You can't use + in print statements

c)

You can't print x

d)

Nothing is wrong

10.

What is a programming language?

a)

Written English

b)

An artificial language used to program a computer

c)

A language used in pseudocode

d)

Machine code

11.

What does the print command do?

a)

Outputs a hard copy of a program to a printer

b)

Outputs a message on screen

c)

Print a hard copy of a flow chart to a printer

d)

Prints out the the commands line by line on the screen

12.

How do we get user input from the keyboard?

a)

input = (What is your name?)

b)

input = What is your name?

c)

output = ("What is your name?")

d)

name=input("What is your name? ")

13.

Which data type would you use for the quantity of stock in a shop?

a)

integer

b)

float

c)

string

d)

boolean

14.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
15.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

16.

What is the term for an error that a programmer makes in their code so the program won't run?

a)

Program error

b)

Syntax error

c)

Code error

d)

Logic error

17.
Which statement correctly assigns the string "Tanner" to the variable name?
a)
name  = print( "Tanner")
b)
input("Tanner")
c)
name = "Tanner"
d)
name = input("Tanner")
18.

What data type would you use to represent the price of an item?

a)

integer

b)

float

c)

Boolean

d)

String

19.

Which of the following variable names is NOT allowed to be used?

a)

first_name

b)

name1

c)

name#1

d)

lastName

20.

What is the process of converting one data type to another called?

a)

Data conversion.

b)

Type Casting.

c)

Type Conversion.

d)

Concatenation.

21.

What function converts the data in a variable into a 'integer'?

a)

int()

b)

str()

c)

bool()

d)

float()

22.

What function converts the data in a variable into a 'float'?

a)

int()

b)

flt()

c)

bool()

d)

float()

23.

What function converts the data in a variable into a 'string'?

a)

str()

b)

float()

c)

bool()

d)

string()

24.

What does this built-in function do?

input()

a)

Opens the CD tray.

b)

Prompts the user to enter data.

c)

Displays the word 'input'.

d)

Exits the program.

25.

How do you ask for the user to input their name?

a)

name = int("what is your name")

b)

print("What is your name?")

c)

input = name("what is your name?")

d)

name = input("what is your name?")

26.

By default any data inputted by the user is of data type string in python.

a)

True

b)

False

27.

What will be the output of the following command?

x = int(3.6)

print(x)

a)

3

b)

4

c)

Logical error - Can't cast a float value to an integer as data will be lost.

28.

What will be the output of the following command?

x = float(3)

print(x)

a)

Logical error - Can't cast a integer value to an float as data will be added.

b)

3.0

c)

3

29.

What will be the output of the following command?

x = str(3)

print(x)

a)

3

b)

3.0

c)

'3'

30.

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)

a)

20 41

b)

Syntax error.

c)

61

d)

2041

31.

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)

a)

int()

b)

float()

c)

Use a print statement to tell the user to enter a number.

d)

integer()

32.

Fill in the missing section for the code below:

areaOfSquare = (a)   (input("Enter area of square: "))

33.

What will be the output of the following program?

gameOnePoints = 200

gameTwoPoints = "456"

print(gameOnePoints + gameTwoPoints)

a)

Logical error - Can't add an integer and string together.

b)

656

c)

"656"

34.

Enter the missing keyword for the program below:

name =_____("Enter name: ")

a)

input

b)

print

c)

Bob

d)

Input

35.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
36.

Which of the following input commands would allow the user to receive and store a character from the keyboard?

a)

character = input("Please enter a character:")

b)

character = int(input("Please enter a character:"))

c)

character = float(input("Please enter a character:"))

d)

character = bool(input("Please enter a character:"))

37.

Which of the following input commands would allow the user to receive and store an integer from the keyboard?

a)

integer = input("Please enter an integer:")

b)

integer = int(input("Please enter an integer:"))

c)

integer = float(input("Please enter an integer:"))

d)

integer = bool(input("Please enter an integer:"))

38.

Which of the following input commands would allow the user to receive and store a boolean value from the keyboard?

a)

boolean_value = input("Please enter a boolean value:")

b)

boolean_value = int(input("Please enter a boolean value:"))

c)

boolean_value = float(input("Please enter a boolean value:"))

d)

boolean_value = bool(input("Please enter a boolean value:"))

39.

Which would be the correct way to display a concatenated message indicating a pupil's final score in an exam?

a)

print ("Your final score is" + str(final_score))

b)

print ("Your final score is" + int(final_score))

c)

print ("Your final score is" + final_score)

d)

display ("Your final score is" + str(final_score))

40.

Which python command allows the program to display a value on the screen?

a)

display

b)

show

c)

print

d)

output

41.

What is type casting?

a)

It allows a piece of data to have it's data type changed, e.g. an integer could be changed to a string.

b)

It allows the program to display the value of a variable on the screen.

c)

It allows the program to collect data from the keyboard.

d)

It allows the programmer to display the value of a variable while the program is running.