IITP · Semester ISummaries · Quizzes · Assignments

EMC 5103 — Probability and Statistics

Assignment 3 — Statistics with Python (SciPy / NumPy / Matplotlib)

Source: IITP\Sem-1\EMC5103-Probability-Statistics\assignments\assignment-3.md

Topic: P-P vs Q-Q plots · scipy.stats.probplot · stem/step/line plots · binom.pmf · box plots · np.cumsum · list insertion · DataFrame.corr() Questions: 10 MCQ (full options) Source: class WhatsApp group (Chats/WhatsApp-Cheat-code/chat.md), "Probability and Statistics – Assignment 3" (5 Nov 2026).

Verification: ✅ all 10 re-derived — all correct. The one conceptual trap is Q1 vs Q2: a P-P plot compares two CDFs, a Q-Q plot compares quantiles, and probplot draws the Q-Q plot.


Quick answer key

Q Ans Q Ans
1 a 6 b
2 c 7 b
3 c 8 d
4 c 9 a
5 a 10 b

Q1. In a P-P plot, points forming a straight line close to Y=X indicate:

a. The dataset closely matches the specified distribution b. There are outliers c. The dataset has a uniform distribution d. The two datasets differ significantly

✅ a. A P-P plot compares the empirical CDF with the theoretical CDF at corresponding probabilities; agreement on the diagonal = good fit. Related: a systematic S-shape means the tails differ (heavier/lighter than assumed); a shift means a location/scale mismatch.

Q2. What does stats.probplot(data, dist="norm", plot=plt) do?

a. Line plot b. P-P plot c. Q-Q plot d. Histogram

✅ c — Q-Q plot. probplot plots the ordered data against the theoretical quantiles of dist ("probability plot" is the historical name). Related: if the points lie on the reference line, the data is consistent with that distribution — for norm, it is the standard normality check.

Q3. Which module provides statistical distributions?

a. matplotlib b. numpy.random c. scipy.stats d. random

✅ c — scipy.stats. It provides the distribution objects with .pdf/.pmf/.cdf/.ppf/.rvs. Related: numpy.random samples from distributions; scipy.stats describes them analytically.

Q4. Distinguishing step, stem and line plots:

a. All three only for categorical data b. Step uses vertical lines, stem connects with a curve, line shows bars c. A stem plot uses vertical lines from a baseline to data points; a step plot shows data as stair steps; a line plot connects data points with straight lines d. Line uses vertical lines only; stem and step are continuous

✅ c. The definitions are swapped in every other option. Related: plt.stem is for discrete signals (DSP-style), plt.step for piecewise-constant functions (histogram-like), plt.plot for continuous trends.

Q5. Probability of exactly k successes in Binomial(n, p)?

a. binom.pmf(k, n, p) b. binom.pdf(k, n, p) c. binom.pmf(n, p, k) d. binom.cdf(k, n, p)

✅ a. The signature is pmf(k, n, p) — successes first. Related: pdf does not exist for a discrete distribution (it is pmf); cdf gives P(X ≤ k), i.e. "at most k", which is the classic misread.

Q6. Function returning the number of elements in a list?

a. size() b. len() c. count() d. length()

✅ b — len(). Related: list.count(x) counts occurrences of x, not the length — a common trap. numpy.size works on arrays, not plain lists.

Q7. In a box plot, the line inside the box represents:

a. Mean b. Median c. Mode d. Q1

✅ b — median (Q2). Related: box = Q1..Q3 (IQR), whiskers extend to 1.5·IQR, points beyond are outliers. Some tools draw the mean as a separate marker.

Q8. NumPy function for the cumulative sum of an array?

a. np.diff() b. np.cumulative_sum() c. np.sum() d. np.cumsum()

✅ d — np.cumsum(). Related: np.sum is the total; np.diff is the discrete difference (the inverse operation). NumPy 2.0 added np.cumulative_sum as an alias, which is why option (b) is plausible — on the course's version, (d) is the answer.

Q9. Insert an element at the beginning of a list?

a. mylist.insert(0, element) b. None c. mylist.add(element) d. mylist.append(0, element)

✅ a. insert(index, value) places at index 0. Related: append always adds at the end and takes one argument; add is for sets, not lists.

Q10. Is this correct for a correlation matrix?

correlation_matrix = df.correlation()

a. No, the dataset format is incorrect b. No, the correct method is df.corr() c. Yes, it correctly calculates the correlation matrix d. No, it's df.corr_matrix()

✅ b — df.corr(). DataFrame.correlation is not a pandas method (AttributeError). Related: df.corr() defaults to Pearson; use method="spearman" for rank correlation. Note it silently drops/ignores non-numeric columns.