Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Course Selection

Total questions: 31

Worksheet time: 18mins

Name
Class
Date
1.
Code executed based on a condition being true
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
2.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
3.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif
4.

The character that must be at the end of the line for if?

a)

:

b)

;

c)

.

d)

,

5.
Used to make comments
a)
#
b)
%
c)
**
d)
()
6.
The correct way to write a variable in Python?
a)
myVariable = 10
b)
my Variable = 10
c)
myVariable is 10
d)
myVariable: 10
7.

The order of the code

a)

Sequence

b)

Selection

c)

Iteration

d)

Variable

8.
A location in memory used to store data that can be changed.
a)
Constant
b)
Value
c)
Variable
d)
Iteration
9.
What does an IF statement do?
a)
Closes the program
b)
Makes a decision
c)
Asks a question
10.
Why do we comment code 
a)
To explain what the code does 
b)
To show how clever we are 
c)
For fun 
d)
No reason 
11.

What will the code do?

a)

nothing

b)

display Hello Bob

c)

display I don't know you

d)

display Hello

12.
What would the value of 'b' be when it is printed out? 
a)
1
b)
4
c)
5
d)
8
13.

To add selection in to a program, what would you use?

a)

An 'int' command

b)

A 'while' loop

c)

An 'If' statement

d)

a 'print' command

14.
What is an algorithm?
a)
Writing a program
b)
Step by step instructions to solve a problem
c)
something used in computing
d)
A piece of code
15.

I am 71 years old! What will the output be?:

IF you are 70 or older, say “You are aged to perfection!”

ELIF you are exactly 50, say “Wow, you are half a century old!”

ELSE say “You are a spring chicken!”

a)

“You are aged to perfection!”

b)

"Wow, you are half a century old!"

c)

"You are a spring chicken!"

16.
This operator means that one value is not equal to another value
a)
==
b)
<=
c)
>=
d)
!=
17.
What is the result of the code:
team = Cowboys
if team = Cowboys:
    print "Dallas is #1"
a)
Error
b)
Cowboys
c)
Team
d)
Dallas is #1
18.

What is the output?

a)

5 is equal to 4

b)

5 > 4

c)

"5 is greater than 4"

d)

5 is greater than 4

19.

If the user enters 60, what is the output?

a)

You are old!

b)

You are middle-aged!

c)

You are young!

d)

Error message

20.
What is wrong with this code?

if answer == (“Man United”)
a)
no quotation marks
b)
no parentheses
c)
no capital letters
d)
No colon
21.
What is wrong with this code?

print"What football team do you support?"
a)
no quotation marks
b)
no parentheses
c)
no commas
d)
no capital letters
22.

What three things can make up an if statement?

a)
if, egg, else
b)
if, elif, else
c)
if, elif, egg
d)
if, excited, scream
23.
What does “==” represent in Python programming?
a)
less than
b)
equal to
c)
greater than
d)
not equal to
24.
<
a)
greater than
b)
less than
c)
equal to
d)
less than or equal to
25.
>
a)
less than
b)
not equal to
c)
less than or equal to
d)
greater than
26.
<=
a)
less than
b)
less than or equal to
27.
>=
a)
greater than
b)
greater than or equal to
c)
not greater than
d)
not equal to
28.
==
a)
equal to
b)
assign a variable
c)
not equal to
d)
less than
29.
! =
a)
greater than variable
b)
less than variable
c)
equal to
d)
not equal to
30.
Choose the correct Python code.
if age is less than 20 then
a)
if age > 20:
b)
if age < 20:
31.
Choose the correct Python code.
if age is less than 20 and greater than equal or equal to 15 then
a)
if age <20 and age >=15:
b)
if age <20>=15 :