Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Year 8

Total questions: 60

Worksheet time: 30mins

Name
Class
Date
1.
What is Python?
a)
text based programming language
b)
word processor 
c)
spreadsheet
d)
block based programming language
2.
Why are the indents necessary after the if and else statements?
a)
Do not follow these instructions above 
b)
Logic of the code will make sense
c)
Follow these instructions if the statement above is true
d)
Code will have no syntax error
3.
What will the following code do? 
name = "Bob"
if name == "Bob": 
     print ("Hello " + name) 
else:  
     print ("I dont know you")
a)
prints bob
b)
prints Hello Bob
c)
nothing syntax error
d)
prints I don't know you
4.
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
5.
What is the name of the programming language we are learning?
a)
Scratch
b)
Python
c)
Pie thin
d)
Scribble
6.
What is python?
a)
a programming language 
b)
DTP software 
c)
Spreadsheet software
d)
Computer 
7.

which of these are a correct print statement

a)

Print("Computer science")

b)

prit ("Computer science")

c)

print (Computer science")

d)

print ("Computer science")

8.

I am used multiple times in a program; I can be changed and stored in memory. I am a ? ONE WORD ANSWER.

(a)  

9.

Which line in this program is incorrect?


if 9 > 8:

Print ("Correct")

else:

print ("Incorrect")

a)

Line 1

b)

Line 2

c)

Line 3

d)

Line 4

10.
What does the term 'debug' mean?
a)
Identify errors and fix them.
b)
Making a calculation
c)
A set of instructions
d)
Looking at code
11.
What will the output be from the following code?
print("Hello world!")
a)
SyntaxError
b)
Hello world!
c)
"Hello world!"
d)
print(Hello world!)
12.
What is syntax?
a)
Syntax is the word used to describe an error
b)
Syntax is the rules of the programming language
c)
It is used to read information
d)
It is used to output information 
13.

To display something on the screen, use this command:

a)

print()

b)

Print()

c)

screen()

d)

write()

e)

display()

14.

To display the following on screen

Hello World!

the following command should be used:

a)

print(Hello World!)

b)

print("Hello World!")

c)

print("Hello World" + !)

d)

print"(Hello World!)"

15.

cakeAmount = raw_input()

print "We have", cakeAmount, " cakes"


The above code is run. You type:

six


Select the correct output.

a)

We have six cakes

b)

We have 6 cakes

c)

We havesix cakes

d)

Syntax Error

16.
The number or word we give to a variable
a)
Value
b)
Bug
c)
Information
d)
Text
17.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
18.
Which of these would work as a piece of code?
a)
IF answer == "Yes":
b)
if answer == "Yes"
c)
if answer == "Yes":
d)
if answer = "yes":
19.

Which is the Python logo?

a)
b)
c)
d)
20.

What is a input?

a)

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

b)

To plug in something.

c)

Data displayed on a screen.

d)

A function

21.

What is a output?

a)

A piece of data that is shown on the screen.

b)

Data that the user enters

c)

An output

d)

A orange

22.

What function is used to output a message in python?

a)

print("")

b)

input=name

c)

print

d)

name=input

23.

What syntax would you use to create a name variable?

a)

name=input()

b)

input=name

c)

name=input{}

d)

name=INPUT

24.

people = ["John", "Rob", "Bob"]

print (people[4])

what would this result be?

a)
John
b)
Rob
c)
Bob
d)
Error
25.

To display the following on screen

Hello World!

the following command should be used:

a)

print(Hello World!)

b)

print("Hello World!")

c)

print("Hello World" + !)

d)

print"(Hello World!)"

26.

Which operator performs a division?

a)

-

b)

+

c)

/

d)

*

27.

Which operator checks if a value is equal to another value?

a)

+

b)

=

c)

==

d)

!=

28.
The character that must be at the end of the line for if, while, for etc.
a)
:
b)
;
c)
.
d)
,
29.
The second part of if, that is executed when the condition is false
a)
if
b)
else
c)
for
d)
input
30.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
31.
stores a piece of data, and gives it a specific name
a)
variable
b)
whitespace
c)
interpreter
d)
modulo
32.
The correct way to write a variable in Python?
a)
my_variable = 10
b)
my variable = 10
c)
my_variable is 10
d)
my_variable: 10
33.
What does the term 'debug' mean?
a)
Identify errors and fix them.
b)
Making a calculation
c)
A set of instructions
d)
Looking at code
34.

