wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Built-in Functions

Total questions: 15

Worksheet time: 15mins

Name
Class
Date
1.

1. Which of the following functions is a built-in function in python?

a)

a) seed()

b)

b) sqrt()

c)

c) factorial()

d)

d) print()

2.

2. Which keyword is used for function?

a)

a) define

b)

b) fun

c)

c) def

d)

d) function

3.

3. What will be the output of the following Python expression?

round(4.576)

a)

a) 4.5

b)

b) 5

c)

c) 4

d)

d) 4.6

4.

4. The function pow(x,y,z) is evaluated as:

a)

a) (x**y)**z

b)

b) (x**y) / z

c)

c) (x**y) % z

d)

d) (x**y)*z

5.

5. What will be the output of the following Python function?


all([2,4,0,6])

a)

a) Error

b)

b) True

c)

c) False

d)

d) 0

6.

6. What will be the output of the following Python expression?


round(4.5676,2)?

a)

a) 4.5

b)

b) 4.6

c)

c) 4.57

d)

d) 4.56

7.

7. What will be the output of the following Python function?


any([2>8, 4>2, 1>2])

a)

a) Error

b)

b) True

c)

c) False

d)

d) 4 > 2

8.

8. Which of the following items are present in the function header?

a)

a) function name

b)

b) Parameter list

c)

c) return value

d)

d) Both A and B

9.

9. What is called when a function is defined inside a class?

a)

a) class

b)

b) function

c)

c) method

d)

d) module

10.

10. If return statement is not used inside the function, the function will return:

a)

a) None

b)

b) 0

c)

c) Null

d)

d) Arbitary value

11.

11. What will be the output of the following Python function?

import math

abs(math.sqrt(25))

a)

a) Error

b)

b) -5

c)

c) 5

d)

d) 5.0

12.

12. What is a variable defined outside a function referred to as?

a)

a) local variable

b)

b) global variable

c)

c) static variable

d)

d) automatic variable

13.

13. Which of the following operators is the correct option for power(ab)?

a)

a) a ^ b

b)

b) a**b

c)

c) a^^ b

d)

d) a ^ * b

14.

14. Which one of the following has the highest precedence in the expression?

a)

a) Division

b)

b) Subtraction

c)

c) Power

d)

d) Paranthesis

15.

15. What error will occur when you execute the following code?

MANGO = APPLE

a)

a) NameError

b)

b) Syntax Error

c)

c) Type Error

d)

d) Value Error