wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Functions

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.
a)

A) Emma 25

b)

B) Emma 20

c)

c) Emma 2520

2.
a)

A) 25

b)

B) 5

c)

C) NameError

3.
 Which of the following is the use of function in python?
a)
a) Functions are reusable pieces of programs
b)
b) Functions don’t provide better modularity for your application
c)
c) you can’t also create your own functions
d)
d) All of the mentioned
4.
a)

A. x is the formal argument.

b)

B. a is the actual argument.

c)

C. fn(x) is the function signature.

d)

D. x is the actual argument.

5.
How is a function declared in Python?
a)
A. def function function_name():
b)
B. declare function function_name():
c)
C. def function_name():
d)
D. declare function_name():
6.
Which of the following function headers is correct?
a)
A. def fun(a = 2, b = 3, c)
b)
B. def fun(a = 2, b, c = 3)
c)
C. def fun(a, b = 2, c = 3)
d)
D. def fun(a, b, c = 3, d)
7.
a)

A. the function header

b)

B. the function body

c)

C. the function definition

8.

Consider the code below. What prints?

print(int(33.7))

a)

A. 34.0

b)

B. 34

c)

C. 33.70

d)

D. 33

9.
Which of the following would NOT work as a variable name?
a)
A. a
b)
B. len
c)
C. length
d)
D. x
10.

a)

A. 25

b)

B. 5

c)

C. 125

d)

D. 10

11.

a)

A. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11

b)

B. 1, 2, 3, 5, 6, 7, 9, 10, 11

c)

C. 9, 10, 11, 1, 2, 3, 5, 6, 7

d)

D. 9, 10, 5, 6, 1, 2, 3, 6, 7, 10, 11

e)

E. 1, 5, 9, 10, 5, 6, 1, 2, 3, 6, 7, 10, 11

12.
A named sequence of statements that returns a result is known as which of the following?
a)
A. definition
b)
B. procedure
c)
C. turtle
d)
D. module
e)
E. function
13.
a)

A. value

b)

B. Second

c)

C. parameter

d)

D. First

e)

E. Jane Doe

14.
a)

A. Zap ABC jane fred jane

b)

B. Zap ABC Zap

c)

C. ABC Zap jane

d)

D. ABC Zap ABC

e)

E. Zap Zap Zap

15.
What is the purpose of the “def” keyword in Python?
a)
A. It is slang that means "the following code is really cool"
b)
B. It indicates the start of a function
c)
C. It indicates that the following indented section of code is to be stored for later
d)
D. b and c are both true
e)
E. None of the above