Chapter 0 · Section 5 practice
Modules, NumPy and SciPy
These questions review the examples in the companion slides. Choose an answer, then check the explanation.
Question 1
NumPy is installed, but a freshly restarted kernel reports NameError: np is not defined. What should you run first?
import numpy as np%pip install numpyon every restartnp = 0
Question 2
In a fresh session, you run from math import sqrt as root. Which call matches that import?
math.sqrt(144)sqrt(144)root(144)
Question 3
For values = [2, 5] and array = np.array(values), what does array * 2 contain?
[2, 5, 2, 5][4, 10]- The scalar
14
Question 4
For the same five unequal customer counts, why is the result with ddof=1 larger than with ddof=0?
- The data have changed
- The mean has doubled
- The squared deviations are divided by 4 instead of 5
Question 5
A manager wants a time limit that 95% of deliveries meet under a specified normal model. Which operation answers that question?
stats.norm.ppf(0.95, loc=28, scale=6)stats.norm.cdf(0.95, loc=28, scale=6)stats.norm.pdf(0.95, loc=28, scale=6)
Question 6
A normal PDF evaluated at 8 minutes gives approximately 0.1995. Which interpretation is correct?
- Exactly 19.95% of deliveries take 8 minutes
- This is a density; interval probability is an area under the curve
- The observed mean must be 8 minutes