← return to practice.dsc40a.com

**Instructor(s):** Janine Tiefenbruck

This exam was administered in person. Students had **50
minutes** to take this exam.

*Source: Spring 2023 Midterm
2, Problem 1*

A set of chess pieces has 32 pieces.
16 of these are black and 16 of these are white. **In each
color**, the 16 pieces are:

- 8 pawns,
- 2 bishops,
- 2 knights,
- 2 rooks,
- 1 queen, and
- 1 king.

When there are multiple pieces of a given color and type (for
example, 8 white pawns), we will assume
they are **indistinguishable** from one another.

Consider an experiment where each of n people selects one piece from their own set
of 32 chess pieces, uniformly at random. The **result** of
the experiment is a description of the **colors and types**
of the pieces each person selected. For example, if n=3, one possible result is:

Person 1 selected a white knight.

Person 2 selected a black queen.

Person 3 selected a black pawn.

How many results are possible for this experiment with n people?

2^n

6^n

12^n

16^n

32^n

None of the above.

12^n.

The key to solving this problem is the note “When there are multiple
pieces of a given color and type (for example, 8 white pawns), we will assume they are
**indistinguishable** from one another.” This means we
count each type of chess piece for the colors black and white. There are
6 different types of chess pieces:
pawn, bishop, knight, rook, queen, and king. There are 2 possible colors: black and white. This
means there are 6 \cdot 2 = 12 unique
colored types of chess pieces.

There are 12 options for the first person, there are 12 options for the second person, and so on, for n people, so we can write:

12 \cdot 12 \cdot \dots \cdot 12 = 12^n

We see there are 12^n possible results for this experiment because there are n people in this experiment who can each select 12 unique combinations.

*Source: Spring 2023 Midterm
2, Problem 2*

A set of chess pieces has 32 pieces.
16 of these are black and 16 of these are white. **In each
color**, the 16 pieces are:

- 8 pawns,
- 2 bishops,
- 2 knights,
- 2 rooks,
- 1 queen, and
- 1 king.

When there are multiple pieces of a given color and type (for
example, 8 white pawns), we will assume
they are **indistinguishable** from one another.

Suppose you randomly select 2 pieces
from a set of 32 chess pieces,
**without replacement**.

You glance at the pieces just long enough to see that both pieces are white. What is the probability that you have 2 pawns?

\dfrac{8}{16}\cdot\dfrac{7}{15} = \dfrac{7}{30}

We get \dfrac{8}{16} from the fact there are 8 white pawns and 16 white chess pieces. So the chance of first getting a pawn is \dfrac{8}{16}.

Now we assume that we have a white pawn, meaning there are 8-1=7 white pawns left and 16 - 1 = 15 white chess pieces, which means we have a \dfrac{7}{15} chance for getting another white pawn.

From here we simplify the answer by writing:

\dfrac{8 \cdot 7}{16 \cdot 15} = \dfrac{56}{240} = \dfrac{7}{30}

Another way to solve this is by using combinatorics: Note that {8 \choose 2} means “8 choose 2.”

\dfrac{{8 \choose 2}}{16 \choose 2} = \dfrac{\frac{8}{32}\cdot\frac{7}{31}}{\frac{16}{32}\cdot\frac{15}{31}} = \dfrac{7}{30}

True or False: Having two pawns is **independent** of
having two white pieces.

True

False

False.

We know that two probabilities are independent of each other if P(A \cap B) = P(A) \cdot P(B).

- Let P(A) be the probability of getting a white piece twice in a row.
- Let P(B) be the probability of getting a pawn twice in a row.

We can calculate the probability of getting a white piece twice in a row P(A) = \frac{16}{32} \cdot \frac{15}{31} = \frac{15}{62}. We get \frac{16}{32} from the fact there are 16 white pieces out of the 32 total pieces. We get \frac{15}{31} from the fact there are now 15 white pieces out of the 31 pieces left after taking out a white piece.

We can also calculate the probability of getting a pawn twice in a row. Note that the color of the pawn does not matter! P(B) = \frac{16}{32} \cdot \frac{15}{31} = \frac{15}{62}. We get \frac{16}{32} from the fact there are 16 pawns (8 black pawns plus 8 white pawns) out of the 32 total pieces. We get \frac{15}{31} from the fact there are now 15 pawns out of the 31 pieces left after taking out a pawn.

We can now calculate P(A) \cdot P(B): \frac{15}{62} \cdot \frac{15}{62} = \frac{225}{3844}

Recall we calculate P(A \cap B) = P(A) \cdot P(B|A).

We solved for P(B|A) in part A of the problem: \frac{7}{30}. We also already solved for P(A) above: \frac{15}{62}.

\frac{15}{62} \cdot \frac{7}{30} = \frac{7}{124}

We can see that P(A \cap B) \neq P(A) \cdot P(B) because \frac{7}{124} \neq \frac{225}{3844}, so the answer is “False.”

*Source: Spring 2023 Midterm
2, Problem 3*

A set of chess pieces has 32 pieces.
16 of these are black and 16 of these are white. **In each
color**, the 16 pieces are:

