250+ TOP MCQs on Python Math and Answers

Python Objective Questions & Answers on “Math – 1”.

1. What is returned by math.ceil(3.4)?
a) 3
b) 4
c) 4.0
d) 3.0
Answer: b
Clarification: 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
Answer: a
Clarification: The floor function returns the biggest number that is smaller than or equal to the number itself.

3. What will be the output of print(math.copysign(3, -1))?
a) 1
b) 1.0
c) -3
d) -3.0
Answer: d
Clarification: 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
Answer: b
Clarification: A negative floating point number is returned as a positive floating point number.

5. Is the output of the function abs() the same as that of the function math.fabs()?
a) sometimes
b) always
c) never
d) none of the mentioned
Answer: a
Clarification: 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
Answer: d
Clarification: 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

Answer: b
Clarification: Factorial of 0 is 1.

8. What is math.factorial(4.0)?
a) 24
b) 1
c) error
d) none of the mentioned
Answer: a
Clarification: The factorial of 4 is returned.

9. What will be the output of print(math.factorial(4.5))?
a) 24
b) 120
c) error
d) 24.0
Answer: c
Clarification: Factorial is only defined for non-negative integers.

10. What is math.floor(0o10)?
a) 8
b) 10
c) 0
d) 9
Answer: a
Clarification: 0o10 is 8 and floor(8) is 8.

objective questions on Python,

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top