wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Quiz on functions

Total questions: 9

Worksheet time: 5mins

Name
Class
Date
1.

What is a function?

a)

piece of code.

b)

a type of variable.

c)

a block of code which runs when it is called.

d)

a block of code which runs automatically when we test our code.

2.

What will be the output of the following function?

a)

14

b)

1

4

c)

1,2

d)

Error

3.

Which of the following is a function?

a)

def function():

print('hi')

b)

def function()

print('hi')

c)

make function():

print('hi')

d)

define function():

print('hi')

4.

What will be the output of the function?

a)

Hello World!

Bye!

b)

Hello World!

Hello World!

Bye!

Bye!

c)

Hello World! Bye!

Hello World!

d)

Hello World! Bye!

Hello World! Bye!

5.

(a)   function():

Fill in the blank.

6.

What will be the output?

a)

a triangle

b)

fd(120)

rt(120)

c)

Nothing

d)

Error

7.

Rewrite this line of code correctly.

(a)  

8.

What is the output of following code snippet:

a)

10

b)

24

c)

7

d)

1

9.

What is a recursive function?

a)

A function that calls other function.

b)

A function which calls itself.

c)

Both A and B

d)

None of the above