diff --git a/src/content/questions/comp2804/2014-fall-final/23/question.ts b/src/content/questions/comp2804/2014-fall-final/23/question.ts index 8d872ad8..0c1fcbb3 100644 --- a/src/content/questions/comp2804/2014-fall-final/23/question.ts +++ b/src/content/questions/comp2804/2014-fall-final/23/question.ts @@ -7,14 +7,15 @@ const body = String.raw` Consider the following recursive algorithm $\ThreeHeadsOrThreeTails$, which takes as input a positive integer $k$: -
- $\mathbf{Algorithm}$ $\ThreeHeadsOrThreeTails(k)\mathrm{:}$
- $\text{flip a fair coin three times};$
- $\mathbf{if}\ \text{the result is \(HHH\) or \(TTT\)}$
- $\mathbf{then}\ \mathrm{return}\ k$
- $\mathbf{else}\ \ThreeHeadsOrThreeTails(k + 1)$
- $\mathbf{endif}$ -
+

+ $\mathbf{Algorithm}$ $\ThreeHeadsOrThreeTails(k)$:
+ $\quad \text{flip a fair coin three times};$
+ $\quad \mathbf{if}\ \text{the result is $HHH$ or $TTT$}$
+ $\quad \quad \mathbf{then}\ \mathrm{return}\ k$
+ $\quad \mathbf{else}$
+ $\quad \quad \ThreeHeadsOrThreeTails(k + 1)$
+ $\quad \mathbf{endif}$ +

You run algorithm $\ThreeHeadsOrThreeTails(1)$, i.e., with $k = 1$. Define the random variable $X$ to be the value of the output of this algorithm. What is the expected value of $X$? diff --git a/src/content/questions/comp2804/2015-fall-final/25/question.ts b/src/content/questions/comp2804/2015-fall-final/25/question.ts index f60cf5d0..e89904c4 100644 --- a/src/content/questions/comp2804/2015-fall-final/25/question.ts +++ b/src/content/questions/comp2804/2015-fall-final/25/question.ts @@ -1,10 +1,10 @@ import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator"; const body = String.raw` -Who discovered Newton's \binomial Theorem? +Who discovered Newton's Binomial Theorem? `; -const label1 = String.raw`Professor \binomial.`; +const label1 = String.raw`Professor Binomial.`; const label2 = String.raw`Justin Bieber.`; const label3 = String.raw`Isaac Newton.`; const label4 = String.raw`Professor G. Ruesome (the guy teaching COMP 9999).`; diff --git a/src/content/questions/comp2804/2016-fall-midterm/14/question.ts b/src/content/questions/comp2804/2016-fall-midterm/14/question.ts index 3c1295fc..bccbc6c2 100644 --- a/src/content/questions/comp2804/2016-fall-midterm/14/question.ts +++ b/src/content/questions/comp2804/2016-fall-midterm/14/question.ts @@ -8,15 +8,16 @@ const body = String.raw` Consider the following recursive algorithm $\ElisaDrinksCider$, which takes as input an integer $n \geq 1$, which is a power of 2: - +

- $\mathbf{Algorithm}\ \ElisaDrinksCider(n)\mathrm{:}$
- $\mathbf{if}\ n = 1$
- $\mathbf{then}\ \text{order Fibonachos}$
- $\mathbf{else}\ \ElisaDrinksCider(n / 2);$
- $\elsesp \text{drink \(n\) bottles of cider};$
- $\elsesp \ElisaDrinksCider(n / 2)$
- $\mathbf{endif}$ + $\mathbf{Algorithm} \text{ ElisaDrinksCider}(n):$
+ $\quad \mathbf{if}\ n = 1\ \mathbf{then}$
+ $\quad \quad \text{order Fibonachos}$
+ $\quad \mathbf{else}$
+ $\quad \quad \ElisaDrinksCider(n / 2);$
+ $\quad \quad \text{drink n bottles of cider};$
+ $\quad \quad \ElisaDrinksCider(n / 2)$
+ $\quad \mathbf{endif}$

