wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python_quiz_snakegame

Total questions: 10

Worksheet time: 6mins

Name
Class
Date
1.

The onkey() function calls the respective functions when the specific keys are pressed.


a)

True

b)

False

2.

Look at the towers shown

A tower is "perfectly placed" if all the towers to the left of it are shorter, and all towers to its right are taller.


a)

A

b)

B

c)

C

d)

F

e)

E

3.

The listen() function is used to detect when the user has hit certain keys on the keyboard or moved/clicked the mouse.


a)

True

b)

False

4.

In which direction is the turtle pointed by default?

a)

East

b)

West

c)

North

d)

South

5.

What are the items you can specify when creating a function?

a)

function name

b)

parameter list

c)

import

6.

What is the output of the following code snippet?

def printfunc(msg, num = 1):

printfunc(msg * num)

func('Hello')

func('Students', 3)

a)

Hello

Students

b)

Hello

StudentsStudentsStudents

c)

Hello

Students,Students,Students

d)

Hello

7.

Bowe the beaver wants to go home.Normally he follows the signs, but a strong wind has blown 3 of them away.

To get him home, each of the three new blue signs given below need to be put in correct places marked 1,2,3.


Which of the options below is the correct one?

a)
b)
c)
d)
8.

What is the output of the following code snippet?

def myfunct(msg, num):

while num > 0:

print(msg)

num = num - 1

myfunct('Python', 4)

a)

PythonPythonPythonPythonPythonPython

b)

PythonPythonPythonPython

c)

invalid call

d)

infinite loop

9.

What is the output of the following code?

def outerFun(a, b):

def innerFun(c, d):

return c + d

return innerFun(a, b)

res = outerFun(5, 10)

print(res)

a)

15

b)

Error

c)

5

d)

10

10.

Little Flora wants to pick flowers for her grandmother.

Her garden is divided into several flower beds.

Each flower bed has a certain number of flowers.

Little Flora starts picking flowers from the top left flower bed and makes her way down to the bottom right flower bed.

She can decide to walk downwards (↓) or to the right (→) but in no other direction.

Which of the flower beds on her path will help her collect the most flowers.

a)
b)
c)