wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

St Michael's - Year 8 - Python

Total questions: 39

Worksheet time: 20mins

Name
Class
Date
1.
What is the name of the programming language that we are using?
a)
Python
b)
Mamba
c)
Cobra
d)
Rattlesnake
2.
Who invented Python?
a)
Guido van Rossum
b)
Steve Jobs
c)
Bill Gates
d)
Alan Turing
3.
What is the job of an If Statement?
a)
To make a choice based on the information it is given.
b)
To do everything it is told.
c)
To repeat code until it is done.
d)
To turn a program on if it isnt working.
4.
An If Statement is similar to…
a)
A person choosing which path to walk down.
b)
A person spinning a hula hoop
c)
A person playing football
d)
A person sleeping
5.

What is the job of a While Loop?

a)

To repeat a section of code as long as something is true.

b)

To repeat a section of code as long as you are looking at the screen.

c)

To run a piece of code once then check that everything worked correctly.

d)

To run a section of code forever.

6.
A While Loop is similar to…
a)
A person choosing to go to sleep when it gets dark
b)
A person kicking a football
c)
A person eating a piece of chewing gum
d)
A person doing two things at once
7.
What is the job of a For Loop?
a)
To repeat a section of code for a certain amount of time.
b)
To run a program and then close it when it finishes
c)
To have no errors in the code
d)
To show you your work on the screen
8.
A For Loop is similar to…
a)
A person running the 100m
b)
A person spinning a hula hoop
c)
A person diving into a swimming pool
d)
A person walking their dog
9.
How do you write the first line of an If Statement?
a)
if X > Y:
b)
IF X is Y:
c)
If X is bigger than Y:
d)
If X Bigger Y:
10.
How do you write the first line of a While Loop?
a)
while X>Y:
b)
WHILE X>Y:
c)
while X bigger than Y:
d)
while X bigger Y:
11.
How do you write the first line of a For Loop?
a)
for X in Y:
b)
for XY:
c)
FOR X in Y:
d)
For X in the number Y:
12.
A while loop can be used to…
a)
Make a timer in a game
b)
Lock a phone after it hasn’t been touched for a while
c)
Repeat a question if someone gets it wrong
d)
All of these
13.
A for loop can be used to…
a)
Make a timer in a game
b)
Lock a phone after it hasn’t been touched for a while
c)
Count all the items in a shopping list
d)
All of these
14.
A YouTube video which links to different videos is an example of..
a)
an If Statament
b)
a While Loop
c)
a Pause Break
d)
a For Loop
15.
IF, WHILE and FOR appear as which colour in Python?
a)
Orange
b)
Blue
c)
Green
d)
Black
16.
PRINT appears in which colour in Python?
a)
Purple
b)
Green
c)
Orange
d)
Black
17.
Written text inside speech marks appears in which colour in Python?
a)
Green
b)
Purple
c)
Orange
d)
Black
18.
Variables appear in which colour in Python?
a)
Black
b)
Green
c)
Orange
d)
Blue
19.

What is the problem in this program?

a)

There is a missing " in section 2

b)

There is a missing ) in section 2

c)

There is a missing " in section 3

d)

Nothing

20.

What is the problem in this program?

a)

You can't add numbers to 'Dave'

b)

The total will be 5 which is too much

c)

The program will ask you for your name but you can't write it in.

d)

Nothing

21.

What is the problem in this program?

a)

Spelling mistake in section 5

b)

Spelling mistake in section 4

c)

Spelling mistake in section 3

d)

Nothing

22.

What is the problem in this program?

a)

The program will ask you for your name but you can't write it in.

b)

Spelling mistake in section 5

c)

Spelling mistake in section 3

d)

Nothing

23.

What is the problem in this program?

a)

The < is the wrong symbol in section 4

b)

The () is the wrong symbol in section 1

c)

The -1 is the wrong symbol in section 6

d)

Nothing

24.

The following error means what?

a)

The word 'print' has been misspelled

b)

The program should not have hello in speech marks

c)

The last line of the program is running first (back to front)

d)

The name of the file is wrong

25.

The following error means what?

a)

There is a spelling or punctuation mistake somewhere in the program.

b)

The program will run fine but you need to press save.

c)

It has spelled the word 'Syntax' wrong somewhere

d)

Invalid program, this is when you write a different program's code in python.

26.

The following error means what?

a)

There is no variable named 'x'

b)

The last line of the program is running first (back to front)

c)

The name of the program is wrong so it won't run.

d)

'x' can never be bigger than 1

27.

The following error means what?

a)

The user entered hello instead of a number

b)

The user needed to write 'int' for the program to work

c)

The user used the word 'string' and this made the program stop working

d)

The name of the program is wrong so it wouldn't work.

28.

What does this program do?

a)

It prints the number 10

b)

It prints the word "grapes"

c)

It prints "grapes = 10"

d)

It doesn't do anything

29.

What does this program do?

a)

It counts down from 10 and then says you died.

b)

It says you died 10 times

c)

It counts down from 10 and says you died 10 times

d)

It doesn't do anything

30.

What does this program do?

a)

It will keep counting up until it says I've bought 100 things

b)

It will keep counting up until it says I've bought 101 things

c)

It will keep counting up until it says I've bought 99 things

d)

It does not work because it has an error

31.

What does this program do?

a)

It will print out I like dogs 4 times

b)

It will print out I like dogs 8 times

c)

It will print out I like dogs 9 times

d)

It will print out I like dogs 12 times

32.

What does this program do?

a)

It will ask you for your name then tell you they were expecting you

b)

It will give you a name

c)

It will call you 'name' and say they were expecting you

d)

It won't work

33.
A syntax error is…
a)
When a program will not work because of a spelling or punctuation mistake
b)
When a program works but the maths doesn't add up
34.
A logic error is…
a)
When a program works but the maths doesn't add up
b)
When a program will not work because of a spelling or punctuation mistake
35.
Errors appear in which colour?
a)
Red
b)
Green
c)
Blue
d)
Black
36.
An error gives you three pieces of useful information. What are they?
a)
The type of error and the line and position of the error
b)
The name of the error and the colour and style of the error
37.
Python files are saved as…
a)
.py files
b)
.python files
c)
.pyth files
d)
.vanRossum files
38.
Why can't we make multi-line programs in IDLE?
a)
When you press Enter, the code is run instantly
b)
There is stuff at the top
c)
You have to press File then New File first.
d)
All of these
39.
What happens if you make a while loop that doesn't end?
a)
The program will run until it is killed
b)
The program will crash
c)
Nothing
d)
The program will give you an error