Skip to content

Commit

Permalink
Add fall midterms
Browse files Browse the repository at this point in the history
  • Loading branch information
MathyouMB committed Jun 30, 2024
1 parent d38225e commit 54391ee
Show file tree
Hide file tree
Showing 170 changed files with 3,031 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/1/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: N/A
path: comp2804/midterm-fall-2014/1
type: multiple-choice
author: Michiel Smid
question: comp2804/midterm-fall-2014/1/question.ts
tags:
- comp2804
---
21 changes: 21 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/1/question.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`
Let $n \geq 2$ be an integer. How many bitstrings of length $n$ are there that contain at least two
1s?
`;

const label1 = "${n \\choose 2} \\cdot 2^{n-2}$";
const label2 = "$n \\cdot 2^{n-1}$";
const label3 = "$2^{n} - 1 - n$";
const label4 = "$2^{n} - n$";

export const question: MultipleChoiceQuestion = {
body: body,
options: [
{ label: label1, correct: false },
{ label: label2, correct: false },
{ label: label3, correct: true },
{ label: label4, correct: false },
],
};
9 changes: 9 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/10/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: N/A
path: comp2804/midterm-fall-2014/10
type: multiple-choice
author: Michiel Smid
question: comp2804/midterm-fall-2014/10/question.ts
tags:
- comp2804
---
27 changes: 27 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/10/question.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`
The function $f : \mathbb{N} \rightarrow \mathbb{N}$ is defined by
$$
\begin{align}
f(0) &= 8 \\
f(n) &= f(n - 1) + 6n - 8\; \ \mathrm{for}\ n \geq 1
\end{align}
$$
What is $f(n)$?
`;

const label1 = String.raw`$f(n) = 2n^{2} - 5n + 7$`;
const label2 = String.raw`$f(n) = 2n^{2} - 5n + 8$`;
const label3 = String.raw`$f(n) = 3n^{2} - 5n + 8$`;
const label4 = String.raw`$f(n) = 4n^{2} - 5n + 8$`;

export const question: MultipleChoiceQuestion = {
body: body,
options: [
{ label: label1, correct: false },
{ label: label2, correct: false },
{ label: label3, correct: true },
{ label: label4, correct: false },
],
};
9 changes: 9 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/11/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: N/A
path: comp2804/midterm-fall-2014/11
type: multiple-choice
author: Michiel Smid
question: comp2804/midterm-fall-2014/11/question.ts
tags:
- comp2804
---
21 changes: 21 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/11/question.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`
Let $B_n$ be the number of bitstrings of length $n$ that do not contain 1111. Which of the following
is true?
`;

const label1 = String.raw`$B_n = B_{n-1} + B_{n-2} + B_{n-3}$`;
const label2 = String.raw`$B_n = B_{n-1} + B_{n-2} + B_{n-3} + B_{n-4}$`;
const label3 = String.raw`$B_n = 2^{n} - 2^{n-4}$`;
const label4 = String.raw`$B_n = 2^{n} - (n-3) \cdot 2^{n-4}$`;

export const question: MultipleChoiceQuestion = {
body: body,
options: [
{ label: label1, correct: false },
{ label: label2, correct: true },
{ label: label3, correct: false },
{ label: label4, correct: false },
],
};
9 changes: 9 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/12/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: N/A
path: comp2804/midterm-fall-2014/12
type: multiple-choice
author: Michiel Smid
question: comp2804/midterm-fall-2014/12/question.ts
tags:
- comp2804
---
36 changes: 36 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/12/question.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`
<div hidden>
$\newcommand{\Fib}{{\rm F \scriptsize IB}}$
</div>
Consider the following recursive algorithm $\Fib$, which takes as input an
integer $n \geq 0$:
<p>
$\mathbf{Algorithm}\ \Fib(n)\mathrm{:}$ <br>
$\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$ <br>
$\mathbf{then}\ f = n$ <br>
$\mathbf{else}\ f = \Fib(n - 1) + \Fib(n - 2)$ <br>
$\mathbf{endif};$ <br>
$\mathbf{return}\ f$ <br>
</p>
When running $\Fib(9)$, how many calls are there to $\Fib(4)$?
`;