For $n$ a power of 2, let $C(n)$ be the total number of bottles of cider that you drink when running algorithm diff --git a/src/content/questions/comp2804/2017-fall-final/22/question.ts b/src/content/questions/comp2804/2017-fall-final/22/question.ts index d9bfee91..8d2fd206 100644 --- a/src/content/questions/comp2804/2017-fall-final/22/question.ts +++ b/src/content/questions/comp2804/2017-fall-final/22/question.ts @@ -9,32 +9,23 @@ const body = String.raw` Alexa and May want to play the game of Monopoly. They use the following recursive algorithm to decide who goes first: -
- $\mathbf{Algorithm}\ \WhoGoesFirst(k)\mathrm{:}$
- - - - - - - -
$//$ - $k \geq 1,$ $\text{the die is fair},$ $\text{and all rolls are independent}$ -
- $\text{Alexa rolls the die, let \(a\) be the result};$
- $\text{May rolls the die, let \(m\) be the result};$
- $\mathbf{if}\ a > m$
- $\mathbf{then}\ \mathrm{print}\ {\tt Alexa\ goes\ first};$
- $\thensp \mathrm{return}\ k$
- $\mathbf{endif};$
- $\mathbf{if}\ a < m$
- $\mathbf{then}\ \mathrm{print}\ {\tt May\ goes\ first};$
- $\thensp \mathrm{return}\ k$
- $\mathbf{endif};$
- $\mathbf{if}\ a = m$
- $\mathbf{then}\ \WhoGoesFirst(k + 1)$
- $\mathbf{endif}$ -
+

+ $\WhoGoesFirst(k):$
+ $\quad \mathbf{if}\ k \geq 1\ \mathbf{then}$
+ $\quad \quad \text{Alexa rolls the die, let a be the result}$
+ $\quad \quad \text{May rolls the die, let m be the result}$
+ $\quad \quad \mathbf{if}\ a > m\ \mathbf{then}$
+ $\quad \quad \quad \text{print Alexa goes first}$
+ $\quad \quad \quad \mathbf{return}\ k$
+ $\quad \quad \mathbf{endif}$
+ $\quad \quad \mathbf{if}\ a < m\ \mathbf{then}$
+ $\quad \quad \quad \text{print May goes first}$
+ $\quad \quad \quad \mathbf{return}\ k$
+ $\quad \quad \mathbf{endif}$
+ $\quad \quad \mathbf{if}\ a = m\ \mathbf{then}$
+ $\quad \quad \quad \WhoGoesFirst(k + 1)$
+ $\quad \quad \mathbf{endif}$
+

The ladies run algorithm $\WhoGoesFirst(1)$, i.e., with $k = 1$. Define the random variable $X$ to be the value of the output of this algorithm.
diff --git a/src/content/questions/comp2804/2018-winter-final/22/question.ts b/src/content/questions/comp2804/2018-winter-final/22/question.ts index ffcd1484..708cf394 100644 --- a/src/content/questions/comp2804/2018-winter-final/22/question.ts +++ b/src/content/questions/comp2804/2018-winter-final/22/question.ts @@ -8,33 +8,24 @@ const body = String.raw` Alexa and Shelly want to play the game of Monopoly. They use the following recursive algorithm to decide who goes first: - -
- $\mathbf{Algorithm}\ \WhoGoesFirst(k)\mathrm{:}$
- - - - - - - -
$//$ - $k \geq 1,$ $\text{the die is fair},$ $\text{and all rolls are independent}$ -
- $\text{Alexa rolls the die, let \(a\) be the result};$
- $\text{Shelly rolls the die, let \(s\) be the result};$
- $\mathbf{if}\ a > s$
- $\mathbf{then}\ \mathrm{print}\ {\tt Alexa\ goes\ first};$
- $\thensp \mathrm{return}\ k$
- $\mathbf{endif};$
- $\mathbf{if}\ a < s$
- $\mathbf{then}\ \mathrm{print}\ {\tt Shelly\ goes\ first};$
- $\thensp \mathrm{return}\ k$
- $\mathbf{endif};$
- $\mathbf{if}\ a = s$
- $\mathbf{then}\ \WhoGoesFirst(k + 1)$
- $\mathbf{endif}$ -
+ +

+ $\WhoGoesFirst(k):$
+ $\quad \mathbf{if}\ k \geq 1\ \mathbf{then}$
+ $\quad \quad \text{Alexa rolls the die, let a be the result}$
+ $\quad \quad \text{Shelly rolls the die, let s be the result}$
+ $\quad \quad \mathbf{if}\ a > s\ \mathbf{then}$
+ $\quad \quad \quad \text{print Alexa goes first}$
+ $\quad \quad \quad \mathbf{return}\ k$
+ $\quad \quad \mathbf{endif}$
+ $\quad \quad \mathbf{if}\ a < s\ \mathbf{then}$
+ $\quad \quad \quad \text{print Shelly goes first}$
+ $\quad \quad \quad \mathbf{return}\ k$
+ $\quad \quad \mathbf{endif}$
+ $\quad \quad \mathbf{if}\ a = s\ \mathbf{then}$
+ $\quad \quad \quad \WhoGoesFirst(k + 1)$
+ $\quad \quad \mathbf{endif}$
+