- 8 pawns,
- 2 bishops,
- 2 knights,
- 2 rooks,
- 1 queen, and
- 1 king.

When there are multiple pieces of a given color and type (for
example, 8 white pawns), we will assume
they are **indistinguishable** from one another.

In this problem, a **lineup** is a way of arranging
items in a straight line.

A chess player lines up all 16
**white pieces** from the set of chess pieces. How many
different-looking lineups can be created? Remember, some pieces look the
same.

{16 \choose 8} \cdot {8 \choose 2} \cdot {6 \choose 2} \cdot {4 \choose 2} \cdot {2 \choose 1} \cdot {1 \choose 1} = \dfrac{16!}{8!2!2!2!}

Think about the problem this way. You have 16 spots on the line and
for each subgroup of pieces (pawns, bishops, rooks, etc.), you need to
assign spots from the line to place the pieces on that group. For
example, we have 16 spots available in the line, and we want to place
the pawns first. Well, since we have 8 pawns and 16 unique spots on the
line, there are exactly {16 \choose 8}
ways to place the pawns differently. Now, once you place the pawns
you’ll have only 8 remaining spots on the line, so if you wish to place
the 2 bishops now, there are {8 \choose
2} ways to do it. This means that there are {16 \choose 8} \cdot {8 \choose 2} ways of
arranging 8 pawns and 2 bishops. Repeat the process for all subgroups
and you’ll get:

{16 \choose 8} \cdot {8 \choose 2} \cdot {6 \choose 2} \cdot {4 \choose 2} \cdot {2 \choose 1} \cdot {1 \choose 1} = \dfrac{16!}{8!2!2!2!}

A chess player lines up all 16 **pawns** from the set of
chess pieces. How many lineups have white pawns on both ends?

{14 \choose 6} = {14 \choose 8} = \dfrac{14!}{8!6!}

Similarly to 3.1, you know the placement of two pawns, thus you have 14 spots remaining. Then, you only want to place the remaining white pawns. Once you do that, the remaining spaces are for the black pawns. Therefore, the answer is {14 \choose 6}= {14 \choose 8}

A chess player lines up all 16 **pawns** from the set of
chess pieces. Assuming that each different-looking lineup is equally
likely, what is the probability that the lineup has two of the
same-colored pawns on both ends (both black or both white)?

\frac{1}{4}

\frac{1}{2}

\frac{7}{30}

\frac{7}{15}

None of the above.

\frac{7}{15}

For this question you can use your answer for 3.2. We found that there’s {14 \choose 6} = {14 \choose 8} = \dfrac{14!}{8!6!} lines of pawns with only whitepawns in the ends, by the same reasoning there would be another {14 \choose 8} = \dfrac{14!}{8!6!} lines with black pawns at the ends. Then there is 2 \cdot {14 \choose 8} lines with same color pawns at the end, since we know ther are {16 \choose 8} lines in total then we can calculates the answer by \frac{2 \cdot {14 \choose 8}}{{16 \choose 8}}=\frac{7}{15}

Alternatively, As soon as you know the color of the first pawn, you know that there are 15 remaining pawns, from which only 7 are the same color, since each pawn is equally likely to get placed in the last spot you get a probability of \frac{7}{15}

*Source: Spring 2023 Midterm
2, Problem 4*

Suppose that there are three possible experience levels in chess
(beginner, intermediate, advanced). Only **10%** of
beginner players beat Avi at a game of chess, while **50%**
of intermediate players and **80%** of advanced players
do.

Avi signs up to participate in a certain chess tournament called the
Avocado Cup. Aside from Avi, **50%** of the players in the
tournament are beginners, **40%** are intermediate, and
**10%** are advanced.

The tournament proceeds in rounds. In the first round of the
tournament, players are **randomly paired up** for a game
of chess.

What is the probability that Avi wins in the first round of the tournament?

33 \%

50 \%

67 \%

83 \%

None of the above.

67 \%

We know the percentages of players that beat Avi (meaning Avi loses) and the percentages of different types of players inside the Avocado Cup.

We can use the percentage of players that beat Avi to figure out the percentage of times Avi wins by writing 1 - p.

Avi wins against beginners with a likelihood of 1 - 0.1 = 0.9, against intermediate players with a likelihood of 1 - 0.4 = 0.6, and against advanced players with a likelihood of 1 - 0.8 = 0.2.

Now we can multiply the probabilities of Avi winning with their respective probabilities of different players’ types to find the probability Avi that will win in the first round! We can do this because you can imagine we are multiplying the probability Avi wins with the amount of people in the tournament of that level.

\begin{align*} 0.9 \cdot 0.5 &= 0.45 \\ 0.4 \cdot 0.5 &= 0.2 \\ 0.2 \cdot 0.1 &= 0.02 \\ 0.45 + 0.2 + 0.02 &= 0.67 \end{align*}

It turns out that, sadly, Avi loses to his opponent in the first
round. What is the probability that Avi’s opponent is an advanced
player? Choose the **closest answer** among the choices
listed.

15 \%

25 \%

35 \%

45 \%

25 \%

