Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlights solution #17

Merged
merged 6 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Evaluation/Evaluation.astro
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const sortedQuestionData = multipleChoiceQuestionData.sort(
{
sortedQuestionData.map((data: QuestionData, index: number) => (
<div class="Evaluation__question">
<Question question={data.question} index={index} />
<Question question={data.question} index={index} interactive={true} />
{includeLinks && (
<div class="Evaluation__questionLinks">
<a href={`/questions/${data.links.question}`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const letterOptions = ["a", "b", "c", "d", "e"];
class={`MultipleChoiceQuestionOption`}
data-correct={option.correct ? "true" : "false"}
data-selected="false"
data-revealed="false"
data-revealed={interactive ? "false" : "true"}
data-interactive={interactive ? "true" : "false"}
>
<div class="MultipleChoiceQuestionOption__letter">
({letterOptions[optionIndex]})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
}

&:hover {
background-color: #ededed;

&[data-interactive="true"] {
background-color: #ededed;
}
&[data-selected="false"] {
cursor: pointer;
}
Expand Down
17 changes: 9 additions & 8 deletions src/content/questions/comp2804/2014-fall-final/23/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ const body = String.raw`

Consider the following recursive algorithm $\ThreeHeadsOrThreeTails$, which takes as input a positive integer $k$:

<div style="margin: 1rem 0;">
$\mathbf{Algorithm}$ $\ThreeHeadsOrThreeTails(k)\mathrm{:}$ <br>
$\text{flip a fair coin three times};$ <br>
$\mathbf{if}\ \text{the result is \(HHH\) or \(TTT\)}$ <br>
$\mathbf{then}\ \mathrm{return}\ k$ <br>
$\mathbf{else}\ \ThreeHeadsOrThreeTails(k + 1)$ <br>
$\mathbf{endif}$
</div>
<p>
$\mathbf{Algorithm}$ $\ThreeHeadsOrThreeTails(k)$: <br>
$\quad \text{flip a fair coin three times};$ <br>
$\quad \mathbf{if}\ \text{the result is $HHH$ or $TTT$}$ <br>
$\quad \quad \mathbf{then}\ \mathrm{return}\ k$ <br>
$\quad \mathbf{else}$ <br>
$\quad \quad \ThreeHeadsOrThreeTails(k + 1)$ <br>
$\quad \mathbf{endif}$
</p>

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$?
Expand Down
4 changes: 2 additions & 2 deletions src/content/questions/comp2804/2015-fall-final/25/question.ts
Original file line number Diff line number Diff line change
@@ -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).`;
Expand Down
17 changes: 9 additions & 8 deletions src/content/questions/comp2804/2016-fall-midterm/14/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:

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

For $n$ a power of 2, let $C(n)$ be the total number of bottles of cider that you drink when running algorithm
Expand Down
43 changes: 17 additions & 26 deletions src/content/questions/comp2804/2017-fall-final/22/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:

<div style="margin: 1rem 0;">
$\mathbf{Algorithm}\ \WhoGoesFirst(k)\mathrm{:}$ <br>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">$//$</td>
<td>
$k \geq 1,$ $\text{the die is fair},$ $\text{and all rolls are independent}$
</td>
</tr>
</tbody>
</table>
$\text{Alexa rolls the die, let \(a\) be the result};$ <br>
$\text{May rolls the die, let \(m\) be the result};$ <br>
$\mathbf{if}\ a > m$ <br>
$\mathbf{then}\ \mathrm{print}\ {\tt Alexa\ goes\ first};$ <br>
$\thensp \mathrm{return}\ k$ <Br>
$\mathbf{endif};$ <br>
$\mathbf{if}\ a < m$ <br>
$\mathbf{then}\ \mathrm{print}\ {\tt May\ goes\ first};$ <br>
$\thensp \mathrm{return}\ k$ <br>
$\mathbf{endif};$ <br>
$\mathbf{if}\ a = m$ <br>
$\mathbf{then}\ \WhoGoesFirst(k + 1)$ <br>
$\mathbf{endif}$
</div>
<p>
$\WhoGoesFirst(k):$ <br>
$\quad \mathbf{if}\ k \geq 1\ \mathbf{then}$ <br>
$\quad \quad \text{Alexa rolls the die, let a be the result}$ <br>
$\quad \quad \text{May rolls the die, let m be the result}$ <br>
$\quad \quad \mathbf{if}\ a > m\ \mathbf{then}$ <br>
$\quad \quad \quad \text{print Alexa goes first}$ <br>
$\quad \quad \quad \mathbf{return}\ k$ <br>
$\quad \quad \mathbf{endif}$ <br>
$\quad \quad \mathbf{if}\ a < m\ \mathbf{then}$ <br>
$\quad \quad \quad \text{print May goes first}$ <br>
$\quad \quad \quad \mathbf{return}\ k$ <br>
$\quad \quad \mathbf{endif}$ <br>
$\quad \quad \mathbf{if}\ a = m\ \mathbf{then}$ <br>
$\quad \quad \quad \WhoGoesFirst(k + 1)$ <br>
$\quad \quad \mathbf{endif}$ <br>
</p>

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. <br>
Expand Down
45 changes: 18 additions & 27 deletions src/content/questions/comp2804/2018-winter-final/22/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:

<div style="margin: 1rem 0;">
$\mathbf{Algorithm}\ \WhoGoesFirst(k)\mathrm{:}$ <br>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">$//$</td>
<td>
$k \geq 1,$ $\text{the die is fair},$ $\text{and all rolls are independent}$
</td>
</tr>
</tbody>
</table>
$\text{Alexa rolls the die, let \(a\) be the result};$ <br>
$\text{Shelly rolls the die, let \(s\) be the result};$ <br>
$\mathbf{if}\ a > s$ <br>
$\mathbf{then}\ \mathrm{print}\ {\tt Alexa\ goes\ first};$ <br>
$\thensp \mathrm{return}\ k$ <Br>
$\mathbf{endif};$ <br>
$\mathbf{if}\ a < s$ <br>
$\mathbf{then}\ \mathrm{print}\ {\tt Shelly\ goes\ first};$ <br>
$\thensp \mathrm{return}\ k$ <br>
$\mathbf{endif};$ <br>
$\mathbf{if}\ a = s$ <br>
$\mathbf{then}\ \WhoGoesFirst(k + 1)$ <br>
$\mathbf{endif}$
</div>

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

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. <br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const body = String.raw`
Consider the following statement: For any three random variables $X$, $Y$, and $Z$,

<ul>
<li> \mathbb{E}(\min(X,Y,Z)) = $\min(\mathbb{E}(X), \mathbb{E}(Y),$ $\mathbb{E}(Z)).$</li>
<li> $\mathbb{E}(\min(X,Y,Z)) = \min(\mathbb{E}(X), \mathbb{E}(Y), \mathbb{E}(Z))$</li>
</ul>

Which of the following is correct?
Expand Down
Original file line number Diff line number Diff line change
@@ -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}
Expand Down
Original file line number Diff line number Diff line change
@@ -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} $
<ul>
<li>$A = \max\{D_1,D_2,D_3\}=4$
<li>$B = D_1+D_2+D_3$ is an even number
</ul>
Which of the following is true?`;

const label1 = String.raw`$A$ and $B$ are independent`;
Expand Down
Original file line number Diff line number Diff line change
@@ -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$`;
Expand Down
Original file line number Diff line number Diff line change
@@ -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`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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$`;
Expand Down
89 changes: 0 additions & 89 deletions src/content/questions/example/1/index.md

This file was deleted.

40 changes: 36 additions & 4 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,13 +1,45 @@
---
import { getCollection } from "astro:content";
import { default as Layout } from "src/layouts/Content/Content.astro";
import RowCard from "@components/RowCard/RowCard.astro";
const rowCardInfo = [
{
title: "Go through past midterms and finals here!",
icon: "mdi mdi-book-open-variant",
link: "/evaluations/",
},
{
title: "Check out all the courses we currently have here!",
icon: "mdi mdi-school",
link: "/courses",
},
{
title: "Farm through questions based on topic!",
icon: "mdi mdi-tag",
link: "/evaluations",
},
];
---

<Layout title="Carleton Computer Science Question Repository">
<h1>Carleton Computer Science Question Repository</h1>
<div>(coming soon)</div>
<Layout title="Carleton Computer Science Practice Questions Repository">
<h1>Carleton Computer Science Practice Questions Repository</h1>
<div>
Dedicated to my Discrete Math II classmates who couldn't make it to the end
with me
</div>
<br />
<div>
<a href="/evaluations">Evaluations</a>
{
rowCardInfo.map((card) => (
<>
<div>
<a href={card.link}>
<RowCard title={card.title} icon={card.icon} />
</a>
</div>
<br />
</>
))
}
</div>
</Layout>
Loading
Loading