Which of the following is used in Python to give a value to a variable

a)

:=

b)

==

c)

=

35.

print(1+2)

what will the result be

a)

error

b)

3

c)

1+2

36.

To make the turtle move forward, which command is used?

a)

turtle.penup()

b)

turtle.forward()

c)

turtle.left()

d)

turtle.backward()

37.

When creating a rectangle with the turtle, what angle is needed when turning?

a)

120

b)

180

c)

45

d)

90

38.

In order to move the turtle 120 forward without drawing on the screen, which order is correct?

a)

turtle.forward(120)

turtle.penup()

turtle.pendown()

b)

turtle.pendown()

turtle.forward(120)

turtle.penup()

c)

turtle.penup()

turtle.forward(120)

turtle.pendown()

39.

To fill a shape with the colour red, which command is correct?

a)

turtle.fillcolor('Red')

b)

turtle.fillcolour('Red')

c)

turtle.fillcolor("Red")

d)

turtle.fillcolour("Red")

40.

How do you tell python you want to use the turtle library

a)

turtle import

b)

import turtle

c)

from libraries import turtle

d)

from turtle import libraries

41.

What does turn(90) do?

a)

Turns right 90 degrees

b)

Turns left 90 degrees

c)

Moves forward 90

d)

Does nothing as 'turn' is not a turtle instruction

42.

Look at this code, how many times will it loop?

a)

50

b)

90

c)

0

d)

4

43.

What shape will this create?

a)

Triangle

b)

Rectangle

c)

Hexagon

d)

Will look like the turtle is climbing stairs

44.

What does t.forward(300) do?

a)

Moves in the direction it is facing 300 steps

b)

Moves down the screen 300 steps

c)

Moves up the screen 300 steps

45.

To stop the turtle drawing you need to use which of the following commands?

a)

penup:

b)

pen_up

c)

penup()

d)

penup():

46.
Look at this code, what shape will it make?
a)
Square
b)
Triangle
c)
Rectangle
d)
Hexagon 
47.
Look at this code, what is the variable? 
a)
0
b)
4
c)
for
d)
i
48.
What is wrong with this code?
a)
Missing Brackets
b)
Missing Comma
c)
Missing Colon
d)
Incorrect spelling 
49.
What is wrong with this code?
a)
Missing Brackets
b)
Missing Comma
c)
Missing Colon
d)
Incorrect spelling 
50.

There is an error on this piece of code, what is the correct statement?

a)

screen.bgcolor("lightblue")

b)

screen.bgcolor="lightblue")

c)

screen.bgcolour("lightblue")

d)

screen.bgcolor=lightblue()

51.

What is wrong with this piece of code

a)

Must use the American spelling of colour - "color"

b)

Remove the prefix "screen." on Line 3

c)

Don't write the name of the colour in quote marks

d)

Don't add a capital letter to "Screen"

52.

There is an error on this piece of code, what is the correct statement?

a)

import turtle

b)

import Turtle

c)

import.Turtle

d)

turtle import

53.

There is an error on this piece of code, what is the correct statement?

a)

turtle.forward(150)

b)

turtle.forward()

c)

turtle.moveforward()

d)

turtle.move.forward(150)

54.

There is an error on this piece of code, what is wrong?

a)

Nothing

b)

No full stop needed in the pen.down statement e.g. turtle.pendown()

c)

No brackets needed in the pen.down statement e.g. turtle.pen.down

d)

No turtle prefix needed in the pen.down statement e.g. pen.down()

55.

There is an error on this piece of code, how should it be written?

a)

There is no error

b)

screen=turtle.screen()

c)

screen=turtle.Screen()

d)

screen=turtle.screen("blue")

56.

There is an error on this piece of code, how should it be written?

a)

There is no error

b)

turtle.right(90)

c)

turn.right(90)

d)

right(90)

57.

There is an error on this piece of code, how should it be written?

a)

There is no error

b)

turtle.right(90)

c)

turtle.drawcircle(10)

d)

import.turtle

58.

There is an error on this piece of code, how should it be written?

a)

There is no error

b)

turtle.right(90)

c)

turtle.drawcircle(10)

d)

import.turtle

59.
To make the turtle move forward, which command is used?
a)
turtle.penup()
b)
turtle.forward()
c)
turtle.left()
d)
turtle.backward()
60.

What shape will be the output from this code?

a)

Square

b)

Triangle

c)

Circle

d)

Rectangle