- Let P(A) be the probability of Avi playing against an advanced player
- Let P(B) be the probability of Avi losing a match
- Let P(C) be the probability of Avi playing against an intermediate player
- Let P(D) be the probability of Avi playing against a beginner player

We can use Bayes’ theorem to help us find the probability that Avi lost the match to an advanced player (P(A|B)). Recall Bayes’ theorem is:

P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B)}

We are given the probability that Avi loses the match against an advanced player P(B|A) = 0.8 and the probability of Avi playing against an advanced player P(A) = 0.1.

We can calculate the probability of Avi losing a match P(B) with the law of total probability: P(B) = P(B|A) \cdot P(A) + P(B|C) \cdot P(C) + P(B|D) \cdot P(D)

We know the probability of Avi losing to an intermediate player: P(B|C) = 0.5, the probability of Avi losing to a beginner player: P(B|D) = 0.1, the probability of an intermediate player being the opponent: P(C) = 0.4, and the probability of a beginner player being the opponent: P(D) = 0.5

Plugging in what we know into the law of total probability equation we get: \begin{align*} P(B) &= 0.8 \cdot 0.2 + 0.5 \cdot 0.4 + 0.1 \cdot 0.5 \\ &=0.08 + 0.2 + 0.05 \\ &= 0.33 \end{align*}

Or we can calculate P(B) by using what we know in part A (67 \%). 1 - 0.67 = 0.33.

Back to Bayes’ theorem we have: \begin{align*} P(A|B) &= \frac{0.8 \cdot 0.1}{0.33} \\ &= \frac{0.08}{0.33}\\ &= 0.24 \end{align*}

0.24 is closest to 0.25, so 25 \%.

*Source: Spring 2023 Midterm
2, Problem 5*

You have a large historical dataset of all competitors in past years of the Avocado Cup chess tournament. Each year, hundreds of chess players compete in the tournament, and one person is crowned the winner. For each competitor in each year of the competition’s history, you have information on their

experience level (beginner, intermediate, advanced),

birth month (January through December), and

whether or not they won the tournament that year (yes or no).

Assume that birthdays of competitors are evenly distributed throughout the months.

You want to predict who will win this year’s Avocado Cup. To do so,
you use this historical data to train a Naive Bayes classifier and
classify each competitor as a winner or non-winner, given their
experience level and birth month. Which of the following reasons best
explains **why your classifier is ineffective** in
identifying the winner?

Because it uses a variable (birth month) that likely has nothing to do with a person’s chances of winning the tournament.

Because it uses a variable (experience level) that likely has a strong connection with a person’s chances of winning the tournament.

Because it uses a dataset where there are many more non-winners than winners.

Because it uses a categorical response variable.

Bubble 3: Because it uses a dataset where there are many more non-winners than winners.

Each year there is only one winner, but then hundreds of non-winners! This skews the data and makes it harder to figure out if someone won or lost because of their birthday and level.

*Source: Spring 2023 Midterm
2, Problem 6*

The Avocado Cup is organized into rounds. In each round, players who win advance to the next round, and players who lose are eliminated. Rounds continue on like this until there is a single tournament winner.

Define the following events in the sample space of possible outcomes of the Avocado Cup:

A = Avi loses in the first round.

B = Avi wins the tournament.

C = Avi wins in the first round.

Which of the following statements is true? **Select all that
apply.**

A and B are independent.

A and B are conditionally independent given C.

A, B, and C form a partition of the sample space.

None of the above.

Only bubble 2: A and B are conditionally independent given C.

We know that A and B are not independent because winning or losing the first match could affect if Avi wins the tournament.

It is helpful to think about “if C happens does it affect my knowledge of A and B happening”? If C happens we know that A cannot happen. If A cannot happen then B is independent of A. This means A and B are conditionally independent given C.

Recall a partition is a collection of non-empty, non-overlapping subsets of a sample space. We know that A affects B, which means that this statement cannot be true.

Since the third option is true the answer cannot be “None of the above.”

The events A and B are mutually exclusive, or disjoint. More
generally, for **any** two disjoint events A and B,
show how to express P(\overline{A}|(A \cup
B)) in terms of P(A) and P(B) **only**. For this problem
only, **show your work and justify each step.**

P(\overline{A}|(A \cup B)) = \dfrac{P(B)}{P(A)+P(B)}

There are several correct approaches to this problem. The simplest one comes from using the definition of conditional probability to write:

P(\overline{A}|(A \cup B)) = \dfrac{P(\overline{A}\cap (A \cup B))}{P(A \cup B)} To evaluate the numerator, notice that since A and B are disjoint, any outcome that is not in A but is in the union of A and B (A or B) must be in B. The Venn diagram shown below illustrates this. Therefore, we can simplify this as = \dfrac{P(B)}{P(A \cup B)} and because we know A and B are disjoint, we can use the addition rule to expand the denominator as = \dfrac{P(B)}{P(A)+P(B)}

This is the desired final expression because it uses P(A) and P(B) only.

In the Venn Diagram below, \overline{A} is shaded in yellow, and A \cup B is shaded in blue. Their overlap, \overline{A}\cap (A \cup B), is shaded in green, which is just B.