The ladies run algorithm $\WhoGoesFirst(1)$, i.e., with $k = 1$. Define the random variable $X$ to be the value of the output of this algorithm.
diff --git a/src/content/questions/comp2804/2018-winter-final/23/question.ts b/src/content/questions/comp2804/2018-winter-final/23/question.ts index 42415235..964cc1b4 100644 --- a/src/content/questions/comp2804/2018-winter-final/23/question.ts +++ b/src/content/questions/comp2804/2018-winter-final/23/question.ts @@ -4,7 +4,7 @@ const body = String.raw` Consider the following statement: For any three random variables $X$, $Y$, and $Z$, Which of the following is correct? diff --git a/src/content/questions/comp2804/2022-winter-final/10/question.ts b/src/content/questions/comp2804/2022-winter-final/10/question.ts index 4e7747ec..bc1c94b6 100644 --- a/src/content/questions/comp2804/2022-winter-final/10/question.ts +++ b/src/content/questions/comp2804/2022-winter-final/10/question.ts @@ -1,6 +1,6 @@ import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator"; -const body = String.raw`The function $T:\N\to\N$ is defined recursively as follows: +const body = String.raw`The function $ T: \mathbb{N} \rightarrow \mathbb{N} $ is defined recursively as follows: \[ T(n) = \begin{cases} diff --git a/src/content/questions/comp2804/2022-winter-final/16/question.ts b/src/content/questions/comp2804/2022-winter-final/16/question.ts index 1e113cb1..a9b2c909 100644 --- a/src/content/questions/comp2804/2022-winter-final/16/question.ts +++ b/src/content/questions/comp2804/2022-winter-final/16/question.ts @@ -1,9 +1,10 @@ import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator"; const body = String.raw`Let $D_1,D_2,D_3$ be the result of rolling a normal $6$-sided die three times. Define the events -$ A = \max\{D_1,D_2,D_3\}=4$ $ -and -$ B = $D_1+D_2+D_3$ is \text{an even number} $ + Which of the following is true?`; const label1 = String.raw`$A$ and $B$ are independent`; diff --git a/src/content/questions/comp2804/2022-winter-final/19/question.ts b/src/content/questions/comp2804/2022-winter-final/19/question.ts index 148d31bd..67896921 100644 --- a/src/content/questions/comp2804/2022-winter-final/19/question.ts +++ b/src/content/questions/comp2804/2022-winter-final/19/question.ts @@ -1,6 +1,6 @@ import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator"; -const body = String.raw`A group of $n\ge 3$ friends stand around in a circle and each friend tosses a coin. If the result of a friend's coin toss is the different from the result of the coin tossed by their left neighbour and different from result of the coin tossed by their right neighbour, then the friend shouts \enquote{Huzzah!} Let $X$ be the number of friends who shout \enquote{Huzzah!}. What is $ E(X)$? `; +const body = String.raw`A group of $n\ge 3$ friends stand around in a circle and each friend tosses a coin. If the result of a friend's coin toss is the different from the result of the coin tossed by their left neighbour and different from result of the coin tossed by their right neighbour, then the friend shouts Huzzah! Let $X$ be the number of friends who shout Huzzah!. What is $ E(X)$? `; const label1 = String.raw`$n/8$`; const label2 = String.raw`$n/4$`; diff --git a/src/content/questions/comp2804/2022-winter-final/23/question.ts b/src/content/questions/comp2804/2022-winter-final/23/question.ts index 8c69d5c3..028c3417 100644 --- a/src/content/questions/comp2804/2022-winter-final/23/question.ts +++ b/src/content/questions/comp2804/2022-winter-final/23/question.ts @@ -1,7 +1,7 @@ import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator"; const body = String.raw`Is the following statement true or false? -For any random variable $X$, $\E(X^2) = \E(X)\cdot \E(X)$.`; +For any random variable $X$, $\mathbb{E}(X^2) = \mathbb{E}(X)\cdot \mathbb{E}(X)$.`; const label1 = String.raw`The statement is true`; const label2 = String.raw`The statement is false`; diff --git a/src/content/questions/comp2804/2022-winter-final/7/question.ts b/src/content/questions/comp2804/2022-winter-final/7/question.ts index 34c4ef4c..9804c224 100644 --- a/src/content/questions/comp2804/2022-winter-final/7/question.ts +++ b/src/content/questions/comp2804/2022-winter-final/7/question.ts @@ -4,7 +4,7 @@ const body = String.raw`A string that is obtained by rearranging the letters of \[ \mathrm{ARABICA} \] -is \emph{stupendous} if it contains the substring $\mathrm{CAB}$. For example $\mathrm{ARA\underline{CAB}I}$ and $\mathrm{I\underline{CAB}AAR}$ are both stupendous, but $\mathrm{ARABICA}$ is not. How many stupendous strings are there?`; +is stupendous if it contains the substring $\mathrm{CAB}$. For example $\mathrm{ARA\underline{CAB}I}$ and $\mathrm{I\underline{CAB}AAR}$ are both stupendous, but $\mathrm{ARABICA}$ is not. How many stupendous strings are there?`; const label1 = String.raw`$70$`; const label2 = String.raw`$60$`;