Skip to content

Commit

Permalink
added 2019 winter midterm
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnLu2004 committed Jul 18, 2024
1 parent c51c4c0 commit 48352ca
Show file tree
Hide file tree
Showing 24 changed files with 139 additions and 32 deletions.
2 changes: 2 additions & 0 deletions src/content/questions/comp2804/2019-fall-final/1/solution.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
We choose 5 of the 85 positions to be c: $ \binom{85}{5} $

The remaining 80 positions can be any of the 3 letters: $ 3^{80} $

Thus, the total number of strings is $ \binom{85}{5} \cdot 3^{80} $
2 changes: 2 additions & 0 deletions src/content/questions/comp2804/2019-fall-final/10/solution.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Let's just draw the tree, man

Warning: Do Later

In total, O Canada is sung 8 times.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
The remaining 8 each have 3 possible incorrect answers: $ 3^{8} $ <br/>
$ |A| = \binom{25}{17} \cdot 3^{8} $
</ul>
$ Pr(A) = \frac{|A|}{|S|} $

$ Pr(A) = \frac{|A|}{|S|} $

$ Pr(A) = \frac{\binom{25}{17} \cdot 3^{8}}{4^{25}} $

$ Pr(A) = \binom{25}{17} \cdot {( \frac{3}{4})}^8 \cdot {( \frac{1}{4})}^{17} $
13 changes: 9 additions & 4 deletions src/content/questions/comp2804/2019-fall-final/12/solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ I've been playing an MMO RPG called Orna recently. It uses GPS and forces me to
$ |A \cap B| = 1 $ <br/>
$ Pr(A \cap B) = \frac{1}{32} $
</ul>
Now, let's check whether it's independent
$ Pr(A \cap B) = Pr(A) \cdot Pr(B) $
$ \frac{1}{32} = \frac{1}{4} \cdot \frac{1}{8} $
$ \frac{1}{32} = \frac{1}{32} $

Now, let's check whether it's independent

$ Pr(A \cap B) = Pr(A) \cdot Pr(B) $

$ \frac{1}{32} = \frac{1}{4} \cdot \frac{1}{8} $

$ \frac{1}{32} = \frac{1}{32} $

BOOM. THE RESULTS SPEAK FOR THEMSELVES. HAPPY INDEPENDENCE DAY. MURICAAAA
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
We can choose 2 of the red balls: $ \binom{4}{2} $ <br/>
$ |A \cap B| = \binom{4}{2} = 6 $
</ul>

Now, let God do the rest
$ Pr(A|B) = \frac{|A \cap B|}{|B|} = $

$ Pr(A|B) = \frac{|A \cap B|}{|B|} = $

$ Pr(A|B) = \frac{ \binom{5}{2} + \binom{4}{2} }{ \binom{4}{2} } $
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
There is only 1 number that is both even and divisible by 3, which is 6: 1 <br/>
$ |A \cap B| = 1 $
</ul>
I enjoy Jujutsu Kaisen and Donal/Joe/Obama AI voice skits

I enjoy Jujutsu Kaisen and Donal/Joe/Obama AI voice skits

$ Pr(A|B) = \frac{|A \cap B|}{|B|} = \frac{1}{3} $
16 changes: 11 additions & 5 deletions src/content/questions/comp2804/2019-fall-final/17/solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@
$ |A \cap B| = 2 $ <br/>
$ Pr(A \cap B) = \frac{2}{10} = \frac{1}{5} $
</ul>
Avatar: The Last Airbender is pretty high tier
Let's check for independence
$ Pr(A \cap B) = Pr(A) \cdot Pr(B) $
$ \frac{1}{5} = \frac{1}{2} \cdot \frac{1}{2} $
$ \frac{1}{5} = \frac{1}{4} $

Avatar: The Last Airbender is pretty high tier

Let's check for independence

$ Pr(A \cap B) = Pr(A) \cdot Pr(B) $

$ \frac{1}{5} = \frac{1}{2} \cdot \frac{1}{2} $

$ \frac{1}{5} = \frac{1}{4} $

The equation is not false; therefore, they're dependent
16 changes: 11 additions & 5 deletions src/content/questions/comp2804/2019-fall-final/18/solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@
$ |A \cap B| = 3 $ <br/>
$ Pr(A \cap B) = \frac{3}{10} $
</ul>
Caedrel is the best rat
Let's check for independence
$ Pr(A \cap B) = Pr(A) \cdot Pr(B) $
$ \frac{3}{10} = \frac{1}{2} \cdot \frac{3}{5} $
$ \frac{3}{10} = \frac{3}{10} $

Caedrel is the best rat

Let's check for independence

$ Pr(A \cap B) = Pr(A) \cdot Pr(B) $

$ \frac{3}{10} = \frac{1}{2} \cdot \frac{3}{5} $

