🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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())
  1. A.[[30.0, 10.0], [10.0, 30.0]]
  2. B.[[20.0, 20.0], [20.0, 20.0]]
  3. C.[[40.0, 40.0], [40.0, 40.0]]
  4. 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 →