Bird
0
0

What does this code print?

medium📝 Predict Output Q5 of 15
SciPy - Statistical Functions (scipy.stats) Basics
What does this code print?
from scipy.stats import uniform
rv = uniform(loc=0, scale=4)
print(rv.pdf(2))
A1.0
B0.5
C0.0
D0.25
Step-by-Step Solution
Solution:
  1. Step 1: Understand PDF of uniform distribution

    PDF is 1/scale between loc and loc + scale, else 0.
  2. Step 2: Calculate PDF at x=2 with scale=4

    PDF = 1/4 = 0.25 since 2 is between 0 and 4.
  3. Final Answer:

    0.25 -> Option D
  4. Quick Check:

    PDF = 1/scale = 0.25 [OK]
Quick Trick: PDF = 1 divided by scale inside range [OK]
Common Mistakes:
MISTAKES
  • Using PDF as 0.5 or 1.0 incorrectly
  • Ignoring range and returning 0
  • Confusing PDF with CDF

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes