Skip to main content

Module 3 Test: Statistics and Math for ML

This is your progress tracker . 20 questions: 5 Easy, 10 Moderate, 5 Hard . Solve all the questions yourself first (work out the output in your head before running the code in Colab), then check with the Answer Key.

ScoreMeaning
18 to 20Excellent! Your grip on Module 3 is strong.
12 to 17Good. Re-read the chapters where you made mistakes.
Below 12Do not worry. Re-read Chapters 9 to 11 and run the code yourself, then take the test again.
EASY​

Q1. When data has some very large, unusual values (outliers), which measure is better for describing the centre?

A) Mean B) Median C) Range D) Variance

​
EASY​
Q2. In what range can the Pearson correlation (r) value lie?​

A) 0 to 1 B) -1 to +1 C) 0 to 100 D) -100 to +100

​
EASY​
Q3. In a hypothesis test, what do we do if the p-value is smaller than alpha (0.05)?​

A) Accept H0 as correct B) Reject H0 C) Reduce the sample size

D) Run the test again for no reason

​
EASY​
Q4. In simple linear regression y = b0 + b1 x, what does the slope (b1) mean?​

A) The value of y when x = 0 B) The change in y for a 1-unit increase in x C) The total count of the data D) The sum of errors

​
EASY​
Q5. What is the small part of the population from which data is collected called?​

A) Parameter B) Sample C) Variable D) Outlier

​
MODERATE​
Q6. What will be the output of this code (population standard deviation)?​
import numpy as np
print(np.std([2, 4, 4, 4, 5, 5, 7, 9]))

A) 2.0 B) 2.14 C) 4.0

D) 5.0

​
MODERATE​
Q7. What will be the output of this code (Pandas default std)?​
import pandas as pd
s = pd.Series([2, 4, 4, 4, 5, 5, 7, 9])
print(round(s.std(), 2))

A) 2.0 B) 2.14 C) 4.0 D) 1.9

​
MODERATE​
Q8. What will be the output of this code?​
import math
print(math.comb(5, 2))

A) 20 B) 10 C) 5 D) 25

​
MODERATE​
Q9. A student scored 85 marks. The class mean is 70 and the std is 5. What is this student's z-score?​
print((85 - 70) / 5)

A) 1.0 B) 2.0 C) 3.0 D) 15.0

​
MODERATE​
Q10. What will be the output of this code?​
from scipy.stats import norm
print(round(norm.cdf(0), 2))

A) 0.0 B) 0.5 C) 0.95 D) 1.0

​
MODERATE​
Q11. What is the correct meaning of a 95% confidence interval?​

A) The true mean is in this range with 95% probability (for one single interval)

B) If this method is repeated again and again, about 95% of the intervals will capture the true mean

C) 95% of the data is in this range

D) The sample mean is 95% correct

​
MODERATE​
Q12. What is the correct meaning of Type I error?​

A) H0 was true but we rejected it (false alarm)

B) H0 was false but we did not reject it

C) The sample size was very small

D) The p-value came out negative

​
MODERATE​
Q13. What will be the output of this code (rounded)?​
import numpy as np
b1, b0 = np.polyfit([1, 2, 3, 4], [3, 5, 7, 9], 1)
print(round(b1, 1), round(b0, 1))

A) 1.0 2.0 B) 2.0 1.0 C) 2.0 3.0 D) 3.0 2.0

​
MODERATE​

Q14. 20 students took a test before and after a training. Did the training change their marks? Which test is correct?

A) Independent two-sample t-test B) Paired t-test C) Chi-square test

D) One-way ANOVA (on a single group)

MODERATE​

Q15. In simple regression the correlation is r = 0.8. What will R-squared be?

print(round(0.8 ** 2, 2))

A) 0.8 B) 0.64 C) 0.4 D) 1.6

​
HARD​

Q16. A disease affects 2% of people. The test detects the sick correctly 90% of the time and wrongly reports 10% of healthy people as positive. What is the probability of being sick given a positive result (Bayes)? What will be the output of this code?

p_d, sens, fp = 0.02, 0.90, 0.10
p_pos = sens * p_d + fp * (1 - p_d)
print(round(sens * p_d / p_pos, 2))

A) 0.90 B) 0.16 C) 0.50 D) 0.02

​
HARD​

Q17. What is the probability of exactly 2 heads in 3 coin tosses (Binomial)? What will be the output of this code?

from scipy.stats import binom
print(round(binom.pmf(2, 3, 0.5), 3))

