wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Recap

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What in the name of the variable in this Python code?

a)

name

b)

input

c)

print

d)

("What is your name")

2.

When coding in Python what two instructions would I use if I want the program to select a choice?

a)

IF

PRINT

b)

IF

COUNT

c)

IF

ELSE

d)

IF

INPUT

3.

What is missing from the Python code in the image?

a)

() [brackets]

b)

" " [speech marks]

c)

: [colon]

d)

; [semi-colon]

4.
Quotation marks around a variable’s identifier imply that it is a:
a)
String
b)
Integer
c)
Character
d)
List
5.
This variable data type can only have True or False values:
a)
Boolean
b)
Integer
c)
True/False
d)
String
6.
Casting refers to:
a)
Converting between variable data types
b)
Boolean algebra
c)
Printing out of the program’s results
d)
Sending values to a function or procedure
7.
The programming keywords ELSE IF or ELIF are best used when our selection needs to work with:
a)
More than two choices
b)
More than three choices
c)
More than one choice
d)
A conditional loop
8.

What is missing in the code below:


print(Hello World")

(a)  

9.

Which of the following lines of code is the correct way to create an input stored in a variable called age?

a)

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

b)

Age = input("What is your age?")

c)

age = input("What is your age")

d)

age = input "What is your age?"

10.

Which of the following variables will have a string data type

a)

x = 5

b)

x = "5"

c)

y = "Hello"

d)

y = Hello

11.

If a grade of 98 was inputted, what would be the output?

a)

Passed

b)

Failed

c)

Else

12.

What would the program output with the following inputs?

Payrate - 12

Hours Worked - 10

a)

12

b)

Final pay

c)

OUTPUT

d)

120

13.

Which of these is a list?

a)

fruit = ["apples", "oranges", "bananas"]

b)

fruit = "apples", "oranges", "bananas"

c)

fruit = {"apples", "oranges", "bananas"}

d)

fruit = ("apples", "oranges", "bananas")

14.
What is the position of the name 'Paula' in the following list:
names = ["Paul","Phillip","Paula","Phillipa"]
a)
0
b)
1
c)
2
d)
3
15.

What will this code output?

a)

nothing at all

b)

dude

c)

dude, 4 times

d)

dude, 6 times

e)

dude, 3 times