wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Functions

Total questions: 9

Worksheet time: 5mins

Name
Class
Date
1.

The output of the code above will be

a)

0

b)

1

c)

99

2.

How to add these two numbers

a)

age = int(age_1) + int(age_2)

b)

age = int(age_1 + age_2)

c)

age = age_1 + age_2

3.

The string enclosed in triple quotes is called the doc string. It is used to

a)

Show the documentation about the function

b)

be read by the developer reading the function code

4.

Which of the following code is true

a)

square() will return 25

b)

square(3) will return 9

5.

Which of the following is true

a)

The code above will result in syntax error

b)

square(2,2) will result in a value of 4

c)

square(2,3) will result in a value of 9

6.

The above code is the signature of the print function in Python.


*objects represents

a)

Variable number of arguments that can be passed as strings

b)

pointer to objects in memory

7.

The code above

a)

Takes in variable number of arguments and returns the sum of them

b)

Takes in a pointer to a list of numbers and returns the sum of them

8.

The output of the code above is

a)

<class 'tuple'>

b)

<class 'list'>

c)

<class 'dict'>

d)

<class 'string'>

e)

<class 'iterable'>

9.

The output of the code above is

a)

40

b)

30

c)

syntax error