$ \frac{3}{10} = \frac{3}{10} $

Therefore, it is independent
3 changes: 3 additions & 0 deletions src/content/questions/comp2804/2019-fall-final/2/solution.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
We choose 15 of the 85 positions to be a: $ \binom{85}{15} $

We choose 30 of the 70 remaining positions to be d: $ \binom{70}{30} $

The remaining 40 positions can be any of the 2 letters: $ 2^{40} $

Thus, the total number of strings is $ \binom{85}{15} \cdot \binom{70}{30} \cdot 2^{40} $
9 changes: 9 additions & 0 deletions src/content/questions/comp2804/2019-fall-final/20/solution.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
Let $X_1$ be the amount of dollars you win if the first coin comes up tails: $-1$

There's a 50/50 chance of it landing tails

$ Pr(X_1 = -1) = \frac{1}{2} $

Let $X_2$ be the amount of dollars you win if the second coin comes up heads: $2$

There's a 50/50 chance of it landing heads

$ Pr(X_2 = 2) = \frac{1}{2} $

$ E(X) = (-1) \cdot Pr(X_1 = -1) + 2 \cdot Pr(X_2 = 2) $

$ E(X) = (-1) \cdot \frac{1}{2} + 2 \cdot \frac{1}{2} $

$ E(X) = -\frac{1}{2} + 1 $

$ E(X) = \frac{1}{2} $
22 changes: 15 additions & 7 deletions src/content/questions/comp2804/2019-fall-final/24/solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@ Let $X_i$ be 1 if the students at positions $i$ and $2i$ are politically correct
$ Pr (X_i=1 ) = \frac{ 1 }{ 1 } \cdot \frac{k \cdot (k-1) \cdot 1 }{n \cdot (n-1) } $ <br/>
$ Pr (X_i=1 ) = \frac{k \cdot (k-1) }{n \cdot (n-1) } $
</ul>
Well, $S_n$ corresponds to $S*{ \frac{n}{2} }$
$S_{n-2}$ corresponds to $S_{ \frac{n}{2}-1}$
$S_{n-4}$ corresponds to $S_{ \frac{n}{2}-2}$
Half of everyone has a corresponding junior
$ E(X) = \sum*{i=1}^{n/2} Pr(X_i=1) $
$ E(X) = \sum*{i=1}^{n/2} \frac{k \cdot (k-1) }{n \cdot (n-1) } $
$ E(X) = \frac{k (k-1) }{n (n-1) } \cdot \frac{n}{2} $

Well, $S_n$ corresponds to $S*{ \frac{n}{2} }$

$S_{n-2}$ corresponds to $S_{ \frac{n}{2}-1}$

$S_{n-4}$ corresponds to $S_{ \frac{n}{2}-2}$

Half of everyone has a corresponding junior

$ E(X) = \sum\*{i=1}^{n/2} Pr(X_i=1) $

$ E(X) = \sum\*{i=1}^{n/2} \frac{k \cdot (k-1) }{n \cdot (n-1) } $

$ E(X) = \frac{k (k-1) }{n (n-1) } \cdot \frac{n}{2} $

IT'S OVER. THE PAIN. THE SUFFERING. THE NIGHTMARES.
3 changes: 3 additions & 0 deletions src/content/questions/comp2804/2019-fall-final/7/solution.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Yeah, so this is the dividers method. Let's define some stuff I guess

Let $x_1, x_2, x_3, x_4, x_5, x_6, x_7$ be the number of bananas Nick eats on each day

Now, $x_1 + x_2 + x_3 + x_4 + x_5 + x_6 + x_7 = 25$

Assuming you have a sea of bananas, let's put dividers to split them off into different days

<ul>
Expand Down
4 changes: 4 additions & 0 deletions src/content/questions/comp2804/2019-fall-final/9/solution.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Warning: I suck at these questions. Here goes nothing

Possibilities:

$0, S_{n-1}$

$1,0, S_{n-2}$

IDK MAN
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
There are 2 choices for the odd positions: 0 or 1.

There are 6 even positions that can each be 0 or 1, so there are $ 2^6 $ ways to choose the characters for the even positions.

Thus, there are $ 2 \cdot 2^6 =2 \cdot 64 = 128 $ such bitstrings.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Because there is a 0 at position 59, there must be a 1 at position 58 and 60 to avoid a 00.

It looks something like this: ..., 1, 0, 1, ..., 1, ...
The number of 00-free bitstrings made from the first 57 bits $ \text{bit positions 1 to 57} $ is $ f*{57+2} $.
The number of 00-free bitstrings made from the 17 bits $ \text{bit positions 61 to 77} $ is $ f*{17+2} $.

The number of 00-free bitstrings made from the first 57 bits $ \text{bit positions 1 to 57} $ is $ f\*{57+2} $.

