Test Series - python

Test Number 80/108

Q: What is the result of math.trunc(3.1)?
A. 3.0
B. 3
C. 0.1
D. 1
Solution: The integral part of the floating point number is returned.
Q: What is the output of print(math.trunc(‘3.1’))?
A. 3
B. 3.0
C. error
D. none of the mentioned
Solution: TypeError, a string does not have __trunc__ method.
Q: 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
Solution: math.e is the constant defined in the math module.
Q: What is returned by math.expm1(p)?
A. (math.e ** p) – 1
B. math.e ** (p – 1)
C. error
D. none of the mentioned
Solution: One is subtracted from the result of math.exp(p) and returned.
Q: What is the default base used when math.log(x) is found?
A. e
B. 10
C. 2
D. none of the mentioned
Solution: The natural log of x is returned by default.
Q: Which of the following aren’t defined in the math module?
A. log2()
B. log10()
C. logx()
D. none of the mentioned
Solution: log2() and log10() are defined in the math module.
Q: What is returned by int(math.pow(3, 2))?
A. 2
B. 9
C. error, third argument required
D. error, too many arguments
Solution: math.pow(a, b) returns a ** b.
Q: What is output of print(math.pow(3, 2))?
A. 9
B. 9.0
C. None
D. None of the mentioned
Solution: math.pow() returns a floating point number.
Q: What is the value of x if x = math.sqrt(4)?
A. 2
B. 2.0
C. (2, -2)
D. (2.0, -2.0)
Solution: The function returns one floating point number.
Q: 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
Solution: The function takes only one argument.

You Have Score    /10