wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python quiz

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

The symbol of Hallowen is ..,,

a)

pear

b)

Peach

c)

pumpkin

d)

Strawberry

2.

Which of the following functions can be used to create a loop? (check all that apply)

a)

for i in range

b)

if

c)

else

d)

while

3.

What would the following code draw?

from turtle import*

for i in range(3):

forward(100)

right(360/3)

a)

A triangle pointing up

b)

A triangle pointing to the right

c)

A triangle pointing to the left

d)

A triangle pointing down

4.

What would the following code output?

from turtle import*

goto(-100, 0)

a)

A blank screen

b)

A vertical line going from the middle of the screen straight down

c)

A horizontal line going from the middle of the screen to the left

d)

A horizontal line going from the middle of the screen to the right

5.

Day or night, my bones are white. Who am I?

a)

Vampire

b)

Ghost

c)

Skeleton

d)

Pumpkin

6.

To create a code comment in Python, what do you need to type in front of your text?

a)

%

b)

#

c)

$

d)

@

7.

Is python a High level programming language

a)

NO

b)

Maybe

c)

Yes

d)

I dont know

8.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
9.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
10.

What is the process of converting one datatype to another called?

a)

Data conversion.

b)

Type Casting.

c)

Type Conversion.

d)

Concatenation.

11.

I´ve got 8 legs. I´m very small. Who am I?

a)

Witch

b)

Ghost

c)

Spider

d)

Monster

12.

What is an integer?

a)

A number with a decimal point.

b)

A whole number.

c)

An array of characters.

d)

A single character.

13.

What function converts the data in a variable into a 'float'?

a)

int()

b)

flt()

c)

bool()

d)

float()

14.
We celebrate Haloween...
a)
30th September
b)
30th October
c)
31th September
d)
31th October
15.

What would the program display if you ran this code and entered 2 and then 3 when prompted?

a)

The total is 5.

b)

The total is 23.

c)

The total is 6.

d)

An error.

16.

What color cat is a symbol of Halloween?

a)

white

b)

orange

c)

yellow

d)

black

17.
A line of text that Python won't try to run as code
a)
comment
b)
modulus
c)
variable
d)
boolean
18.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
19.

I've got a hat and a big black cat. Who am I?

a)

Witch

b)

Vampire

c)

Ghost

d)

Teacher

20.

What Python Turtle function allows you to change the colour of a shape?

a)

fill_color

b)

fillcolor

c)

shape_fill

d)

shape_color

21.

You put this inside a jack-o-lantern

a)

Candy

b)

Soup

c)

Candle

d)

Sandwich

22.

which is the correct syntax for a function from the option given below?

a)

def myFunction

b)

myFunction()

c)

def myFunction():

d)

def myFunction()

23.

Halloween is celebrated in this month

a)

October

b)

November

c)

September

d)

December

24.

What is the output of the following code:

hello = 100

Print(" I would like to say " + hello)

a)

I would like to say hello

b)

I would like to say 100

c)

Error

d)

I dont know

25.

In this code, how much does an apple cost?

a)

£1

b)

50p

c)

20p

d)

25p