The number of 00-free bitstrings made from the 17 bits $ \text{bit positions 61 to 77} $ is $ f\*{17+2} $.

Thus, the number of 00-free bitstrings with the above conditions is $ f*{59} \cdot f*{19} $.
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
If $ (a) $ is true, then it would not be recursive

$ (b) $ is pretty much what a recurisve function is
21 changes: 15 additions & 6 deletions src/content/questions/comp2804/2019-winter-midterm/15/solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@
<li> Guinness Extra Stout,
<li> Magners Original Irish Cider.
</ul>
There is an unlimited supply for each of these types.
There are 75 students at the party, and each of them gets one drink, which is chosen uniformly at random from these three types.

There is an unlimited supply for each of these types.

There are 75 students at the party, and each of them gets one drink, which is chosen uniformly at random from these three types.

Let be the event $ A = \text{\enquote{exactly 50 students get Magners Original Irish Cider}.} $

What is Pr $ (A) $?
We need to choose 50 students to get Magners Original Irish Cider from the 75 students: $ \binom{75}{50} $
For each of the 50 students, there is a $ \frac{1}{3} $ chance of getting Magners Original Irish Cider: $ {( \frac{1}{3})}^{50} $
For each of the 25 students, there is a $ \frac{2}{3} $ chance of not getting Magners Original Irish Cider: $ {( \frac{2}{3})}^{25} $
Pr $ (A) = \binom{75}{50} \cdot {( \frac{1}{3})}^{50} \cdot {( \frac{2}{3})}^{25} $

We need to choose 50 students to get Magners Original Irish Cider from the 75 students: $ \binom{75}{50} $

For each of the 50 students, there is a $ \frac{1}{3} $ chance of getting Magners Original Irish Cider: $ {( \frac{1}{3})}^{50} $

For each of the 25 students, there is a $ \frac{2}{3} $ chance of not getting Magners Original Irish Cider: $ {( \frac{2}{3})}^{25} $

Pr $ (A) = \binom{75}{50} \cdot {( \frac{1}{3})}^{50} \cdot {( \frac{2}{3})}^{25} $

Pr $ (A) = \frac{ \binom{75}{50} \cdot 2^{25}}{3^{75}} $
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
A = Permutations that contain $ bge $

We can treat $ bge $ as a single entity.

B = Permutations that do not contain $ bge $

So there's $ bge, a,c,d,f $ which is 5 entities.

$ |B| = 5! $

$ |S| = $ Total permutations without restrictions

$ |S| = 7! $

$ |\text{Number of permutations that do not contain} bge| = |S| - |B| $

$ |\text{Number of permutations that do not contain} bge| = 7! - 5! $
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
A = Strings that contain at least one lowercase letter

$ \overline{A} = $ Strings that contain no lowercase letters

$ |\overline{A}| = 26^{15} $

B = Strings that contain at least one uppercase letter

$ \overline{B} = $ Strings that contain no uppercase letters

$ |\overline{B}| = 26^{15} $

$ |A \cap B| = \text{All Possibilities} - |\overline{A}| - |\overline{B}| $

$ |A \cap B| = 52^{15} - 26^{15} - 26^{15} $

$ |A \cap B| = 52^{15} - 2 \cdot 26^{15} $
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
$ \text{All Possibilities} - \text{0 even numbers} - \text{1 even number} $

$ \binom{n}{k} - \binom{n/2}{k} - \binom{n/2}{k-1} $
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
A = Like beer

$ |A| = 37 $

B = Like cider

$ |B| = 18 $

$ |\overline{A \cup B}| = 55 $

$ |A \cup B| = 100-55 $

$ |A \cup B| = 45 $

$ |A \cap B| = |A| + |B| - |A \cup B| $

$ |A \cap B| = 37 + 18 - 45 $

$ |A \cap B| = 10 $
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
We can use the pigeonhole principle to solve this problem.

We need to have 1 more than the maximum number of possible grades.

That way, we can guarantee that if all students receive different grades, the last student will receive a duplicate grade.

There are 5 possible grades: $ A, B, C, D, F $

Thus, the minimum value for $ n $ is $ 5 \cdot 3 + 1 $

Thus, the minimum value for $ n $ is 16.
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
We can treat the largest element as a fixed element.

We need to choose 16 other elements from the remaining 29 elements that are smaller than 30: $ \binom{29}{16} $
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
There are $ n/2 $ even positions.

We need to choose $ k $ of these positions to be $ a $'s: $ \binom{n/2}{k} $

The remaining $ n - k $ positions must be $ b $'s or $ c $'s: $ 2^{n-k} $

Thus, there are $ \binom{n/2}{k} \cdot 2^{n-k} $ such strings.

0 comments on commit 48352ca

Please sign in to comment.