Foundations of CS II

Probability, Statistics, and Algorithms

Practice Midterm 2

Posted by James on February 5, 2012

The following practice midterm is in the same format as the in-class exam will be on Friday.

[Additional note: The real midterm will also have an extra credit problem for those who finish early.]

  1. True/False

    • If B is an event with P(B)=0, then P(A|B) = 0 for any event A.

      False. If P(B)=0, then the conditional probability P(A|B) is undefined.

    • For random variables X and Y, E[X+Y]=E[X]+E[Y] if and only if X and Y are independent.

      False. E[X+Y]=E[X]+E[Y] holds for arbitrary random variables.

    • For any events A, B with P(A)>0 and P(B)>0, we have P(A|B)P(B) = P(B|A)P(A).

      True. Both are equal to P(AB) by the chain rule.

    • If X ~ Bin(5,1/3), then P(X=0)=(1/5)(1/3)=1/15.

      False. P(X=0)=(2/3)^5.

    • If a random variable X is always equal to 1, then Var[X]=0.

      True. In this case, E[X]=X=1, so Var[X]=E[(X-1)^2]=0.

  2. Below is a picture of a network with 6 boosters. Suppose that each booster is active with probability p_i. In order to a signal from A to arrive at B, at least two boosters on some A-B path must be active. What’s the probability that A can signal B?

    \displaystyle (1-p_1)\left[p_2 p_5 + p_3 p_4 - p_2 p_3 p_4 p_5\right]

    \displaystyle + p_1\left[1-(1-p_2)(1-p_3)(1-p_4)(1-p_5)\right]

  3. Suppose that a certain stock goes up $1 with probability 2/3 and down $1 with probability 1/3 each day. The stock price starts at $3. What’s the expected price of the stock after 9 days?

    The expected change for one day is (2/3)(1) + (1/3)(-1) = 1/3. Thus by linearity of expectation, the expected change after 9 days is 9*(1/3)=3. So the expected price after 9 days is $6.

  4. A dance class consists of 22 students, of which 10 are women and 12 are men. If 5 men and 5 women are to be chosen and then paired off, how many results are possible?

    \displaystyle {10 \choose 5} \cdot {12 \choose 5} \cdot 5 \cdot 4 \cdot 3 \cdot 2 \cdot 1.

  5. Suppose that for halloween, everyone gets a brown bag with two pieces of candy. Each piece is chosen randomly to be either chocolate or vanilla (so all possibilities CC, CV, VC, VV are equally likely). You reach into the bag and pull out one of the two candies at random. If you pull out a chocolate candy, what’s the probability that the other candy is vanilla?

    Using Bayes’ Rule:

    \displaystyle P(CV,VC|C) = \frac{P(C|CV,VC) P(CV,VC)}{P(C)}.

    Now, use P(CV,VC)=1/2 and P(C|CV,VC)=1/2, and

    P(C)=P(C|CC) P(CC)+P(C|VV)P(VV) + P(C|CV)P(CV) + P(C|VC)P(VC) = 1/4 + 0 + 1/8 + 1/8 = 1/2.

    Thus P(CV,VC|C) = 1/2.

Leave a comment