MauryaHub PYQ Practice

Statistical Computing · Quiz 1 · Jan 2026

Statistical Computing · Quiz 1 · Jan 2026

← Course papers · Start practice / exam

Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.

13 / 13 published solutions

Question 2 MCQ · 0.0 marks

Source diagram or notation
Source diagram or notation
6406536376435.
Useful Data has been mentioned above.
6406536376436.
This data attachment is just for a reference & not for an evaluation.

Published solution

**1. Identify the purpose of the question:** This 0-mark introductory item displays the reference formula sheet (Useful Data) for the Statistical Computing exam and asks the candidate to acknowledge that the useful data has been provided above. **Answer: A — Useful Data has been mentioned above.** A: **Correct:** Standard acknowledgment option for the exam's Useful Data formula sheet. B: **Incorrect:** Standard exam instructions require selecting Option A to confirm viewing the useful data.

Report a correction for Q2

Question 3 MSQ · 2.0 marks

Which of the following statements are true about the inverse transform method? Select all that apply.
6406536376437.
It requires the inverse CDF of the distribution.
6406536376438.
It can be used only for continuous distribution.
6406536376439.
It maps a Uniform
Source diagram or notation
variable to the target distribution.
6406536376440.
None of these.

Published solution

**1. Review the Inverse Transform Method:** To generate a random variate \( X \) with cumulative distribution function \( F \), we draw \( U \sim \text{Uniform}(0, 1) \) and set \( X = F^{-1}(U) \), where \( F^{-1}(u) = \inf\{x : F(x) \ge u\} \) is the generalized inverse CDF. **2. Evaluate each statement:** - **Option A:** True, it requires evaluating the (generalized) inverse CDF \( F^{-1} \). - **Option B:** False, the inverse transform method applies to **both** continuous and discrete distributions (using the step-function generalized inverse for discrete PMFs). - **Option C:** True, it transforms a \( \text{Uniform}(0, 1) \) random variable \( U \) into a sample from the target distribution. - **Option D:** False since A and C are true. **Answer: A and C.** A: **Correct:** The inverse transform method computes \( X = F^{-1}(U) \) using the inverse CDF. B: **Incorrect:** The method works for discrete distributions as well by finding \( x_k \) such that \( F(x_{k-1}) < U \le F(x_k) \). C: **Correct:** It maps \( U \sim \text{Uniform}(0, 1) \) onto the target distribution via \( F^{-1}(U) \). D: **Incorrect:** Both A and C are true.

Report a correction for Q3

Question 4 MSQ · 2.0 marks

Suppose we want to generate samples from a discrete distribution with pmf
Source diagram or notation
using the Accept–Reject method. Two proposal distributions
Source diagram or notation
and
Source diagram or notation
lead to AR bounds
Source diagram or notation
and
Source diagram or notation
respectively, such that
Source diagram or notation
. Which of the following statements are true? Select all that apply.
6406536376441.
Both proposals generate samples from
Source diagram or notation
with the same efficiency.
6406536376442.
We cannot comment on the efficiency based on the AR bounds.
6406536376443.Source diagram or notation
will produce faster samples from
Source diagram or notation
.
6406536376444.
Both proposals have the same acceptance probability.

Published solution

**1. Recall Acceptance Probability in the Accept–Reject (AR) Method:** When sampling from a target PMF \( p \) using a proposal PMF \( q_i \) with bound \( c_i = \sup_x \frac{p(x)}{q_i(x)} \), the marginal probability of accepting a proposed sample on any single iteration is: \[ P(\text{Accept}) = \sum_x q_i(x) \frac{p(x)}{c_i q_i(x)} = \frac{1}{c_i} \] And the expected number of iterations per accepted sample (measuring sampling efficiency) is \( c_i \). **2. Compare the two proposals when \( c_1 = c_2 \):** Since \( c_1 = c_2 \), both proposals have the exact same acceptance probability \( 1/c_1 = 1/c_2 \) (**Option D is true**) and require the same expected number of proposals per accepted draw, so they have the same sampling efficiency (**Option A is true**, while Options B and C are false). **Answer: A and D.** A: **Correct:** Because the expected number of trials per accepted sample is \( c_i \), \( c_1 = c_2 \) implies identical AR sampling efficiency. B: **Incorrect:** The AR bound \( c \) directly determines the acceptance rate \( 1/c \) and efficiency. C: **Incorrect:** Neither proposal has a smaller bound \( c_i \), so \( q_1 \) is not faster than \( q_2 \). D: **Correct:** The acceptance probability is \( 1/c_i \), so \( c_1 = c_2 \) guarantees equal acceptance probabilities.