const label1 = String.raw`6`;
const label2 = String.raw`7`;
const label3 = String.raw`8`;
const label4 = String.raw`9`;

export const question: MultipleChoiceQuestion = {
body: body,
options: [
{ label: label1, correct: false },
{ label: label2, correct: false },
{ label: label3, correct: true },
{ label: label4, correct: false },
],
};
9 changes: 9 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/13/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: N/A
path: comp2804/midterm-fall-2014/13
type: multiple-choice
author: Michiel Smid
question: comp2804/midterm-fall-2014/13/question.ts
tags:
- comp2804
---
42 changes: 42 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/13/question.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`
<div hidden>
$\newcommand{\Silly}{{\rm S \scriptsize ILLY}}
\newcommand{\elsesp}{\phantom{\mathbf{else}\ }}$
</div>
Consider the following recursive algorithm $\Silly$, which takes as input an integer $n \geq 1$ which is a power of 2:
<p>
$\mathbf{Algorithm}\ \Silly(n)\mathrm{:}$ <br>
$\mathbf{if}\ n = 1$ <br>
$\mathbf{then}\ \text{drink one pint of beer}$ <br>
$\mathbf{else}\ \mathbf{if}\ n = 2$ <br>
$\elsesp \mathbf{then}\ \text{fart once}$ <br>
$\elsesp \mathbf{else}\ \text{fart once};$ <br>
$\elsesp \elsesp \Silly(n / 2);$ <br>
$\elsesp \elsesp \text{fart once}$ <br>
$\elsesp \mathbf{endif}$ <br>
$\mathbf{endif}$
</p>
For $n$ a power of 2, let $F(n)$ be the number of times you fart when running algorithm $\Silly(n)$.
Which of the following is true? <br>
(n.b., $\log$ denotes the base-2 logarithm)
`;

const label1 = String.raw`$F(n) = \log n\ \mathrm{for}\ n \geq 1.$`;
const label2 = String.raw`$F(n) = 2 \log n\ \mathrm{for}\ n \geq 1.$`;
const label3 = String.raw`$F(n) = (2 \log n) - 1\ \mathrm{for}\ n \geq 1.$`;
const label4 = String.raw`$F(n) = (2 \log n) - 1\ \mathrm{for}\ n \geq 2.$`;

export const question: MultipleChoiceQuestion = {
body: body,
options: [
{ label: label1, correct: false },
{ label: label2, correct: false },
{ label: label3, correct: false },
{ label: label4, correct: true },
],
};
9 changes: 9 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/14/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: N/A
path: comp2804/midterm-fall-2014/14
type: multiple-choice
author: Michiel Smid
question: comp2804/midterm-fall-2014/14/question.ts
tags:
- comp2804
---
21 changes: 21 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/14/question.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`
You flip a fair coin 5 times. What is the probability that the first flip results in heads or the
fifth flip results in heads?
`;

const label1 = String.raw`1/4`;
const label2 = String.raw`1/2`;
const label3 = String.raw`3/4`;
const label4 = String.raw`1`;

export const question: MultipleChoiceQuestion = {
body: body,
options: [
{ label: label1, correct: false },
{ label: label2, correct: false },
{ label: label3, correct: true },
{ label: label4, correct: false },
],
};
9 changes: 9 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/15/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: N/A
path: comp2804/midterm-fall-2014/15
type: multiple-choice
author: Michiel Smid
question: comp2804/midterm-fall-2014/15/question.ts
tags:
- comp2804
---
26 changes: 26 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/15/question.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`
You flip a fair coin 5 times. Define the events
[defs]
A = "the number of heads is odd"
[/defs]
and
[defs]
B = "the number of tails is even".
[/defs]
Which of the following is true?
`;

const label1 = String.raw`$\Pr(A) = \Pr(B)$`;
const label2 = String.raw`$\Pr(A) < \Pr(B)$`;
const label3 = String.raw`$\Pr(A) > \Pr(B)$`;

