wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python input, output, and errors

Total questions: 14

Worksheet time: 8mins

Name
Class
Date
1.

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

2.

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

3.

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? ")

4.

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

a)

integer

b)

float

c)

string

d)

boolean

5.
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
6.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

7.

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

8.
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")
9.

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

a)

integer

b)

float

c)

Boolean

d)

String

10.

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

a)

first_name

b)

name1

c)

name#1

d)

lastName

11.

The following is an example of what type of error?


print("Here is some text")

print(1/0)

a)

Syntax Error

b)

Run-time Error

c)

Logical Error

12.

The following is an example of what type of error?


print("Here is some text"

print(6/2)

a)

Syntax Error

b)

Run-time Error

c)

Logical Error

13.

The following code to calculate an average is an example of what type of error?


x = 2

y = 6

average = x + y / 2

print(average)

a)

Syntax Error

b)

Run-time Error

c)

Logical Error

14.

Improper indentation is an example of what type of error?

a)

Syntax Error

b)

Run-time Error

c)

Logical Error