A) 0.250 B) 0.375 C) 0.500 D) 0.667

​
HARD​
Q18. What will be the output of this code?​
from scipy import stats
r = stats.ttest_1samp([5, 6, 7, 8, 9], 5)
print(round(r.statistic, 2), r.pvalue < 0.05)

A) 0.0 False B) 2.83 True C) 2.83 False

D) 7.0 True

​
HARD​

Q19. What will be the output of this code (Spearman and Pearson, rounded)?

from scipy import stats
import numpy as np
x = np.arange(1, 11)
y = x ** 2
print(round(stats.spearmanr(x, y)[0], 2), round(stats.pearsonr(x, y)[0], 2))

A) 1.0 1.0 B) 1.0 0.97 C) 0.97 1.0 D) 0.97 0.97

​
HARD​

Q20. The sample std is s = 10. If the sample size is increased from n = 25 to n = 100, what happens to the Standard Error (s / sqrt(n))? Output:

import numpy as np
print(10 / np.sqrt(25), 10 / np.sqrt(100))

A) 2.0 and 1.0 (half) B) 2.0 and 0.5 (a quarter) C) 4.0 and 1.0 D) SE does not change

MODULE 3 TEST​

Module 3 Answer Key (Answers and explanations)​

#LevelAnswerExplanation
1EasyB) MedianThe median is the middle value and is less affected by outliers. The mean
is pulled toward outliers.
2EasyB) -1 to +1Correlation always lies between -1 (a perfect inverse relationship) and +1
(a perfect direct relationship).
3EasyB) Reject H0p-value < alpha means the data is very unusual under H0, so H0 is
rejected.
4EasyB) The change in y for a 1-unit
increase in x
The slope tells how much y changes (on average) for a one-unit increase
in x. The intercept is the value of y at x = 0.
5EasyB) SampleThe small chosen part of the population is called a Sample. A number
computed from a sample is called a statistic.
6ModerateA) 2.0Mean = 5, variance (divided by n) = 32 / 8 = 4, so std = sqrt(4) = 2.0.
NumPy's default is ddof=0.
7ModerateB) 2.14Pandas' default is ddof=1 (sample std): sqrt(32 / 7) = 2.14. This differs
from NumPy's ddof=0 result.
8ModerateB) 10Choosing 2 out of 5 as combinations = 5! / (2! x 3!) = 10. (A permutation
would be 20, where order matters.)
9ModerateC) 3.0z = (x - mean) / std = (85 - 70) / 5 = 3.0. This is 3 std above the mean
(very unusual, probably an outlier).
10ModerateB) 0.5The standard Normal is symmetric and 0 is its centre, so the portion
below 0 is 50% (0.5).
11ModerateB) If this method is repeated
again and again, about 95% of
the intervals will capture the
true mean
The confidence level of a CI is the long-run success percentage of the
method, not the probability for one chosen interval.
12ModerateA) H0 was true but we rejected
it (false alarm)
Type I = false positive: there was actually no difference but the test
reported one. Its probability is alpha.
13ModerateB) 2.0 1.0The data lies exactly on y = 1 + 2x: slope 2.0 and intercept 1.0.
14ModerateB) Paired t-testThe same people were measured twice (before/after), so a paired t-test
is correct.
15ModerateB) 0.64In simple linear regression R-squared = the square of r = 0.64, i.e. the
model explains 64% of the spread in y.
16HardB) 0.16p_pos = 0.018 + 0.098 = 0.116. Posterior = 0.018 / 0.116 = 0.155 (0.16).
Because the disease is in few people (base rate), the chance stays low
even after a positive test.
17HardB) 0.375C(3, 2) x 0.5<sup>2</sup>x 0.5<sup>1</sup>= 3 x 0.125 = 0.375.
18HardB) 2.83 TrueSample mean = 7, std = 1.58, SE = 0.707, t = (7 - 5) / 0.707 = 2.83. With n
= 5 this gives p < 0.05, so True.
19HardB) 1.0 0.97y = x<sup>2</sup>always increases, so Spearman (on ranks) is exactly 1.0. But the
relationship is not a straight line, so Pearson is slightly below 1 (0.97).
20HardA) 2.0 and 1.0 (half)Multiplying n by 4 halves SE (1 / sqrt(4) = 1/2): 10/5 = 2.0 and 10/10 =
1.0. SE falls with the square root of n, not directly.

Your score: ______ / 20