export const question: MultipleChoiceQuestion = {
body: body,
options: [
{ label: label1, correct: true },
{ label: label2, correct: false },
{ label: label3, correct: false },
],
};
9 changes: 9 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/16/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: N/A
path: comp2804/midterm-fall-2014/16
type: multiple-choice
author: Michiel Smid
question: comp2804/midterm-fall-2014/16/question.ts
tags:
- comp2804
---
21 changes: 21 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/16/question.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`
Consider 10 boxes and 10 balls. We throw each ball, uniformly, in a random box. What is the
probability that, after we have thrown all 10 balls, none of the 10 boxes is empty?
`;

const label1 = String.raw`$\frac{10!}{10^{10}}$`;
const label2 = String.raw`$\frac{10^{10}}{10!}$`;
const label3 = String.raw`$1 - \frac{10 \cdot (9/10)^{10}}{10^{10}}$`;
const label4 = String.raw`None of the above.`;

export const question: MultipleChoiceQuestion = {
body: body,
options: [
{ label: label1, correct: true },
{ label: label2, correct: false },
{ label: label3, correct: false },
{ label: label4, correct: false },
],
};
9 changes: 9 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/17/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: N/A
path: comp2804/midterm-fall-2014/17
type: multiple-choice
author: Michiel Smid
question: comp2804/midterm-fall-2014/17/question.ts
tags:
- comp2804
---
22 changes: 22 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/17/question.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`
Assume you write a multiple-choice exam that consists of 100 questions. For each question, 4 options
are given, one of which is the correct one. If you answer each of the 100 questions by choosing an
answer uniformly at random, what is the probability that you have exactly one correct answer?
`;

const label1 = String.raw`$\frac{100}{4^{100}}$`;
const label2 = String.raw`$\frac{3^{99}}{4^{100}}$`;
const label3 = String.raw`$\frac{100 + 3^{99}}{4^{100}}$`;
const label4 = String.raw`$\frac{100 \cdot 3^{99}}{4^{100}}$`;

export const question: MultipleChoiceQuestion = {
body: body,
options: [
{ label: label1, correct: false },
{ label: label2, correct: false },
{ label: label3, correct: false },
{ label: label4, correct: true },
],
};
9 changes: 9 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/2/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: N/A
path: comp2804/midterm-fall-2014/2
type: multiple-choice
author: Michiel Smid
question: comp2804/midterm-fall-2014/2/question.ts
tags:
- comp2804
---
20 changes: 20 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/2/question.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`
How many bitstrings of length 99 are there that start with 1010 or end with 1010?
`;

const label1 = String.raw`$2^{91}$`;
const label2 = String.raw`$2^{95} + 2^{95}$`;
const label3 = String.raw`$2^{96} - 2^{91}$`;
const label4 = String.raw`$2^{99} - 2^{96}$`;

export const question: MultipleChoiceQuestion = {
body: body,
options: [
{ label: label1, correct: false },
{ label: label2, correct: false },
{ label: label3, correct: true },
{ label: label4, correct: false },
],
};
9 changes: 9 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/3/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: N/A
path: comp2804/midterm-fall-2014/3
type: multiple-choice
author: Michiel Smid
question: comp2804/midterm-fall-2014/3/question.ts
tags:
- comp2804
---
21 changes: 21 additions & 0 deletions src/content/questions/comp2804/midterm-fall-2014/3/question.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`
Consider 17 boys and 17 girls. How many ways are there to arrange them on a line if all boys are
standing next to each other and all girls are standing next to each other?
`;

const label1 = String.raw`$17! + 17!$`;
const label2 = String.raw`$2(17! + 17!)$`;
const label3 = String.raw`$(17!)^2$`;
const label4 = String.raw`$2(17!)^2$`;

export const question: MultipleChoiceQuestion = {
body: body,
options: [
{ label: label1, correct: false },
{ label: label2, correct: false },
{ label: label3, correct: false },
{ label: label4, correct: true },
],
};
Loading

0 comments on commit 54391ee

Please sign in to comment.