# Python Questions and Answers – Math – 3

This set of Python Developer Interview Questions & Answers focuses on “Math – 3”.

1. What is the result of math.trunc(3.1)?
a) 3.0
b) 3
c) 0.1
d) 1

Explanation: The integral part of the floating point number is returned.

2. What is the output of print(math.trunc(‘3.1’))?
a) 3
b) 3.0
c) error
d) none of the mentioned

Explanation: TypeError, a string does not have __trunc__ method.

3. Which of the following is the same as math.exp(p)?
a) e ** p
b) math.e ** p
c) p ** e
d) p ** math.e

Explanation: math.e is the constant defined in the math module.

4. What is returned by math.expm1(p)?
a) (math.e ** p) – 1
b) math.e ** (p – 1)
c) error
d) none of the mentioned

Explanation: One is subtracted from the result of math.exp(p) and returned.

5. What is the default base used when math.log(x) is found?
a) e
b) 10
c) 2
d) none of the mentioned

Explanation: The natural log of x is returned by default.

6. Which of the following aren’t defined in the math module?
a) log2()
b) log10()
c) logx()
d) none of the mentioned

Explanation: log2() and log10() are defined in the math module.

7. What is returned by int(math.pow(3, 2))?
a) 6
b) 9
c) error, third argument required
d) error, too many arguments

Explanation: math.pow(a, b) returns a ** b.

8. What is output of print(math.pow(3, 2))?
a) 9
b) 9.0
c) None
d) None of the mentioned

Explanation: math.pow() returns a floating point number.

9. What is the value of x if x = math.sqrt(4)?
a) 2
b) 2.0
c) (2, -2)
d) (2.0, -2.0)

Explanation: The function returns one floating point number.

10. What does math.sqrt(X, Y) do?
a) calculate the Xth root of Y
b) calculate the Yth root of X
c) error
d) return a tuple with the square root of X and Y

Explanation: The function takes only one argument.

Sanfoundry Global Education & Learning Series – Python.

To practice all developer interview questions on Python, here is complete set of 1000+ Multiple Choice Questions and Answers.