This set of Python Objective Questions & Answers focuses on “Mathematical Functions”.

1. What is returned by math.ceil(3.4)?

a) 3

b) 4

c) 4.0

d) 3.0

View Answer

Explanation: The ceil function returns the smallest integer that is bigger than or equal to the number itself.

2. What is the value returned by math.floor(3.4)?

a) 3

b) 4

c) 4.0

d) 3.0

View Answer

Explanation: The floor function returns the biggest number that is smaller than or equal to the number itself.

3. What is the output of print(math.copysign(3, -1))?

a) 1

b) 1.0

c) -3

d) -3.0

View Answer

Explanation: The copysign function returns a float whose absolute value is that of the first argument and the sign is that of the second argument.

4. What is displayed on executing print(math.fabs(-3.4))?

a) -3.4

b) 3.4

c) 3

d) -3

View Answer

Explanation: A negative floating point number is returned as a positive floating point number.

5. Is the function abs() same as math.fabs()?

a) sometimes

b) always

c) never

d) none of the mentioned

View Answer

Explanation: math.fabs() always returns a float and does not work with complex numbers whereas the return type of abs() is determined by the type of value that is passed to it.

6. What is the value returned by math.fact(6)?

a) 720

b) 6

c) [1, 2, 3, 6]
d) error

View Answer

Explanation: NameError, fact() is not defined.

7. What is the value of x if x = math.factorial(0)?

a) 0

b) 1

c) error

d) none of the mentioned

View Answer

Explanation: Factorial of 0 is 1.

8. What is math.factorial(4.0)?

a) 24

b) 1

c) error

d) none of the mentioned

View Answer

Explanation: The factorial of 4 is returned.

9. What is the output of print(math.factorial(4.5))?

a) 24

b) 120

c) error

d) none of the mentioned

View Answer

Explanation: Factorial is only defined for non-negative integers.

10. What is math.floor(0o10)?

a) 8

b) 10

c) 0

d) 9

View Answer

Explanation: 0o10 is 8 and floor(8) is 8.

**Sanfoundry Global Education & Learning Series – Python Programming Language.**

Here’s the list of Best Reference Books in Python.

__here is complete set of 1000+ Multiple Choice Questions and Answers__.