Python Modules — Chapter Test

Answer all 5 questions, then submit. You need 60% to pass. Log in to save progress.

Question 1
After 'import math', how do you call the square-root function?
Asqrt(16)
Bmath.sqrt(16)
Cmath->sqrt(16)
Dsqrt.math(16)
Question 2
Which import lets you write sqrt(16) directly, with no 'math.' prefix?
Aimport math
Bfrom math import sqrt
Cimport math as m
Dinclude math
Question 3
What does math.ceil(4.1) return?
A4
B5
C4.1
D4.0
Question 4
Which function gives a random whole number between 1 and 6 inclusive?
Arandom.random()
Brandom.randint(1, 6)
Crandom.range(1, 6)
Drandom.float(1, 6)
Question 5
In the statistics module, which function gives the average?
Amedian()
Bmode()
Cmean()
Daverage()