Report a correction for Q4

Question 5 MCQ · 4.0 marks

Consider the following two multiplicative congruential generators with seed
Source diagram or notation
as
Source diagram or notation
Source diagram or notation
Starting from the given seed, which of the following statements is correct?
6406536376445.
The sequence generated by
Source diagram or notation
starts repeating before the sequence generated by
Source diagram or notation
.
6406536376446.
The sequence generated by
Source diagram or notation
starts repeating before the sequence generated by
Source diagram or notation
.
6406536376447.
Both sequences start repeating at the same step.
6406536376448.
No repetition for
Source diagram or notation
and
Source diagram or notation
.

Published solution

**1. Trace Generator (A): \( X_{n+1} = 5 X_n \bmod 8 \) with seed \( X_0 = 3 \):** - \( X_0 = 3 \) - \( X_1 = (5 \times 3) \bmod 8 = 15 \bmod 8 = 7 \) - \( X_2 = (5 \times 7) \bmod 8 = 35 \bmod 8 = 3 = X_0 \) The sequence is \( 3, 7, 3, 7, \dots \), which starts repeating at \( n = 2 \). **2. Trace Generator (B): \( X_{n+1} = 3 X_n \bmod 8 \) with seed \( X_0 = 3 \):** - \( X_0 = 3 \) - \( X_1 = (3 \times 3) \bmod 8 = 9 \bmod 8 = 1 \) - \( X_2 = (3 \times 1) \bmod 8 = 3 \bmod 8 = 3 = X_0 \) The sequence is \( 3, 1, 3, 1, \dots \), which also starts repeating at \( n = 2 \). **3. Conclude:** Both sequences have period 2 and start repeating at the exact same step (\( n = 2 \)). **Answer: C — Both sequences start repeating at the same step.** A: **Incorrect:** Both generators repeat at \( X_2 = 3 \). B: **Incorrect:** Generator (B) also repeats at \( X_2 = 3 \), not earlier. C: **Correct:** Generator (A) produces \( 3, 7, 3, \dots \) and Generator (B) produces \( 3, 1, 3, \dots \), both repeating at step 2. D: **Incorrect:** Every finite-modulus congruential generator is periodic; here both have period 2.

Report a correction for Q5

Question 6 MCQ · 4.0 marks

Suppose
Source diagram or notation
with probability density function
Source diagram or notation
We wish to generate random samples from this distribution using the Ratio of Uniforms (RoU) method. The RoU set is defined as
Source diagram or notation
Suppose you enclose the set
Source diagram or notation
in a box
Source diagram or notation
for the accept-reject step. Find the values of
Source diagram or notation
,
Source diagram or notation
, and
Source diagram or notation
.
6406536376469.Source diagram or notation
6406536376470.Source diagram or notation
6406536376471.Source diagram or notation
6406536376472.Source diagram or notation

Published solution

