Python

Python

Math has 28 Questions

What is returned by math.ceil(3.4)?

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

1
1.0
-3
-3.0
Is the function abs() same as math.fabs()?

sometimes
always
never
none of the mentioned
What is the value returned by math.fact(6)?

720
6
[1, 2, 3, 6]
error
What is the value of x if x = math.factorial(0)?

0
1
error
none of the mentioned
What is math.factorial(4.0)?

24
1
error
none of the mentioned
What is the output of print(math.factorial(4.5))?

24
120
error
none of the mentioned
What is math.floor(0o10)?

8
10
0
9
What does the function math.frexp(x) return?

a tuple containing of the mantissa and the exponent of x
a list containing of the mantissa and the exponent of x
a tuple containing of the mantissa of x
a list containing of the exponent of x
What is the result of math.fsum([.1 for i in range(20)])?

2.0
20
2
2.0000000000000004
What is the result of sum([.1 for i in range(20)])?

2.0
20
2
2.0000000000000004
What is returned by math.isfinite(float('inf'))?

True
False
None
error
What is returned by math.isfinite(float('nan'))?

True
False
None
error
What is x if x = math.isfinite(float('0.0'))?

True
False
None
error
What is the result of the following?
>>> -float('inf') + float('inf')


inf
nan
0
0.0
What is the output of the following?
print(math.isinf(float('-inf')))

error, the minus sign shouldn't havve been inside the brackets
error, there is no function called isinf
1
0
What is the value of x if x = math.ldexp(0.5, 1)?

1
2.0
0.5
none of the mentioned
What is returned by math.modf(1.0)?

(0.0, 1.0)
(1.0, 0.0)
(0.5, 1)
(0.5, 1.0)
What is the result of math.trunc(3.1)?

3.0
3
0.1
1
What is the output of print(math.trunc('3.1'))?

3
3.0
error
none of the mentioned
Which of the following is the same as math.exp(p)?

e ** p
math.e ** p
p ** e
p ** math.e
What is returned by math.expm1(p)?

(math.e ** p) ? 1
math.e ** (p ? 1)
error
none of the mentioned
What is the default base used when math.log(x) is found?

e
10
2
none of the mentioned
Which of the following aren't defined in the math module?

log2()
log10()
logx()
none of the mentioned
What is returned by int(math.pow(3, 2))?

6
9
error, third argument required
error, too many arguments
What is output of print(math.pow(3, 2))?

9
9.0
None
none of the mentioned
What is the value of x if x = math.sqrt(4)?

2
2.0
(2, -2)
(2.0, -2.0)
What does math.sqrt(X, Y) do?

calculate the Xth root of Y
calculate the Yth root of X
error
return a tuple with the square root of X and Y