CS109 Course Feedback Process
- 21Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is a probability mass function (PMF) of a random variable?
What is a probability mass function (PMF) of a random variable?
21 questions
- 1
What is a probability mass function (PMF) of a random variable?
- A
A function that gives the cumulative probability up to a value
- B
A function that maps each possible value of the random variable to its probability
- C
A function that computes the expected value of the random variable
- D
A function that determines the variance of the random variable
Correct answer
BA function that maps each possible value of the random variable to its probability
Explanation
The PMF assigns probabilities to each value that a discrete random variable can take. It is the fundamental description of the random variable's distribution.
- A
- 2
How is the expectation of a random variable X defined?
- A
E[X]=∑xx2P(X=x)
- B
E[X]=∑x(x−μ)2P(X=x)
- C
E[X]=∑xx⋅P(X=x)
- D
E[X]=∑xP(X=x)
Correct answer
CE[X]=∑xx⋅P(X=x)
Explanation
Expectation is the weighted average of possible values, weighted by their probabilities: E[X]=∑xx⋅P(X=x).
- A
- 3
What does the law of linearity of expectation state?
- A
For any random variable X, E[aX+b]=aE[X]+b
- B
Both A and C are correct
- C
For any random variables X and Y, E[X+Y]=E[X]+E[Y]
- D
For any random variables X and Y, E[XY]=E[X]E[Y]
Correct answer
BBoth A and C are correct
Explanation
Linearity of expectation includes both additivity (E[X+Y]=E[X]+E[Y]) and scalar multiplication (E[aX+b]=aE[X]+b). It holds regardless of dependence.
- A
- 4
What is the Law of the Unconscious Statistician (LOTUS)?
- A
For any function g, E[g(X)]=g(E[X])
- B
For a function g, E[g(X)]=∑xg(x)P(X=x)
- C
For any linear function g, E[g(X)]=g(E[X])
- D
For a function g, E[g(X)]=∑xx⋅P(g(X)=x)
Correct answer
BFor a function g, E[g(X)]=∑xg(x)P(X=x)
Explanation
LOTUS states that the expectation of a function of a random variable is the weighted average of the function values, using the original PMF.
- A
- 5
Given a dataset of values, how can you estimate the expectation?
- A
By taking the mode of all the values
- B
By taking the median of all the values
- C
By taking the sum of all the values
- D
By taking the average of all the values
Correct answer
DBy taking the average of all the values
Explanation
The expectation is approximated by the sample average: n1∑xi. This follows from the definition of probability as relative frequency.
- A
- 6
Which of the following scenarios describes a binomial random variable?
- A
Number of defective items in a sample of size n drawn without replacement
- B
Number of successes until the first failure in independent trials
- C
Number of heads in 10 independent coin flips
- D
Time until the first success in a sequence of independent trials
Correct answer
CNumber of heads in 10 independent coin flips
Explanation
A binomial random variable counts the number of successes in a fixed number n of independent Bernoulli trials, each with success probability p. Coin flips with a fixed number are a classic example.
- A
- 7
What are the parameters of a binomial distribution?
- A
n (number of trials) and k (number of successes)
- B
n (number of trials) and p (probability of success)
- C
μ (mean) and σ2 (variance)
- D
k (number of successes) and p (probability of success)
Correct answer
Bn (number of trials) and p (probability of success)
Explanation
A binomial random variable is defined by n, the number of independent trials, and p, the probability of success on each trial.
- A
- 8
What is the probability mass function of a binomial random variable X∼Bin(n,p)?
- A
P(X=k)=k!(n−k)!n!pk(1−p)k
- B
P(X=k)=(kn)pn−k(1−p)k
- C
P(X=k)=(kn)pk(1−p)n−k
- D
P(X=k)=(kn)pk(1−p)k
Correct answer
CP(X=k)=(kn)pk(1−p)n−k
Explanation
The PMF is P(X=k)=(kn)pk(1−p)n−k, where k successes occur in n trials.
- A
- 9
If X∼Bin(1000,0.01), what Python code computes P(X=10)?
- A
stats.binom.pmf(10, 1000, 0.01) - B
stats.binom.pmf(1000, 10, 0.01) - C
stats.binom.cdf(10, 1000, 0.01) - D
stats.binom.pmf(10, 0.01, 1000)
Correct answer
Astats.binom.pmf(10, 1000, 0.01)Explanation
The function
stats.binom.pmf(k, n, p)returns the probability of exactly k successes. The order is k, then n, then p. - A
- 10
How do you compute the probability that a binomial random variable X is less than 10, given n=1000 and p=0.01?
- A
Use binom.pmf(10,1000,0.01)
- B
Sum binom.pmf(k,1000,0.01) for k=0 to 9
- C
Use binom.cdf(10,1000,0.01)
- D
Sum binom.pmf(k,1000,0.01) for k=0 to 10
Correct answer
BSum binom.pmf(k,1000,0.01) for k=0 to 9
Explanation
Since the events X=k are mutually exclusive, P(X<10)=∑k=09P(X=k). The CDF (option 2) gives P(X≤10), which is not strictly less than 10.
- A
- 11
What is the expectation of a binomial random variable X∼Bin(n,p)?
- A
np(1−p)
- B
np
- C
n(1−p)
- D
p
Correct answer
Bnp
Explanation
The expectation of a binomial is E[X]=np, which can be derived by writing X as a sum of Bernoulli random variables and using linearity of expectation.
- A
- 12
What is a Bernoulli random variable?
- A
A random variable that takes value 1 with probability p and 0 with probability 1−p
- B
A random variable that takes any integer value with equal probability
- C
A random variable that models the time between events
- D
A random variable that counts the number of successes in n trials
Correct answer
AA random variable that takes value 1 with probability p and 0 with probability 1−p
Explanation
A Bernoulli random variable is a special case of binomial with n=1. It represents a single trial with success probability p.
- A
- 13
How is a binomial random variable related to Bernoulli random variables?
- A
A binomial is the product of n independent Bernoulli random variables
- B
A binomial and Bernoulli are unrelated
- C
A binomial is the sum of n independent and identically distributed Bernoulli random variables
- D
A Bernoulli is the sum of n independent binomial random variables
Correct answer
CA binomial is the sum of n independent and identically distributed Bernoulli random variables
Explanation
If Xi∼Ber(p) are i.i.d., then X=∑i=1nXi∼Bin(n,p).
- A
- 14
What is the expectation of a Bernoulli random variable X∼Ber(p)?
- A
0
- B
p
- C
p(1−p)
- D
1−p
Correct answer
Bp
Explanation
Using the definition: E[X]=1⋅p+0⋅(1−p)=p.
- A
- 15
Which of the following is NOT an example of a Bernoulli random variable?
- A
The number of heads in 10 coin flips
- B
Whether a randomly selected voter supports a candidate
- C
Whether a single coin flip lands heads
- D
Whether a single computer crashes
Correct answer
AThe number of heads in 10 coin flips
Explanation
A Bernoulli random variable results from a single trial. The number of heads in 10 flips is a binomial, not Bernoulli.
- A
- 16
What does variance measure in a distribution?
- A
The spread or dispersion of values around the mean
- B
The probability of extreme values
- C
The skewness of the distribution
- D
The central value of the distribution
Correct answer
AThe spread or dispersion of values around the mean
Explanation
Variance quantifies how much the values of a random variable differ from the expectation, on average.
- A
- 17
What is the definition of variance of a random variable X?
- A
Var(X)=E[∣X−μ∣]
- B
Var(X)=E[(X−μ)2] where μ=E[X]
- C
Var(X)=E[X2]−(E[X])2
- D
Var(X)=(E[X])2−E[X2]
Correct answer
BVar(X)=E[(X−μ)2] where μ=E[X]
Explanation
The definition is Var(X)=E[(X−μ)2], the expected squared deviation from the mean. Option D is an equivalent formula derived from this definition.
- A
- 18
Which of the following is an equivalent formula for variance?
- A
Var(X)=E[X2]+(E[X])2
- B
Var(X)=(E[X])2−E[X2]
- C
Var(X)=E[X2]−(E[X])2
- D
Var(X)=E[(X+μ)2]
Correct answer
CVar(X)=E[X2]−(E[X])2
Explanation
Using LOTUS and algebra, Var(X)=E[X2]−(E[X])2, which is often easier to compute.
- A
- 19
How is standard deviation related to variance?
- A
Standard deviation is the same as variance
- B
Standard deviation is the square of variance
- C
Standard deviation is the reciprocal of variance
- D
Standard deviation is the square root of variance
Correct answer
DStandard deviation is the square root of variance
Explanation
Standard deviation σ=Var(X) is in the same units as the original random variable, unlike variance.
- A
- 20
In the context of the lecture, why is variance important for evaluating peer grading accuracy?
- A
Variance determines the highest grade possible
- B
Variance measures the average grade given
- C
Variance captures how much the grades given by a peer deviate from the true grade
- D
Variance indicates the number of students who grade
Correct answer
CVariance captures how much the grades given by a peer deviate from the true grade
Explanation
Two graders may have the same average (expectation) but different spreads. Variance quantifies the spread, helping to assess accuracy.
- A
- 21
Using LOTUS, how would you compute E[X2] for a discrete random variable X?
- A
E[X2]=∑xx2P(X=x)
- B
E[X2]=(∑xxP(X=x))2
- C
E[X2]=∑xxP(X=x)2
- D
E[X2]=∑x(xP(X=x))2
Correct answer
AE[X2]=∑xx2P(X=x)
Explanation
LOTUS: E[g(X)]=∑xg(x)P(X=x). For g(x)=x2, we get E[X2]=∑xx2P(X=x).
- A

Ask anything
We've read this whole study set, so questions about it get the best answers.