**1. Recall the bounding box formulas for the Ratio of Uniforms (RoU) method:** For \( f(x) = e^{-x} \mathbb{I}_{(0, \infty)}(x) \), the RoU region is: \[ A_f = \left\{(u, v) : 0 \le u \le \sqrt{f(v/u)}\right\} = \left\{(u, v) : 0 \le u \le e^{-v/(2u)},\ v > 0\right\} \] The bounding box \( [0, a] \times [b, c] \) is given by: - \( a = \sup_{x > 0} \sqrt{f(x)} = \sup_{x > 0} e^{-x/2} = 1 \) - \( b = \inf_{x > 0} x \sqrt{f(x)} = \inf_{x > 0} x e^{-x/2} = 0 \) - \( c = \sup_{x > 0} x \sqrt{f(x)} = \sup_{x > 0} x e^{-x/2} \) **2. Maximize \( g(x) = x e^{-x/2} \) for \( x > 0 \):** Setting the derivative to zero: \[ g'(x) = e^{-x/2}\left(1 - \frac{x}{2}\right) = 0 \implies x = 2 \] Substituting \( x = 2 \) gives \( c = g(2) = 2 e^{-1} \). Thus, \( a = 1,\ b = 0,\ c = 2e^{-1} \). **Answer: B — \( a = 1,\ b = 0,\ c = 2e^{-1} \).** A: **Incorrect:** Gives \( c = e^{-1} \) instead of \( 2e^{-1} \). B: **Correct:** \( a = \sup e^{-x/2} = 1 \), \( b = 0 \), and \( c = \sup_{x>0} x e^{-x/2} = 2e^{-1} \) at \( x = 2 \). C: **Incorrect:** Since \( x > 0 \), \( v = u x \ge 0 \), so the lower bound \( b \) is \( 0 \), not \( -2e^{-1} \). D: **Incorrect:** Both \( a \) and \( c \) are miscalculated.

Report a correction for Q6

Question 7 MCQ · 3.0 marks

Let a random variable
Source diagram or notation
have the following probability mass function :
Source diagram or notation
Let
Source diagram or notation
. Which of the following correctly constructs
Source diagram or notation
with distribution function
Source diagram or notation
using the inverse transform method?
6406536376449.Source diagram or notation
6406536376450.Source diagram or notation
6406536376451.Source diagram or notation
6406536376452.Source diagram or notation

Published solution

**1. Compute the Cumulative Distribution Function (CDF) \( F(x) \):** Given \( P(X = 0) = 0.2 \), \( P(X = 1) = 0.2 \), and \( P(X = 2) = 0.6 \): - \( F(0) = P(X \le 0) = 0.2 \) - \( F(1) = P(X \le 1) = 0.2 + 0.2 = 0.4 \) - \( F(2) = P(X \le 2) = 0.4 + 0.6 = 1.0 \) **2. Apply the discrete inverse transform rule:** For \( U \sim \text{Uniform}(0, 1) \): \[ X = \begin{cases} 0, & \text{if } U \le 0.2 \\ 1, & \text{if } 0.2 < U \le 0.4 \\ 2, & \text{if } U > 0.4 \end{cases} \] The probabilities of these intervals are \( 0.2 \), \( 0.4 - 0.2 = 0.2 \), and \( 1 - 0.4 = 0.6 \), matching the PMF. **Answer: B.** A: **Incorrect:** Uses the raw PMF value `0.2` instead of the cumulative sum `0.4` for the second threshold. B: **Correct:** Partitions \( (0, 1) \) at cumulative probabilities \( F(0) = 0.2 \) and \( F(1) = 0.4 \). C: **Incorrect:** Gives \( P(X=1) = 0.6 - 0.2 = 0.4 \) instead of \( 0.2 \). D: **Incorrect:** Gives \( P(X=0) = 0.4 \) instead of \( 0.2 \).

Report a correction for Q7

Question 8 MCQ · 2.0 marks

Below code snippet implements an inverse transform method. Study the code carefully and answer the given subquestions.
Source diagram or notation
Source diagram or notation
Source diagram or notation
What is the CDF of the
Source diagram or notation
6406536376453.Source diagram or notation
6406536376454.Source diagram or notation
6406536376455.Source diagram or notation
6406536376456.Source diagram or notation

Published solution

**1. Read the inverse transform function from the Python code:** The code defines `inv_cdf(u, a, c)` as `c * (u ** (1 / a))`, meaning: \[ X = F^{-1}(U) = c U^{1/a} \quad \text{for } U \in [0, 1] \] **2. Invert \( x = F^{-1}(u) \) to find the CDF \( u = F(x) \):** For \( 0 \le x \le c \): \[ x = c u^{1/a} \implies \frac{x}{c} = u^{1/a} \implies u = F(x) = \frac{x^a}{c^a} \] With \( F(x) = 0 \) for \( x < 0 \) and \( F(x) = 1 \) for \( x > c \), this matches Option A. **Answer: A — \( F(x) = \frac{x^a}{c^a} \) for \( 0 \le x \le c \).** A: **Correct:** Solving \( x = c u^{1/a} \) for \( u \) gives \( F(x) = x^a / c^a \) on \( 0 \le x \le c \). B: **Incorrect:** \( x^{1/a}/c \) fails to invert the power \( 1/a \). C: **Incorrect:** \( (x/c)^{1/a} \) is the forward formula \( F^{-1} \) rather than its inverse. D: **Incorrect:** \( c x^a \) multiplies by \( c \) instead of dividing by \( c^a \).

Report a correction for Q8

Question 9 MSQ · 2.0 marks

Below code snippet implements an inverse transform method. Study the code carefully and answer the given subquestions.
Source diagram or notation
Source diagram or notation
Source diagram or notation
Based on the inverse CDF plot and the histogram of generated samples, select all correct statements.
6406536376457.
The density of
Source diagram or notation
increases as
Source diagram or notation
increases.
6406536376458.
The inverse CDF plot indicates that values near 0 on the horizontal axis produce small values of
Source diagram or notation
.
6406536376459.
The distribution of
Source diagram or notation
is left skewed.
6406536376460.
The distribution of
Source diagram or notation
is right skewed.

Published solution

**1. Analyze the PDF and plots for \( a = 5, c = 10 \):** Differentiating \( F(x) = (x / 10)^5 \) on \( [0, 10] \) gives the PDF: \[ f(x) = F'(x) = \frac{5 x^4}{10^5}, \quad 0 \le x \le 10 \] **2. Check each statement:** - **Option A:** Since \( f(x) \propto x^4 \) for \( x \in [0, 10] \), the density of \( X \) strictly increases as \( x \) increases (also visible from the histogram bars growing taller toward \( x = 10 \)). True. - **Option B:** On the inverse CDF plot \( x = 10 u^{1/5} \), when \( u \) on the horizontal axis is near \( 0 \), \( x \) is also near \( 0 \) (small values of \( X \)). True. - **Option C & D:** Because the bulk of the probability mass is concentrated near the right boundary \( x = 10 \) with a long tail stretching toward \( 0 \) on the left, the distribution is **left-skewed** (negatively skewed). Thus **Option C is true** and **Option D is false**. **Answer: A, B, and C.** A: **Correct:** Both the histogram and the derivative \( f(x) = 5x^4 / 10^5 \) show that the density increases with \( x \). B: **Correct:** Near \( u = 0 \) on the horizontal axis, \( F^{-1}(u) = 10 u^{1/5} \) is near \( 0 \). C: **Correct:** The histogram has a long left tail toward 0 and peaks at 10, which is a left-skewed distribution. D: **Incorrect:** The tail is on the left, not the right.

Report a correction for Q9

Question 10 NAT · 2.0 marks

Below code snippet implements an inverse transform method. Study the code carefully and answer the given subquestions.
Source diagram or notation
Source diagram or notation
Source diagram or notation
If
Source diagram or notation
, then compute the value of
Source diagram or notation
. Enter the answer correct to one decimal place.

Published solution

**1. Set up the inverse CDF formula from the code:** From the code snippet, \( a = 5 \), \( c = 10 \), and: \[ X = c \cdot U^{1/a} = 10 \cdot U^{1/5} \] **2. Substitute \( U = 0.243 \):** Notice that \( 0.243 = \frac{243}{1000} = \frac{3^5}{10^3} \), or directly: \[ (0.243)^{0.2} \approx 0.75355 \] Multiplying by \( c = 10 \): \[ X = 10 \times 0.75355 = 7.5355 \approx 7.5 \] (Note: if \( U = 0.243 \) was intended alongside \( 3/4 = 0.75 \) from \( 0.243 \approx (0.75)^5 = 0.2373 \), both give \( 7.5 \) to one decimal place!) **Answer: 7.5.**

Report a correction for Q10

Question 11 MCQ · 3.0 marks

Suppose that we want to simulate a discrete random variable
Source diagram or notation
using a mixture of two discrete random variables
Source diagram or notation
and
Source diagram or notation
. Consider the simulation procedure as follows:
Source diagram or notation
The probability mass functions of
Source diagram or notation
and
Source diagram or notation
are given by:
Source diagram or notation
and
Source diagram or notation
Based on the above data, answer the given subquestions.
Identify the correct PMF of
Source diagram or notation
in terms of
Source diagram or notation
and
Source diagram or notation
.
6406536376462.Source diagram or notation
6406536376463.Source diagram or notation
6406536376464.Source diagram or notation
6406536376465.Source diagram or notation

Published solution

**1. Analyze the mixture simulation procedure:** The algorithm draws \( U \sim \text{Uniform}(0, 1) \) and sets: - \( X = X_1 \) if \( U < 0.6 \) (which occurs with probability \( 0.6 \)) - \( X = X_2 \) otherwise (which occurs with probability \( 1 - 0.6 = 0.4 \)) **2. Apply the Law of Total Probability:** \[ P(X = k) = P(U < 0.6) P(X_1 = k) + P(U \ge 0.6) P(X_2 = k) = 0.6 p_k^{(1)} + 0.4 p_k^{(2)} \] **Answer: D — \( P(X = k) = 0.6 p_k^{(1)} + 0.4 p_k^{(2)} \).** A: **Incorrect:** Swaps the mixture weights \( 0.6 \) and \( 0.4 \). B: **Incorrect:** Multiplies the PMFs instead of taking their convex combination. C: **Incorrect:** Sums the unweighted PMFs (which would sum to 2 instead of 1). D: **Correct:** By the law of total probability, \( P(X = k) = 0.6 p_k^{(1)} + 0.4 p_k^{(2)} \).

Report a correction for Q11

Question 12 NAT · 2.0 marks

Suppose that we want to simulate a discrete random variable
Source diagram or notation
using a mixture of two discrete random variables
Source diagram or notation
and
Source diagram or notation
. Consider the simulation procedure as follows:
Source diagram or notation
The probability mass functions of
Source diagram or notation
and
Source diagram or notation
are given by:
Source diagram or notation
and
Source diagram or notation
Based on the above data, answer the given subquestions.
Find the value of
Source diagram or notation
. Enter the answer correct to two decimal places.

Published solution

**1. Read \( p_4^{(1)} \) and \( p_4^{(2)} \) from the given PMFs:** - From the distribution of \( X_1 \) on \( \{1, 2, 3, 4\} \): \( p_4^{(1)} = P(X_1 = 4) = 0.3 \) - From the distribution of \( X_2 \) on \( \{2, 3, 4, 5\} \): \( p_4^{(2)} = P(X_2 = 4) = 0.2 \) **2. Substitute into the mixture PMF formula:** \[ P(X = 4) = 0.6 p_4^{(1)} + 0.4 p_4^{(2)} = 0.6(0.3) + 0.4(0.2) = 0.18 + 0.08 = 0.26 \] **Answer: 0.26.**

Report a correction for Q12

Question 13 MCQ · 1.0 marks

Suppose that we want to simulate a discrete random variable
Source diagram or notation
using a mixture of two discrete random variables
Source diagram or notation
and
Source diagram or notation
. Consider the simulation procedure as follows:
Source diagram or notation
The probability mass functions of
Source diagram or notation
and
Source diagram or notation
are given by:
Source diagram or notation
and
Source diagram or notation
Based on the above data, answer the given subquestions.
Can we say
Source diagram or notation
6406536376467.
Yes
6406536376468.
No

Published solution

**1. Check the support of \( X_1 \) and \( X_2 \):** - \( X_1 \) takes values only in \( \{1, 2, 3, 4\} \), so \( P(X_1 = 6) = 0 \). - \( X_2 \) takes values only in \( \{2, 3, 4, 5\} \), so \( P(X_2 = 6) = 0 \). **2. Compute \( P(X = 6) \):** \[ P(X = 6) = 0.6 P(X_1 = 6) + 0.4 P(X_2 = 6) = 0.6(0) + 0.4(0) = 0 \] Therefore, \( P(X = 6) > 0 \) is false (**No**). **Answer: B — No.** A: **Incorrect:** Neither \( X_1 \) nor \( X_2 \) can take the value 6, so \( P(X = 6) = 0 \). B: **Correct:** Since \( 6 \) is outside the support \( \{1, 2, 3, 4, 5\} \) of both component distributions, \( P(X = 6) = 0 \).

Report a correction for Q13

Question 14 NAT · 3.0 marks

Suppose we want to obtain samples from a distribution with pdf
Source diagram or notation
by using the accept-reject method. Find the probability of acceptance for
Source diagram or notation
as a proposal distribution. Enter the answer correct to two decimal places.

Published solution

**1. Set up the Accept-Reject bound \( M \):** The target density is \( f(x) = 12 x^2 (1 - x) \) for \( x \in (0, 1) \), and the proposal density is \( g(x) = 1 \) (\( \text{Uniform}(0, 1) \)). The optimal envelope constant \( M \) is: \[ M = \sup_{x \in (0, 1)} \frac{f(x)}{g(x)} = \sup_{x \in (0, 1)} 12(x^2 - x^3) \] **2. Maximize \( f(x) \) on \( (0, 1) \):** Set the derivative \( f'(x) = 0 \): \[ f'(x) = 12(2x - 3x^2) = 12x(2 - 3x) = 0 \implies x = \frac{2}{3} \] Evaluate \( M = f(2/3) \): \[ M = 12 \left(\frac{2}{3}\right)^2 \left(1 - \frac{2}{3}\right) = 12 \times \frac{4}{9} \times \frac{1}{3} = \frac{16}{9} \] **3. Compute the probability of acceptance:** \[ P(\text{Acceptance}) = \frac{1}{M} = \frac{9}{16} = 0.5625 \approx 0.56 \] **Answer: 0.56.**

Report a correction for Q14