Python Math MCQs: Python Programming MCQs

Python Math MCQs. MCQs on Mathematical Functions in Python Programming Language.

 

Python Math MCQs

 

 

What is the default base used when math.log(x) is found ??

a) e
b) 10
c) 2
d) none of the mentioned

 

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

 

What is returned by math.isfinite(float(‘nan’)) ??

a) True
b) False
c) None
d) error

 

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

a) (math.e ** p) – 1
b) math.e ** (p – 1)
c) error
d) none of the mentioned

 

Python Math MCQs

 

What is displayed on executing print(math.fabs(-3.4)) ??

a) -3.4
b) 3.4
c) 3
d) -3

 

What is returned by math.isfinite(float(‘inf’)) ??

a) True
b) False
c) None
d) error

 

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

 

What will be the output of print(math.copysign(3, -1)) ??

a) 1
b) 1.0
c) -3
d) -3.0

 

Python Math MCQs

 

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

a) 2.0
b) 20
c) 2
d) 2.0000000000000004

 

What is the output of print(math.trunc(‘3.1’)) ??

a) 3
b) 3.0
c) error
d) none of the mentioned

 

What is the value returned by math.floor(3.4) ??

a) 3
b) 4
c) 4.0
d) 3.0

 

What is the result of math.fsum([.1 for i in range(20)]) ??

a) 2.0
b) 20
c) 2
d) 2.0000000000000004

 

Python Math MCQs

 

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

a) 3.0
b) 3
c) 0.1
d) 1

 

What is returned by math.ceil(3.4) ??

a) 3
b) 4
c) 4.0
d) 3.0

 

What does the function math.frexp(x) return ??

a) a tuple containing the mantissa and the exponent of x
b) a list containing the mantissa and the exponent of x
c) a tuple containing the mantissa of x
d) a list containing the exponent of x

Leave a Comment

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

error: Content is protected !!