This set of Python Developer Interview Questions & Answers focuses on “Maths”.

1. What is the result of math.trunc(3.1)?

a) 3.0

b) 3

c) 0.1

d) 1

View Answer

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

View Answer

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

View Answer

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

a) (math.e ** p) – 1

b) math.e ** (p – 1)

c) error

d) none of the mentioned

View Answer

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

View Answer

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

View Answer

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

View Answer

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

View Answer

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

a) 2

b) 2.0

c) (2, -2)

d) (2.0, -2.0)

View Answer

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

View Answer

Explanation: The function takes only one argument.

**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__.