← Quiz: Hypothesis Testing: all 15 questions
Quiz: Hypothesis Testing · Question 14 of 15
What does this print? (code)
What does this print?
import numpy as np
observed = np.array([[30, 10], [10, 30]])
row = observed.sum(axis=1, keepdims=True)
col = observed.sum(axis=0, keepdims=True)
print((row * col / observed.sum()).tolist())
- A.[[30.0, 10.0], [10.0, 30.0]]
- B.[[20.0, 20.0], [20.0, 20.0]]
- C.[[40.0, 40.0], [40.0, 40.0]]
- D.[[10.0, 30.0], [30.0, 10.0]]
Answer & explanation
Correct answer: [[20.0, 20.0], [20.0, 20.0]]
Each expected count is 40 × 40 ÷ 80 = 20 if the two variables were unrelated.
Can you get the rest right without peeking?
Take the timed Quiz: Hypothesis Testing quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →