Winter 2022 Midterm Exam 2

← return to practice.dsc40a.com


Instructor(s): Janine Tiefenbruck

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


Problem 1

Source: Winter 2022 Midterm 2, Problem 1

In the game Stringle, players try to guess a randomly generated string. There is a new Stringle string available each day.

Each day’s Stringle string is a six-letter string, where each letter is chosen uniformly at random, with replacement, from among the 26 letters of the English alphabet. This means Stringle strings can have repeated letters, and they do not need to have any meaning as an English word.

Players input a guess, which can be any six-letter string, and get feedback on their guess, which is given by coloring the letters of the guessed string as follows:

Based on this feedback, they can guess again, an unlimited number of times, until they guess the string correctly, at which point the game is over. Here’s an example of what happens when someone plays Stringle and guesses the string on their fifth guess:

A player’s Stringle score is the number of guesses it took them to guess the word correctly. In the example above, the player’s score is 5.

(1 point) Stringle uses the following color scheme, or assignment of colors to meanings:

Suppose the game developers could have instead used any three colors from the set of seven colors \{red, orange, yellow, green, blue, purple, gray\}, so long as no color has multiple meanings. How many color schemes include the color purple?

90

To solve this problem we need to figure out two thigs. First, we need to get the number of groups of three colors that include purple, and then we need to calculate how many different color schemes can we make with three given colors.

For the first part since we know we are using purple the only thing we need to do then is choose two colors from the remaining 6, and we know there’s {6 \choose 2} way’s to do that. Then given any set of three colors, How many color schemes can we create? To answer this question you can think of the three possible meanings for a color as placesments on a line, thus if you have your three colors on a line, the first one means correct, the second one means incorrect placement for the letter, and the last one means the letter is not on the string, then the question becomes how many lines can you make with three elements, and it should be clear to you thet this is 3!. Therefore the total number of schemes that include purple would be

{6 \choose 2} \cdot 3! = 90


Problem 2

Source: Winter 2022 Midterm 2, Problem 2

Suppose that every day, the Stringle string is chosen without replacement from among the set of all possible valid strings. What is the probability that DSCTEN was the Stringle string for one of the first 100 days after the game’s release?

\dfrac{100}{26^6} = 100\cdot \dfrac{P(26^6-1, 99)}{P(26^6, 100)} = 1 - \dfrac{P(26^6- 1, 100)}{P(26^6, 100)}

Whenever you are thrying to calculated the probability of something happening at least once over a series of repeated trials, it is a very good idea to consider the complement rule because in most cases calculating the probability of something never happening is easier.

Knowing that, let’s calculate the probability of not getting the string DSCTEN in any of the days. Well, the first part would be figuiring out how many possible strings exists, since there’s 26 letters on the English alphabet, it should be clear that the total number of strings is 26^6, now the number of ways we can choose 100 of them withouth chossing DSCTEN is {26^6-1 \choose 100}, and therefore the probability of DSCTEN not being in our selection of 100 strings is \frac{26^6-1 \choose 100}{26^6 \choose 100}. Notice that in this I’m thinking in terms of combinations, but it would be equally valid to think in therms of permutations, and in that case we would do the number of permutations wihtout the string DSCTEN over the total number of permutations (\dfrac{P(26^6- 1, 100)}{P(26^6, 100)}).

Now we only need to use the complement rule, and we’ll get that the answer is 1 - \frac{26^6-1 \choose 100}{26^6 \choose 100} = 1 - \dfrac{P(26^6- 1, 100)}{P(26^6, 100)}

Note: P stands for permutation in this problem


Problem 3

Source: Winter 2022 Midterm 2, Problem 7

Recall in the game Stringle, players try to guess a randomly generated string. There is a new Stringle string available each day.

Each day’s Stringle string is a six-letter string, where each letter is chosen uniformly at random, with replacement, from among the 26 letters of the English alphabet. This means Stringle strings can have repeated letters, and they do not need to have any meaning as an English word.

For this problem, we’ll say that there are six vowels: A, E, I, O, U, and Y. Consider the following three events:

Which of the following is true?

Bubble 1: A and B are independent. A and B are conditionally dependent given C.

We can test if A and B are independent by using the equation: \mathbb{P}(A \cap B) = \mathbb{P}(A) \cdot \mathbb{P}(B).

  • We know \mathbb{P}(A) = \frac{6}{26} because there are six vowels the Stringle string can start with out of 26 letters in the alphabet.
  • We know \mathbb{P}(B) = \frac{13}{26} = \frac{1}{2} because the letters A through M is numbered 1 to 13, so there are 13 possible letters out of 26.
  • We know \mathbb{P}(A \cap B) = \frac{3}{26} because the letters A, E, and I are between A and M and are also vowels out of all 26 letters.

When plugging these values into the equation we get: \begin{align*} \mathbb{P}(A \cap B) &= \mathbb{P}(A) \cdot \mathbb{P}(B) \\ \frac{3}{26} &= \frac{6}{26} \cdot \frac{1}{2} \\ \frac{3}{26} &= \frac{3}{26} \end{align*}

This proves that A and B are independent.

Recall we can test if something is conditionally independent by doing \mathbb{P}(A \cap B|C) = \mathbb{P}(A|C) \cdot \mathbb{P}(B|C).

  • We know there are 25 letters in the alphabet that are not equal to Z.
  • We can calculate \mathbb{P}(A|C) = \frac{6}{25} because there are six vowels out of the 25 non-Z letters.
  • We can calculate \mathbb{P}(B|C) = \frac{13}{25} because there are 13 letters out of the 25 non-Z letters.
  • We can calculate \mathbb{P}(A \cap B|C) = \frac{3}{25} because the letters A, E, and I are between A and M and are also vowels out of 25 non-Z letters.

When plugging these values into the equation we get: \begin{align*} \mathbb{P}(A \cap B|C) &= \mathbb{P}(A|C) \cdot \mathbb{P}(B|C) \\ \frac{3}{25} &= \frac{6}{25} \cdot \frac{13}{25} \\ \frac{3}{25} &\neq \frac{78}{625} \end{align*}

Since \mathbb{P}(A \cap B|C) \neq \mathbb{P}(A|C) \cdot \mathbb{P}(B|C) this means that A and B are conditionally dependent given C.


👋 Feedback: Find an error? Still confused? Have a suggestion? Let us know here.