Bird
0
0

What will be the output of this code snippet?

medium📝 Predict Output Q4 of 15
SciPy - Statistical Functions (scipy.stats) Basics
What will be the output of this code snippet?
import numpy as np
from scipy import stats

sample = np.array([5, 7, 8, 9, 10])
mean = np.mean(sample)
sem = stats.sem(sample)
print(round(sem, 3))
A0.748
B2.236
C1.673
D0.707
Step-by-Step Solution
Solution:
  1. Step 1: Calculate sample mean and standard error of mean (SEM)

    SEM is standard deviation divided by sqrt of sample size. Using scipy.stats.sem calculates this.
  2. Step 2: Compute SEM for given sample

    Sample: [5,7,8,9,10], std dev ≈ 1.58, n=5, SEM = 1.58 / sqrt(5) ≈ 0.707.
  3. Final Answer:

    0.707 -> Option D
  4. Quick Check:

    SEM calculation = 0.707 [OK]
Quick Trick: SEM = std deviation divided by sqrt(sample size) [OK]
Common Mistakes:
MISTAKES
  • Confusing SEM with standard deviation
  • Rounding errors
  • Using population std dev instead of sample

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes