diff --git a/app/src/data/questions/comp2804/exam-fall-2014/exam-fall-2014.json b/app/src/data/questions/comp2804/exam-fall-2014/exam-fall-2014.json
new file mode 100644
index 00000000..1b851e8c
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/exam-fall-2014.json
@@ -0,0 +1,32 @@
+{
+ "id": "exam-fall-2014",
+ "title": "Fall 2014 Exam",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/exam-fall-2014/f14f01.xml",
+ "comp2804/exam-fall-2014/f14f02.xml",
+ "comp2804/exam-fall-2014/f14f03.xml",
+ "comp2804/exam-fall-2014/f14f04.xml",
+ "comp2804/exam-fall-2014/f14f05.xml",
+ "comp2804/exam-fall-2014/f14f06.xml",
+ "comp2804/exam-fall-2014/f14f07.xml",
+ "comp2804/exam-fall-2014/f14f08.xml",
+ "comp2804/exam-fall-2014/f14f09.xml",
+ "comp2804/exam-fall-2014/f14f10.xml",
+ "comp2804/exam-fall-2014/f14f11.xml",
+ "comp2804/exam-fall-2014/f14f12.xml",
+ "comp2804/exam-fall-2014/f14f13.xml",
+ "comp2804/exam-fall-2014/f14f14.xml",
+ "comp2804/exam-fall-2014/f14f15.xml",
+ "comp2804/exam-fall-2014/f14f16.xml",
+ "comp2804/exam-fall-2014/f14f17.xml",
+ "comp2804/exam-fall-2014/f14f18.xml",
+ "comp2804/exam-fall-2014/f14f19.xml",
+ "comp2804/exam-fall-2014/f14f20.xml",
+ "comp2804/exam-fall-2014/f14f21.xml",
+ "comp2804/exam-fall-2014/f14f22.xml",
+ "comp2804/exam-fall-2014/f14f23.xml",
+ "comp2804/exam-fall-2014/f14f24.xml",
+ "comp2804/exam-fall-2014/f14f25.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f01.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f01.xml
new file mode 100644
index 00000000..4bc50e7e
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f01.xml
@@ -0,0 +1,12 @@
+
+
+
+ A password must contain exactly one odd digit. How many passwords are there?
+ ]]>
+
+ $13 \cdot 5^{12}$
+ $13 \cdot 5^{13}$
+ $13 \cdot 9^{12}$
+ $13 \cdot 5 \cdot 9^{12}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f02.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f02.xml
new file mode 100644
index 00000000..96f03605
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f02.xml
@@ -0,0 +1,13 @@
+
+
+
+ A password must contain at least one odd digit and at most two even digits. How many passwords are
+ there?
+ ]]>
+
+ $5^{12} + 13 \cdot 5^{12} + {13 \choose 2}5^{12}$
+ $5^{13} + 13 \cdot 9^{12} + {13 \choose 2}9^{12}$
+ $5^{13} + 13 \cdot 5^{13} + {13 \choose 2}5^{13}$
+ $5 \cdot 9^{12} + 13 \cdot 5 \cdot 9^{12} + {13 \choose 2}5 \cdot 9^{12}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f03.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f03.xml
new file mode 100644
index 00000000..a6f8dbc7
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f03.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ $(-2)^{45}$
+ $4^{45}$
+ $(-8)^{45}$
+ $10^{45}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f04.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f04.xml
new file mode 100644
index 00000000..b34652b7
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f04.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ $2^{10} + 2^{11}$
+ $3 \cdot 2^{10} - 2^{8}$
+ $2^{13} - (2^{10} + 2^{11})$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f05.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f05.xml
new file mode 100644
index 00000000..7fc4efe2
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f05.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $S_n = S_{n-1} + S_{n-2}\ \mathrm{for}\ n \geq 3.$
+ $S_n = S_{n-1} + S_{n-3}\ \mathrm{for}\ n \geq 3.$
+ $S_n = S_{n-1} + S_{n-2} + S_{n-3}\ \mathrm{for}\ n \geq 3.$
+ $S_n = 2 \cdot S_{n-1}\ \mathrm{for}\ n \geq 3.$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f06.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f06.xml
new file mode 100644
index 00000000..4080934a
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f06.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ 40 like 8:30am classes,
+
+
+ 30 like the course COMP 2804,
+
+
+ 50 do not like 8:30am classes and do not like the course COMP 2804.
+
+
+ How many students in this group like 8:30am classes and like the course COMP 2804?
+ ]]>
+
+ 10
+ 20
+ 30
+ 40
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f07.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f07.xml
new file mode 100644
index 00000000..b8353a12
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f07.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $7!{m \choose 7} + 7!{n \choose 7}$
+ $m!{m \choose 7} + n!{n \choose 7}$
+ $7!{m + n \choose 7}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f08.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f08.xml
new file mode 100644
index 00000000..ca69cbd1
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f08.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ $10!$
+ $\frac{10!}{2!3!5!}$
+ ${10 \choose 3}{10 \choose 2}{10 \choose 5}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f09.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f09.xml
new file mode 100644
index 00000000..3c5e8138
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f09.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ ${13 \choose 2}$
+ ${14 \choose 2}$
+ ${15 \choose 2}$
+ ${16 \choose 2}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f10.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f10.xml
new file mode 100644
index 00000000..7f2bb29a
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f10.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+ $f(0) = $ |
+ $-17,$ |
+
+
+ $f(n) = $ |
+ $f(n - 1) + 8n - 2\; \ \text{for all}$ $\text{integers}\ n \geq 1.$ |
+
+
+
+ Which of the following is true?
+ ]]>
+
+ for all $n \geq 0$: $f(n) = 3n^{2} - n - 17$
+ for all $n \geq 0$: $f(n) = 3n^{2} + n - 17$
+ for all $n \geq 0$: $f(n) = 4n^{2} - 2n - 17$
+ for all $n \geq 0$: $f(n) = 4n^{2} + 2n - 17$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f11.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f11.xml
new file mode 100644
index 00000000..de7cf924
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f11.xml
@@ -0,0 +1,27 @@
+
+
+
+ $\newcommand{\Fib}{{\rm F \scriptsize IB}}$
+
+
+ Consider the recursive algorithm $\Fib$, which takes as input an
+ integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \Fib(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ f = n$
+ $\mathbf{else}\ f = \Fib(n - 1) + \Fib(n - 2)$
+ $\mathbf{endif};$
+ $\mathbf{return}\ f$
+
+
+ If we run algorithm $\Fib(20)$, how many calls are there to $\Fib(16)$?
+ ]]>
+
+ 4
+ 5
+ 6
+ 7
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f12.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f12.xml
new file mode 100644
index 00000000..68224de0
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f12.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $\frac{{5 \choose 2} + {4 \choose 2} + {6 \choose 2}}{{15 \choose 2}}$
+ $\frac{{15 \choose 2}}{{5 \choose 2} + {4 \choose 2} + {6 \choose 2}}$
+ $\frac{{5 \choose 2}{4 \choose 2}{6 \choose 2}}{{15 \choose 2}}$
+ $\frac{{15 \choose 2}}{{5 \choose 2}{4 \choose 2}{6 \choose 2}}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f13.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f13.xml
new file mode 100644
index 00000000..bdf100cd
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f13.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $\frac{1}{364 \cdot 365}$
+ $\frac{1}{365^2}$
+ $\frac{365}{364^{2}}$
+ $\frac{1}{365^{3}}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f14.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f14.xml
new file mode 100644
index 00000000..f8c2f394
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f14.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $1 - (1/2)^{7}$
+ $\sum_{k=0}^{7} (1/2)^{k}$
+ $\sum_{k=0}^{7} (1/2)^{k+1}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f15.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f15.xml
new file mode 100644
index 00000000..9378cdea
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f15.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ $\frac{{4 \choose 2}}{{5 \choose 2} + {4 \choose 2}}$
+ $\frac{{5 \choose 2} + {4 \choose 2}}{{4 \choose 2}}$
+ $\frac{{4 \choose 2}}{{9 \choose 2}}$
+ $\frac{{4 \choose 2}}{{5 \choose 2}{4 \choose 2}}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f16.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f16.xml
new file mode 100644
index 00000000..78bdc0a0
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f16.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ 3/10
+ 1/3
+ 1/2
+ 2/3
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f17.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f17.xml
new file mode 100644
index 00000000..be64a0f4
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f17.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f18.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f18.xml
new file mode 100644
index 00000000..2b910a44
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f18.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f19.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f19.xml
new file mode 100644
index 00000000..b0fd3107
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f19.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f20.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f20.xml
new file mode 100644
index 00000000..b6c80a7e
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f20.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $\frac{1}{3}$
+ $\frac{1}{4}$
+ $\frac{1}{4} \cdot \frac{1}{3} + \frac{3}{4} \cdot \frac{1}{4}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f21.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f21.xml
new file mode 100644
index 00000000..bc6a0fc0
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f21.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ 2
+ 1
+ 1/4
+ 1/2
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f22.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f22.xml
new file mode 100644
index 00000000..dcb9061d
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f22.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ 2/5
+ 2
+ 5/2
+ 5
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f23.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f23.xml
new file mode 100644
index 00000000..c152c5ba
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f23.xml
@@ -0,0 +1,37 @@
+
+
+
+ $\newcommand{\ThreeHeadsOrThreeTails}{{\rm T {\scriptsize HREE} H {\scriptsize EADS} O {\scriptsize R} T {\scriptsize HREE} T {\scriptsize AILS}}}$
+
+
+ Consider the following recursive algorithm $\ThreeHeadsOrThreeTails$, which takes as input a positive integer $k$:
+
+
+ $\mathbf{Algorithm}$ $\ThreeHeadsOrThreeTails(k)\mathrm{:}$
+
+
+
+ $//$ |
+
+ $\text{all coin flips made}$ $\text{are mutually independent}$
+ |
+
+
+
+ $\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}$
+
+
+ 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$?
+ ]]>
+
+ 2
+ 3
+ 4
+ 5
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f24.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f24.xml
new file mode 100644
index 00000000..7b1c6f10
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f24.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ $-n/2$
+ $n/2$
+ $-n$
+ $n$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2014/f14f25.xml b/app/src/data/questions/comp2804/exam-fall-2014/f14f25.xml
new file mode 100644
index 00000000..d6789cfe
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2014/f14f25.xml
@@ -0,0 +1,7 @@
+
+ Who invented the Fibonacci numbers?
+ Justin Bieber
+ Britney Spears
+ Fibonacci
+ Carl Friedrich Gauss
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/exam-fall-2015.json b/app/src/data/questions/comp2804/exam-fall-2015/exam-fall-2015.json
new file mode 100644
index 00000000..dc8802d9
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/exam-fall-2015.json
@@ -0,0 +1,32 @@
+{
+ "id": "exam-fall-2015",
+ "title": "Fall 2015 Exam",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/exam-fall-2015/f15f01.xml",
+ "comp2804/exam-fall-2015/f15f02.xml",
+ "comp2804/exam-fall-2015/f15f03.xml",
+ "comp2804/exam-fall-2015/f15f04.xml",
+ "comp2804/exam-fall-2015/f15f05.xml",
+ "comp2804/exam-fall-2015/f15f06.xml",
+ "comp2804/exam-fall-2015/f15f07.xml",
+ "comp2804/exam-fall-2015/f15f08.xml",
+ "comp2804/exam-fall-2015/f15f09.xml",
+ "comp2804/exam-fall-2015/f15f10.xml",
+ "comp2804/exam-fall-2015/f15f11.xml",
+ "comp2804/exam-fall-2015/f15f12.xml",
+ "comp2804/exam-fall-2015/f15f13.xml",
+ "comp2804/exam-fall-2015/f15f14.xml",
+ "comp2804/exam-fall-2015/f15f15.xml",
+ "comp2804/exam-fall-2015/f15f16.xml",
+ "comp2804/exam-fall-2015/f15f17.xml",
+ "comp2804/exam-fall-2015/f15f18.xml",
+ "comp2804/exam-fall-2015/f15f19.xml",
+ "comp2804/exam-fall-2015/f15f20.xml",
+ "comp2804/exam-fall-2015/f15f21.xml",
+ "comp2804/exam-fall-2015/f15f22.xml",
+ "comp2804/exam-fall-2015/f15f23.xml",
+ "comp2804/exam-fall-2015/f15f24.xml",
+ "comp2804/exam-fall-2015/f15f25.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f01.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f01.xml
new file mode 100644
index 00000000..b3e9617b
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f01.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ ${20 \choose 3}$
+ ${15 \choose 3}$
+ ${15 \choose 3} + 15 \cdot {5 \choose 2}$
+ ${15 \choose 3} + {15 \choose 2} \cdot 5 + 15 \cdot {5 \choose 2}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f02.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f02.xml
new file mode 100644
index 00000000..78ec8b0e
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f02.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ ${19 \choose 6}$
+ ${19 \choose 7}$
+ ${20 \choose 6}$
+ ${20}\choose{7}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f03.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f03.xml
new file mode 100644
index 00000000..71638a4f
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f03.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $2^{17} - 2^{15}$
+ $2^{17} - 2^{16}$
+ $2^{18} - 2^{16}$
+ $2^{18} - 2^{17}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f04.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f04.xml
new file mode 100644
index 00000000..a721dce3
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f04.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ ${20 \choose 5} \cdot 3^{15} \cdot 5^5$
+ $- {20 \choose 5} \cdot 3^{15} \cdot 5^5$
+ ${20 \choose 5} \cdot 5^{15} \cdot 3^5$
+ $- {20 \choose 5} \cdot 5^{15} \cdot 3^5$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f05.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f05.xml
new file mode 100644
index 00000000..1780940c
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f05.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ 10 are blond,
+
+
+ 20 have green eyes,
+
+
+ 9 are not blond and do not have green eyes.
+
+
+ How many people in this group are blond and have green eyes?
+ ]]>
+
+ 8
+ 9
+ 10
+ 11
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f06.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f06.xml
new file mode 100644
index 00000000..536c7931
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f06.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $S_n = n \cdot 2^{n-1}$
+ $S_n = n \cdot 3^{n-1}$
+ $S_n = 3^{n} - n$
+ $S_n = 3^{n} - 2^{n}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f07.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f07.xml
new file mode 100644
index 00000000..11a49afc
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f07.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $S_n = 2 \cdot S_{n-1} + 3^{n-1}$
+ $S_n = 2 \cdot S_{n-1} + 2 \cdot S_{n-2}$
+ $S_n = 3 \cdot S_{n-1}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f08.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f08.xml
new file mode 100644
index 00000000..b4b6c317
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f08.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+ $f(0) = $ |
+ $7,$ |
+
+
+ $f(n) = $ |
+ $2 \cdot f(n - 1) + 1\; \ \text{for all}$ $\text{integers}\ n \geq 1.$ |
+
+
+
+ Which of the following is true?
+ ]]>
+
+ $f(n) = 8n + 7$
+ $f(n) = 4n^{2} + 4n + 7$
+ $f(n) = 2^{n+3} - 1$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f09.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f09.xml
new file mode 100644
index 00000000..e8ed5645
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f09.xml
@@ -0,0 +1,27 @@
+
+
+
+ $\newcommand{\Fib}{{\rm F \scriptsize IB}}$
+
+
+ Consider the following recursive algorithm $\Fib$, which takes as input an
+ integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \Fib(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ f = n$
+ $\mathbf{else}\ f = \Fib(n - 1) + \Fib(n - 2)$
+ $\mathbf{endif};$
+ $\mathbf{return}\ f$
+
+
+ If we run algorithm $\Fib(18)$, how many calls are there to $\Fib(14)$?
+ ]]>
+
+ 4
+ 5
+ 6
+ 7
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f10.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f10.xml
new file mode 100644
index 00000000..67019f89
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f10.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ $2 \cdot (n-1) \cdot 2^{n-2}$
+ $2 \cdot n \cdot 2^{n-1}$
+ $2^n - 4$
+ $2^n - 2$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f11.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f11.xml
new file mode 100644
index 00000000..bd73e2aa
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f11.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ ${79 \choose 4}$
+ ${79 \choose 5}$
+ ${80 \choose 4}$
+ ${80 \choose 5}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f12.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f12.xml
new file mode 100644
index 00000000..d33fc4da
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f12.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ $\frac{{5 \choose 2}}{{12 \choose 3}}$
+ $\frac{5 \cdot {7 \choose 2}}{{12 \choose 3}}$
+ $\frac{{5 \choose 2} \cdot 7}{{12 \choose 3}}$
+ $\frac{{7 \choose 2}}{{12 \choose 3}}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f13.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f13.xml
new file mode 100644
index 00000000..80a5c9ab
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f13.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f14.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f14.xml
new file mode 100644
index 00000000..e4afd9c2
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f14.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ $n \cdot (1/365) \cdot (364/365)^{n-1}$
+ $365 \cdot n \cdot (364/365)^{n-1}$
+ $1 - (1/365)^{n}$
+ $1 - (364/365)^{n}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f15.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f15.xml
new file mode 100644
index 00000000..4d545f44
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f15.xml
@@ -0,0 +1,31 @@
+
+
+
+
+ The course COMP 9999 runs over a period of one year, starting on January 1 and ending on December
+ 31. There is one lecture every day; thus, the total number of lectures is 365.
+
+
+ Dania and Nick take this course. Dania's birthday is on November 19. Nick's birthday is on December
+ 3.
+
+
+ Professor G. Ruesome teaches the course. Professor Ruesome decides to have 20 quizzes during the
+ year. For this, he chooses a uniformly random subset of 20 days; the quizzes will be on the 20
+ chosen days. (It is possible that there is a quiz on January 1.)
+
+
+
+ Determine $\Pr(A)$, where $A$ is the event
+ [defs]
+ A = "There is a quiz on Dania's birthday and there is a quiz on Nick's birthday".
+ [/defs]
+ ]]>
+
+ $1 - \left. {363 \choose 20} \middle/ {365 \choose 20} \right.$
+ $\left. {363 \choose 18} \middle/ {365 \choose 20} \right.$
+ $\left. {365 \choose 18} \middle/ {365 \choose 20} \right.$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f16.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f16.xml
new file mode 100644
index 00000000..e13e1467
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f16.xml
@@ -0,0 +1,32 @@
+
+
+
+
+ The course COMP 9999 runs over a period of one year, starting on January 1 and ending on December
+ 31. There is one lecture every day; thus, the total number of lectures is 365.
+
+
+ Dania and Nick take this course. Dania's birthday is on November 19. Nick's birthday is on December
+ 3.
+
+
+ Professor G. Ruesome teaches the course. Professor Ruesome decides to have 20 quizzes during the
+ year. For this, he chooses a uniformly random subset of 20 days; the quizzes will be on the 20
+ chosen days. (It is possible that there is a quiz on January 1.)
+
+
+
+ Determine the conditional probability $\Pr(B|C)$, where $B$ and $C$ are the events
+ [defs]
+ B = "there is a quiz on Nick's birthday",
+ C = "there are exactly 5 quizzes in December".
+ [/defs]
+ ]]>
+
+ 4/31
+ 5/31
+ 4/32
+ 5/32
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f17.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f17.xml
new file mode 100644
index 00000000..491a50e3
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f17.xml
@@ -0,0 +1,26 @@
+
+
+
+
+ The course COMP 9999 runs over a period of one year, starting on January 1 and ending on December
+ 31. There is one lecture every day; thus, the total number of lectures is 365.
+
+
+ At the beginning of each of the 365 lectures, Nick flips a fair and independent coin twice.
+ If the coin comes up heads twice, then Nick eats 3 bananas during the lecture; otherwise,
+ Nick eats 5 bananas during the lecture.
+
+
+
+ Let $X$ be the total number of bananas that Nick eats during the 365 lectures of the course COMP
+ 9999. What is the expected value $\mathbb{E}(X)$ of $X$?
+ (n.b., you may find it useful to apply Linearity of Expectation)
+ ]]>
+
+ $\frac{9 \cdot 365}{2}$
+ $\frac{7 \cdot 365}{2}$
+ $\frac{5 \cdot 365}{2}$
+ $4 \cdot 365$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f18.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f18.xml
new file mode 100644
index 00000000..f3e3a6e0
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f18.xml
@@ -0,0 +1,19 @@
+
+
+
+ Let $X$ be the number of students who give their gift to themselves. What is the expected value
+ $\mathbb{E}(X)$ of the random variable $X$?
+ Hint: Use an indicator random variable for each student.
+
+ ]]>
+
+ $1$
+ $2$
+ $1 + 1/n$
+ $2 + 1/n$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f19.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f19.xml
new file mode 100644
index 00000000..5695abc1
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f19.xml
@@ -0,0 +1,19 @@
+
+
+
+ For each $i = 1,2,\dots,n$, let $v_i$ be the value (in dollars) of the gift that student $S_i$
+ buys. Let $Y$ be the value of the gift that student $S_1$ receives, and let $Z$ be the value of the
+ gift that student $S_2$ receives. What is $\mathbb{E}(2 \cdot Y - Z)$?
+
+ ]]>
+
+ $2v_1 - v_2$
+ $\sum_{i=3}^{n} v_i/n$
+ $\sum_{i=1}^{n} v_i/n$
+ $2 \sum_{i=2}^{n} v_i/n - (v_1/n + \sum_{i=3}^{n} v_i/n)$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f20.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f20.xml
new file mode 100644
index 00000000..f8330fdc
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f20.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ What is the expected value $\mathbb{E}(X)$ of $X$?
+ ]]>
+
+ 3/8
+ 8/3
+ 8
+ 12
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f21.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f21.xml
new file mode 100644
index 00000000..fc9c103b
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f21.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ What is the expected value $\mathbb{E}(X)$ of $X$?
+ Hint: Use indicator random variables.
+ ]]>
+
+ $2n/27$
+ $2(n-2)/27$
+ $(n-2)/8$
+ $n/8$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f22.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f22.xml
new file mode 100644
index 00000000..6425598b
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f22.xml
@@ -0,0 +1,22 @@
+
+
+
+
+ Let $X$ be the size of the set $T'$.
+ What is the expected value $\mathbb{E}(X)$ of $X$?
+ Hint: Use indicator random variables.
+ ]]>
+
+ $n/9$
+ $m/9$
+ $4n/9$
+ $4m/9$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f23.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f23.xml
new file mode 100644
index 00000000..9bac8de7
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f23.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ 1
+ 3/2
+ 2
+ 5/2
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f24.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f24.xml
new file mode 100644
index 00000000..ce225164
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f24.xml
@@ -0,0 +1,38 @@
+
+
+
+ $\newcommand{\Heads}{{\rm H \scriptsize EADS}}$
+
+
+ Consider a coin that comes up heads with probability 1/3 and, thus, tails with probability 2/3.
+ Consider the following recursive algorithm $\Heads$, which takes as input a positive integer $k$:
+
+
+ $\mathbf{Algorithm}\ \Heads(k)\mathrm{:}$
+
+
+
+ $//$ |
+
+ $\text{all coin flips made}$ $\text{are mutually independent}$
+ |
+
+
+
+ $\text{flip the coin};$
+ $\mathbf{if}\ \text{the coin came up heads}$
+ $\mathbf{then}\ \mathrm{return}\ k + 1$
+ $\mathbf{else}\ \Heads(k + 1)$
+ $\mathbf{endif}$
+
+
+ You run algorithm $\Heads(1)$, i.e., with $k = 1$. Define the random variable $X$ to be the value of
+ the output of this algorithm. Let $m \geq 1$ be an integer. What is $\Pr(X = m + 1)$?
+ ]]>
+
+ $2^{m-1}/3^{m}$
+ $(2/3)^{m}$
+ $2^{m}/3^{m+1}$
+ $(2/3)^{m+1}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2015/f15f25.xml b/app/src/data/questions/comp2804/exam-fall-2015/f15f25.xml
new file mode 100644
index 00000000..d92a6220
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2015/f15f25.xml
@@ -0,0 +1,9 @@
+
+
+ Who discovered Newton's Binomial Theorem?
+
+ Professor Binomial.
+ Justin Bieber.
+ Isaac Newton.
+ Professor G. Ruesome (the guy teaching COMP 9999).
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/exam-fall-2016.json b/app/src/data/questions/comp2804/exam-fall-2016/exam-fall-2016.json
new file mode 100644
index 00000000..ee8ddc68
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/exam-fall-2016.json
@@ -0,0 +1,32 @@
+{
+ "id": "exam-fall-2016",
+ "title": "Fall 2016 Exam",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/exam-fall-2016/f16f01.xml",
+ "comp2804/exam-fall-2016/f16f02.xml",
+ "comp2804/exam-fall-2016/f16f03.xml",
+ "comp2804/exam-fall-2016/f16f04.xml",
+ "comp2804/exam-fall-2016/f16f05.xml",
+ "comp2804/exam-fall-2016/f16f06.xml",
+ "comp2804/exam-fall-2016/f16f07.xml",
+ "comp2804/exam-fall-2016/f16f08.xml",
+ "comp2804/exam-fall-2016/f16f09.xml",
+ "comp2804/exam-fall-2016/f16f10.xml",
+ "comp2804/exam-fall-2016/f16f11.xml",
+ "comp2804/exam-fall-2016/f16f12.xml",
+ "comp2804/exam-fall-2016/f16f13.xml",
+ "comp2804/exam-fall-2016/f16f14.xml",
+ "comp2804/exam-fall-2016/f16f15.xml",
+ "comp2804/exam-fall-2016/f16f16.xml",
+ "comp2804/exam-fall-2016/f16f17.xml",
+ "comp2804/exam-fall-2016/f16f18.xml",
+ "comp2804/exam-fall-2016/f16f19.xml",
+ "comp2804/exam-fall-2016/f16f20.xml",
+ "comp2804/exam-fall-2016/f16f21.xml",
+ "comp2804/exam-fall-2016/f16f22.xml",
+ "comp2804/exam-fall-2016/f16f23.xml",
+ "comp2804/exam-fall-2016/f16f24.xml",
+ "comp2804/exam-fall-2016/f16f25.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f01.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f01.xml
new file mode 100644
index 00000000..2b153042
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f01.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $7^9$
+ $9^7$
+ $7!$
+ $9!$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f02.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f02.xml
new file mode 100644
index 00000000..02e46142
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f02.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $\frac{7!}{2}$
+ $\frac{7!}{3}$
+ $\frac{9!}{2}$
+ $\frac{9!}{3}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f03.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f03.xml
new file mode 100644
index 00000000..de6a6637
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f03.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ $2^{55} - 2^{48}$
+ $2^{51} + 2^{52}$
+ $2^{51} + 2^{52} - 2^{48}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f04.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f04.xml
new file mode 100644
index 00000000..e2e51ce7
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f04.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ The number of bitstrings of length $n$ that have at least two 1's.
+ The number of bitstrings of length $n$ that have at most two 1's.
+ The number of subsets of a set of size $n$ that have size at least two.
+ The number of subsets of a set of size $n$ that have size at least three.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f05.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f05.xml
new file mode 100644
index 00000000..1bd5e5c4
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f05.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ 25 drink cider,
+
+
+ 50 drink beer,
+
+
+ 33 do not drink cider and do not drink beer.
+
+
+ How many people in this group drink both cider and beer?
+ ]]>
+
+ 8
+ 9
+ 10
+ 11
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f06.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f06.xml
new file mode 100644
index 00000000..443a686a
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f06.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $S_n = S_{n-1} + S_{n-2} + S_{n-3}$
+ $S_n = S_{n-1} + 2 \cdot S_{n-2}$
+ $S_n = S_{n-1} + S_{n-2} + 2^{n-3}$
+ $S_n = S_{n-1} + S_{n-2} + 2^{n-2}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f07.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f07.xml
new file mode 100644
index 00000000..e8fa1ec8
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f07.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $S_n = {n \choose 2}$
+ $S_n = {n \choose 2} - n - 1$
+ $S_n = {n \choose 2} - n$
+ $S_n = {n \choose 2} - n + 1$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f08.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f08.xml
new file mode 100644
index 00000000..fa76de8c
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f08.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ $f(n) = \frac{5}{n!}$
+ $f(n) = \frac{5^{n}}{n!}$
+ $f(n) = \frac{5^{n}}{(n+1)!}$
+ $f(n) = \frac{5^{n+1}}{n!}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f09.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f09.xml
new file mode 100644
index 00000000..0c05a838
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f09.xml
@@ -0,0 +1,30 @@
+
+
+
+ $\newcommand{\Hello}{{\rm H {\scriptsize ELLO}}}
+ \newcommand{\elsesp}{\phantom{\mathbf{else}\ }}$
+
+
+ Consider the recursive algorithm $\Hello$, which takes as input an integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \Hello(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ \text{print ``hello''}$
+ $\mathbf{else}\ \mathbf{if}\ n\ \mathrm{is}\ \mathrm{even}$
+ $\elsesp \mathbf{then}\ \Hello(n / 2)$
+ $\elsesp \mathbf{else}\ \Hello(n - 1);$
+ $\elsesp \elsesp \Hello(n - 2)$
+ $\elsesp \mathbf{endif};$
+ $\mathbf{endif}$
+
+
+ If we run algorithm $\Hello(7)$, how many times is the word "hello" printed?
+ ]]>
+
+ 4
+ 5
+ 6
+ 7
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f10.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f10.xml
new file mode 100644
index 00000000..e06f4c11
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f10.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $S_n = 5 \cdot 4^{n-1}$
+ $S_n = 5 \cdot 4^{n-2}$
+ $S_n = 5^{n} - 5(n-1) \cdot 4^{n-2}$
+ $S_n = 5^{n} - 5(n-1) \cdot 4^{n-1}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f11.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f11.xml
new file mode 100644
index 00000000..d6452817
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f11.xml
@@ -0,0 +1,16 @@
+
+
+ $x_5 \geq 0$ are integers?
+ ]]>
+
+ ${33 \choose 4}$
+ ${33 \choose 5}$
+ ${32 \choose 4}$
+ ${32 \choose 5}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f12.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f12.xml
new file mode 100644
index 00000000..759a82c2
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f12.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ 1/3
+ 1/4
+ 1/5
+ 1/6
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f13.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f13.xml
new file mode 100644
index 00000000..5f6a5b6a
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f13.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ $\frac{{12 \choose 4}+{8 \choose 3}}{20 \choose 7}$
+ $\frac{{12 \choose 4}{8 \choose 3}}{20 \choose 7}$
+ $\frac{{20 \choose 3}{17 \choose 4}}{20 \choose 7}$
+ $\frac{{20 \choose 4}{16 \choose 3}}{20 \choose 7}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f14.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f14.xml
new file mode 100644
index 00000000..9041d246
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f14.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f15.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f15.xml
new file mode 100644
index 00000000..5a29de62
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f15.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f16.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f16.xml
new file mode 100644
index 00000000..89712421
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f16.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ ${n \choose 2} \cdot \left( \frac{1}{365} \right)^2 \cdot \left( \frac{364}{365} \right)^{n-2}$
+ $1 - {n \choose 2} \cdot \left( \frac{1}{365} \right)^2 \cdot \left( \frac{364}{365} \right)^{n-2}$
+ $1 - \left( \frac{364}{365} \right)^n - n \cdot \frac{1}{365} \cdot \left( \frac{364}{365} \right)^{n-1}$
+ ${\sum_{k=2}^{n}} {n \choose k} \cdot \left( \frac{1}{365} \right)^k$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f17.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f17.xml
new file mode 100644
index 00000000..f4644b82
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f17.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ $1 - \frac{{98}\choose{15}}{{100}\choose{17}}$
+ $1 - \frac{{100 \choose 2} \cdot {98 \choose 15}}{100 \choose 17}$
+ $\frac{2 \cdot {99 \choose 16}}{100 \choose 17}$
+ $\frac{2 \cdot {99 \choose 16} - {98 \choose 15}}{100 \choose 17}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f18.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f18.xml
new file mode 100644
index 00000000..7606eadc
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f18.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ 1/2
+ 1/3
+ 1/4
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f19.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f19.xml
new file mode 100644
index 00000000..bb9ef31c
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f19.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ What is the expected value $\mathbb{E}(X)$ of $X$?
+ Hint: Use indicator random variables.
+ ]]>
+
+ $\frac{n-1}{4}$
+ $\frac{n}{4}$
+ $\frac{n-1}{2}$
+ $\frac{n}{2}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f20.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f20.xml
new file mode 100644
index 00000000..69b9555e
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f20.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ Define the random variable $X$ to be the number of unordered pairs $\{P_i,P_j\}$ of people that have
+ the same birthday.
+
+ What is the expected value $\mathbb{E}(X)$ of $X$?
+ Hint: Use indicator random variables.
+ ]]>
+
+ $\frac{1}{365} \cdot {n \choose 2}$
+ $\left( \frac{1}{365} \right)^2 \cdot {n \choose 2}$
+ $\frac{1}{365} \cdot n^2$
+ $\left( \frac{1}{365} \right)^2 \cdot n^2$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f21.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f21.xml
new file mode 100644
index 00000000..8d3ea6c6
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f21.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ What is the expected value $\mathbb{E}(X)$ of $X$?
+ ]]>
+
+ 7/2
+ 32/7
+ 17/7
+ 7/17
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f22.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f22.xml
new file mode 100644
index 00000000..bd04621b
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f22.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ The random variables $X$ and $Y$ are independent.
+ The random variables $X$ and $Y$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f23.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f23.xml
new file mode 100644
index 00000000..eff64287
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f23.xml
@@ -0,0 +1,28 @@
+
+
+
+
+ The random variables $X$ and $Y$ are independent.
+ The random variables $X$ and $Y$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f24.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f24.xml
new file mode 100644
index 00000000..aed29a19
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f24.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ What is the expected value $\mathbb{E}(X)$ of $X$?
+ ]]>
+
+ 2
+ 3
+ 4
+ 5
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2016/f16f25.xml b/app/src/data/questions/comp2804/exam-fall-2016/f16f25.xml
new file mode 100644
index 00000000..883b2797
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2016/f16f25.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ Beer
+ Cider
+ Hot chocolate
+ Poutine
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/exam-fall-2017.json b/app/src/data/questions/comp2804/exam-fall-2017/exam-fall-2017.json
new file mode 100644
index 00000000..f53ad739
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/exam-fall-2017.json
@@ -0,0 +1,32 @@
+{
+ "id": "exam-fall-2017",
+ "title": "Fall 2017 Exam",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/exam-fall-2017/f17f01.xml",
+ "comp2804/exam-fall-2017/f17f02.xml",
+ "comp2804/exam-fall-2017/f17f03.xml",
+ "comp2804/exam-fall-2017/f17f04.xml",
+ "comp2804/exam-fall-2017/f17f05.xml",
+ "comp2804/exam-fall-2017/f17f06.xml",
+ "comp2804/exam-fall-2017/f17f07.xml",
+ "comp2804/exam-fall-2017/f17f08.xml",
+ "comp2804/exam-fall-2017/f17f09.xml",
+ "comp2804/exam-fall-2017/f17f10.xml",
+ "comp2804/exam-fall-2017/f17f11.xml",
+ "comp2804/exam-fall-2017/f17f12.xml",
+ "comp2804/exam-fall-2017/f17f13.xml",
+ "comp2804/exam-fall-2017/f17f14.xml",
+ "comp2804/exam-fall-2017/f17f15.xml",
+ "comp2804/exam-fall-2017/f17f16.xml",
+ "comp2804/exam-fall-2017/f17f17.xml",
+ "comp2804/exam-fall-2017/f17f18.xml",
+ "comp2804/exam-fall-2017/f17f19.xml",
+ "comp2804/exam-fall-2017/f17f20.xml",
+ "comp2804/exam-fall-2017/f17f21.xml",
+ "comp2804/exam-fall-2017/f17f22.xml",
+ "comp2804/exam-fall-2017/f17f23.xml",
+ "comp2804/exam-fall-2017/f17f24.xml",
+ "comp2804/exam-fall-2017/f17f25.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f01.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f01.xml
new file mode 100644
index 00000000..aab53076
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f01.xml
@@ -0,0 +1,21 @@
+
+
+
+
+ the leftmost 10 bottles are all beer bottles, and
+
+
+ the rightmost 10 bottles are all cider bottles.
+
+
+ How many such arrangements are there? (The order of the bottles matters.)
+ ]]>
+
+ ${20 \choose 10} \cdot {30 \choose 10} \cdot 30!$
+ ${20 \choose 10} \cdot 10! \cdot {30 \choose 10} \cdot 10! \cdot 30!$
+ ${20 \choose 10} \cdot 10! \cdot {30 \choose 10} \cdot 10!$
+ $50!$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f02.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f02.xml
new file mode 100644
index 00000000..e17f6121
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f02.xml
@@ -0,0 +1,17 @@
+
+
+ awesome if $a_2 = 2 \cdot a_1$.
+
+ For example, if $n = 6$, then the permutation $3,6,4,1,5,2$ is awesome, whereas the permutation
+ $3,5,4,1,6,2$ is not awesome.
+
+ How many awesome permutations of the set $\{1,2,\dots,n\}$ are there?
+ ]]>
+
+ $n \cdot (n-1)!$
+ $n \cdot (n-2)!$
+ ${\frac{n}{2}} \cdot (n-1)!$
+ ${\frac{n}{2}} \cdot (n-2)!$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f03.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f03.xml
new file mode 100644
index 00000000..a82386c5
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f03.xml
@@ -0,0 +1,24 @@
+
+
+ cool if
+
+ -
+ it contains exactly 8 many $a$'s
+
+
+ or
+
+ -
+ it contains exactly 7 many $b$'s.
+
+
+ How many cool strings are there?
+ ]]>
+
+ ${{40 \choose 8} \cdot 2^{32} + {40 \choose 7} \cdot 2^{33}}$
+ ${{40 \choose 8} \cdot 2^{32} + {40 \choose 7} \cdot 2^{33} - {40 \choose 15} \cdot {15 \choose 8} \cdot 2^{25}}$
+ ${{40 \choose 8} \cdot 2^{32} + {40 \choose 7} \cdot 2^{33} - {40 \choose 15} \cdot {15 \choose 8}}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f04.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f04.xml
new file mode 100644
index 00000000..5a6d5bb7
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f04.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ ${40 \choose 3}$
+ $3^{40} - 1 - 40 \cdot 3^{39} - {40 \choose 2} \cdot 3^{38}$
+ $3^{40} - 2^{40} - 40 \cdot 2^{39} - {40 \choose 2} \cdot 2^{38}$
+ $3^{40} - 2^{40} - 40 \cdot 2^{39} - {40 \choose 2} \cdot 2^{38}\ -$ $ {40 \choose 3} \cdot 2^{37}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f05.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f05.xml
new file mode 100644
index 00000000..a4abc7c2
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f05.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ The number of subsets having size 3 of a set consisting of $n$ positive numbers and $m$ negative numbers.
+ The number of subsets having size at most 3 of a set consisting of $n$ positive numbers and $m$ negative numbers.
+ The number of subsets having size 2 or 3 of a set consisting of $n$ positive numbers and $m$ negative numbers.
+ The number of subsets having size 2 and 3 of a set consisting of $n$ positive numbers and $m$ negative numbers.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f06.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f06.xml
new file mode 100644
index 00000000..fa305668
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f06.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ 13 students like Donald Trump,
+
+
+ 25 students like Justin Bieber, and
+
+
+ 8 students like Donald Trump and like Justin Bieber.
+
+
+ How many students do not like Donald Trump and do not like Justin Bieber?
+ ]]>
+
+ 69
+ 70
+ 71
+ 72
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f07.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f07.xml
new file mode 100644
index 00000000..55b719c9
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f07.xml
@@ -0,0 +1,14 @@
+
+
+
+ BOOKKEEPER
+
+ ]]>
+
+ $2! \cdot 2! \cdot 3!$
+ ${10 \choose 2} \cdot {8 \choose 2} \cdot {6 \choose 3} \cdot 3 \cdot 2$
+ ${10 \choose 2} \cdot {8 \choose 2} \cdot {6 \choose 3} \cdot {3 \choose 2}$
+ ${10 \choose 2} \cdot {8 \choose 2} \cdot {5 \choose 3} \cdot 3 \cdot 2$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f08.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f08.xml
new file mode 100644
index 00000000..0830cff5
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f08.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ For any integer $n \geq 1$, let $E_n$ be the number of such strings of length $n$ that contain an even
+ number of $c$'s, and let $O_n$ be the number of such strings of length $n$ that contain an odd
+ number of $c$'s. (Remember that 0 is an even number.)
+
+ Which of the following is true for any integer $n \geq 2$?
+ ]]>
+
+ $E_n = 2 \cdot E_{n-1} + O_{n-1}$
+ $E_n = 2 \cdot E_{n-1} + E_{n-1}$
+ $E_n = 2 \cdot O_{n-1} + O_{n-1}$
+ $E_n = 2 \cdot O_{n-1} + E_{n-1}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f09.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f09.xml
new file mode 100644
index 00000000..cf9bd12b
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f09.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $S_n = S_{n-1} + S_{n-2} + S_{n-3}$
+ $S_n = S_{n-1} + S_{n-2} + 2^{n-2}$
+ $S_n = S_{n-1} + S_{n-2} + 2^{n-3}$
+ $S_n = S_{n-1} + S_{n-2} + 1$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f10.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f10.xml
new file mode 100644
index 00000000..9eb38703
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f10.xml
@@ -0,0 +1,30 @@
+
+
+
+ $\newcommand{\IFeelLikeSinging}{{\rm IF {\scriptsize EEL} L {\scriptsize IKE} S {\scriptsize INGING}}}
+ \newcommand{\elsesp}{\phantom{\mathbf{else}\ }}$
+
+
+ Consider the recursive algorithm $\IFeelLikeSinging$, which takes as input an integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \IFeelLikeSinging(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ \mathrm{sing}\ {\it O\ Canada}$
+ $\mathbf{else}\ \mathbf{if}\ n\ \text{is odd}$
+ $\elsesp \mathbf{then}\ \IFeelLikeSinging(n + 1)$
+ $\elsesp \mathbf{else}\ \IFeelLikeSinging(\frac{n}{2});$
+ $\elsesp \elsesp \IFeelLikeSinging(\frac{n}{2} - 1)$
+ $\elsesp \mathbf{endif};$
+ $\mathbf{endif}$
+
+
+ If you run algorithm $\IFeelLikeSinging(9)$, how many times do you sing O Canada?
+ ]]>
+
+ 6
+ 7
+ 8
+ 9
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f11.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f11.xml
new file mode 100644
index 00000000..9b185bd6
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f11.xml
@@ -0,0 +1,21 @@
+
+
+
+
+ Assume that you answer each question uniformly at random, where the choices for different questions are
+ independent of each other.
+
+ What is the probability that you have exactly 17 correct answers?
+ ]]>
+
+ ${25 \choose 17} \cdot \left( 1 \middle/ 4 \right)^{17}$
+ ${25 \choose 17} \cdot \left( 3 \middle/ 4 \right)^{17}$
+
+ ${25 \choose 17} \cdot \left( 1 \middle/ 4 \right)^{17} \cdot \left( 3 \middle/ 4 \right)^8$
+
+
+ ${25 \choose 17} \cdot \left( 1 \middle/ 4 \right)^8 \cdot \left( 3 \middle/ 4 \right)^{17}$
+
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f12.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f12.xml
new file mode 100644
index 00000000..bfb8a064
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f12.xml
@@ -0,0 +1,19 @@
+
+
+ palindrome if
+ $$
+ b_1b_2{\dots}b_{n-1}b_n = b_nb_{n-1}{\dots}b_2b_1,
+ $$
+ i.e., reading the string from left to right gives the same result as reading the string from right
+ to left.
+
+ Let $n \geq 2$ be an even integer. You are given a uniformly random bitstring of length $n$. What is
+ the probability that this bitstring is a palindrome?
+ ]]>
+
+ $(1/2)^{n}$
+ $(1/2)^{n/2}$
+ $(1/2)^{2n}$
+ $1/2$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f13.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f13.xml
new file mode 100644
index 00000000..626aa388
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f13.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ 3/16
+ 4/16
+ 5/16
+ 6/16
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f14.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f14.xml
new file mode 100644
index 00000000..e1e5c7d6
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f14.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ Consider the string
+ $$
+ a_1 + b_1,a_2 + b_2,\dots,a_n + b_n.
+ $$
+ What is the probability that each element in this string is non-zero?
+ ]]>
+
+ $1 - (1/4)^{n}$
+ $1 - (3/4)^{n}$
+ $(1/4)^{n}$
+ $(3/4)^{n}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f15.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f15.xml
new file mode 100644
index 00000000..a07ab805
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f15.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f16.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f16.xml
new file mode 100644
index 00000000..b4456ce3
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f16.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f17.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f17.xml
new file mode 100644
index 00000000..30a47175
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f17.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ $1 - (1/2)^{7}$
+ $(1/2)^{7}$
+ $1 - \frac{{50 \choose 7}}{{100 \choose 7}}$
+ $\frac{{50 \choose 7}}{{100 \choose 7}}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f18.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f18.xml
new file mode 100644
index 00000000..38f195ef
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f18.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+ $X = \bigg\{$ |
+ $1\ $ |
+ if the red coin flip resulted in heads$,$ |
+
+
+ $0\ $ |
+ if the red coin flip resulted in tails$,$ |
+
+
+ $Y = \bigg\{$ |
+ $1\ $ |
+ if the blue coin flip resulted in heads$,$ |
+
+
+ $0\ $ |
+ if the blue coin flip resulted in tails$,$ |
+
+
+
+
+ and
+ [defs]
+ Z = $\max(X,Y).$
+ [/defs]
+ What is the expected value $\mathbb{E}(Z)$ of the random variable $Z$?
+ ]]>
+
+ 1/4
+ 1/2
+ 3/4
+ 1
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f19.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f19.xml
new file mode 100644
index 00000000..3e27f13a
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f19.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ Define the random variable $X$ to be the number of indices $i$ with $1 \leq i < n$ for which $b_i \neq b_{i+1}$.
+
+ What is the expected value $\mathbb{E}(X)$ of the random variable $X$?
+ Hint: Use indicator random variables.
+ ]]>
+
+ $\frac{n-1}{2}$
+ $\frac{n}{2}$
+ $\frac{n+1}{2}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f20.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f20.xml
new file mode 100644
index 00000000..25b953af
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f20.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ ${\sum_{k=1}^{100}} k \cdot \frac{k^{2}}{100^{2}}$
+ ${\sum_{k=1}^{100}} k \cdot \frac{k(k-1)}{100^{2}}$
+ ${\sum_{k=1}^{100}} k \cdot \frac{2k}{100^{2}}$
+ ${\sum_{k=1}^{100}} k \cdot \left( \frac{1+2(k-1)}{100^{2}} \right)$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f21.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f21.xml
new file mode 100644
index 00000000..edfab514
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f21.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ The random variables $X$ and $Y$ are independent.
+ The random variables $X$ and $Y$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f22.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f22.xml
new file mode 100644
index 00000000..da7942e1
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f22.xml
@@ -0,0 +1,48 @@
+
+
+
+ $\newcommand{\WhoGoesFirst}{{\rm W {\scriptsize HO} G {\scriptsize OES} F {\scriptsize IRST}}}
+ \newcommand{\thensp}{\phantom{\mathbf{then}\ }}$
+
+
+ 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}$
+
+
+ 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.
+ What is the expected value $\mathbb{E}(X)$ of the random variable $X$?
+ ]]>
+
+ 3/2
+ 5/4
+ 5/6
+ 6/5
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f23.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f23.xml
new file mode 100644
index 00000000..0d776fc0
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f23.xml
@@ -0,0 +1,14 @@
+
+
+
+ For any random variable $X$, $\mathbb{E}\left(1 \middle/ X \right) = 1 / \mathbb{E}(X)$.
+
+ ]]>
+
+ The statement is true.
+ The statement is false.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f24.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f24.xml
new file mode 100644
index 00000000..0faf30e2
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f24.xml
@@ -0,0 +1,44 @@
+
+
+
+ The Carleton Computer Science Society (CCSS) is having their annual Christmas Holiday Season Party, which
+ is attended by $n$ students.
+
+
+
+
+
+ (a) |
+
+ $k$ of these $n$ students are politically correct and, thus, refuse to say Merry Christmas.
+ Instead, they say Happy Holidays.
+ |
+
+
+ (b) |
+
+ $n - k$ of these $n$ students do not care about political correctness and, thus, they say
+ Merry Christmas.
+ |
+
+
+
+
+ Consider a uniformly random permutation of these $n$ students. The positions in this permutation are numbered
+ as $1,2,...,n$.
+
+ Define the following random variable $X$:
+ [defs]
+ X = the number of positions $i$ with $1 \leq i \leq \left. n \middle/ 2 \right.$ such that both students at positions $i$ and $2i$ are politically correct.
+ [/defs]
+
+ What is the expected value $\mathbb{E}(X)$ of the random variable $X$?
+ Hint: Use indicator random variables.
+ ]]>
+
+ $n \cdot \frac{k(k - 1)}{n(n - 1)}$
+ $n \cdot \frac{(k - 1)(k - 2)}{n(n - 1)}$
+ $\frac{n}{2} \cdot \frac{k(k - 1)}{n(n - 1)}$
+ $\frac{n}{2} \cdot \frac{(k - 1)(k - 2)}{n(n - 1)}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2017/f17f25.xml b/app/src/data/questions/comp2804/exam-fall-2017/f17f25.xml
new file mode 100644
index 00000000..d8bd1037
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2017/f17f25.xml
@@ -0,0 +1,6 @@
+
+
+ How do you feel about writing an exam on Friday evening?
+
+ I would rather sit in the pub and have a beer.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/exam-fall-2018.json b/app/src/data/questions/comp2804/exam-fall-2018/exam-fall-2018.json
new file mode 100644
index 00000000..4a91b0f6
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/exam-fall-2018.json
@@ -0,0 +1,32 @@
+{
+ "id": "exam-fall-2018",
+ "title": "Fall 2018 Exam",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/exam-fall-2018/f18f01.xml",
+ "comp2804/exam-fall-2018/f18f02.xml",
+ "comp2804/exam-fall-2018/f18f03.xml",
+ "comp2804/exam-fall-2018/f18f04.xml",
+ "comp2804/exam-fall-2018/f18f05.xml",
+ "comp2804/exam-fall-2018/f18f06.xml",
+ "comp2804/exam-fall-2018/f18f07.xml",
+ "comp2804/exam-fall-2018/f18f08.xml",
+ "comp2804/exam-fall-2018/f18f09.xml",
+ "comp2804/exam-fall-2018/f18f10.xml",
+ "comp2804/exam-fall-2018/f18f11.xml",
+ "comp2804/exam-fall-2018/f18f12.xml",
+ "comp2804/exam-fall-2018/f18f13.xml",
+ "comp2804/exam-fall-2018/f18f14.xml",
+ "comp2804/exam-fall-2018/f18f15.xml",
+ "comp2804/exam-fall-2018/f18f16.xml",
+ "comp2804/exam-fall-2018/f18f17.xml",
+ "comp2804/exam-fall-2018/f18f18.xml",
+ "comp2804/exam-fall-2018/f18f19.xml",
+ "comp2804/exam-fall-2018/f18f20.xml",
+ "comp2804/exam-fall-2018/f18f21.xml",
+ "comp2804/exam-fall-2018/f18f22.xml",
+ "comp2804/exam-fall-2018/f18f23.xml",
+ "comp2804/exam-fall-2018/f18f24.xml",
+ "comp2804/exam-fall-2018/f18f25.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f01.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f01.xml
new file mode 100644
index 00000000..72a0fcca
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f01.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $70 \cdot 2^{69}$
+ $70 \cdot 3^{69}$
+ $70 \cdot 2^{70}$
+ $70 \cdot 3^{70}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f02.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f02.xml
new file mode 100644
index 00000000..643cb34a
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f02.xml
@@ -0,0 +1,12 @@
+
+
+ and exactly 30 letters $b$?
+ ]]>
+
+ ${70 \choose 12} + {58 \choose 30}$
+ ${70 \choose 12} \cdot {58 \choose 30}$
+ ${70 \choose 12} \cdot {58 \choose 30} \cdot 2^{28}$
+ ${70 \choose 12} \cdot {58 \choose 30} \cdot 3^{28}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f03.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f03.xml
new file mode 100644
index 00000000..c7625bb6
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f03.xml
@@ -0,0 +1,12 @@
+
+
+ or exactly 30 letters $b$?
+ ]]>
+
+ ${70 \choose 12} + {70 \choose 30} - {58 \choose 30}$
+ ${70 \choose 12} \cdot 2^{58} + {70 \choose 30} \cdot 2^{40}$
+ ${70 \choose 12} \cdot 2^{58} + {70 \choose 30} \cdot 2^{40} - {70 \choose 12} \cdot {58 \choose 30}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f04.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f04.xml
new file mode 100644
index 00000000..a2ea5fa3
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f04.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $3^{70} - 2^{70} - 70 \cdot 2^{69}$
+ $3^{70} - 2^{70} - 70 \cdot 2^{69} - {70 \choose 2} \cdot 2^{68}$
+ $\sum_{k=4}^{70} {70 \choose k} \cdot 2^{k}$
+ $\sum_{k=4}^{70} {70 \choose k} \cdot 2^{70-k}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f05.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f05.xml
new file mode 100644
index 00000000..85f2b9a9
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f05.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ The number of subsets of $S$ that are non-empty.
+ The number of subsets of $S$ that contain at least two elements.
+ The number of bitstrings of length $n$ that contain at least one 0.
+ The number of bitstrings of length $n$ that contain at least three 0's.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f06.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f06.xml
new file mode 100644
index 00000000..5d4a231d
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f06.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ ${55 \choose 20} \cdot 5^{35} \cdot 3^{20}$
+ $- {55 \choose 20} \cdot 5^{35} \cdot 3^{20}$
+ ${55 \choose 35} \cdot 5^{20} \cdot 3^{35}$
+ $- {55 \choose 35} \cdot 5^{20} \cdot 3^{35}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f07.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f07.xml
new file mode 100644
index 00000000..336f0ad7
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f07.xml
@@ -0,0 +1,17 @@
+
+
+
+ SUCCESS
+
+ is called awesome, if the string contains the substring UE or EU.
+ Thus, both SCUESCS and SCSEUCS are awesome, whereas SUCCESS is not awesome.
+ What is the number of awesome strings?
+ ]]>
+
+ 30
+ 60
+ 90
+ 120
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f08.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f08.xml
new file mode 100644
index 00000000..0a0959d0
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f08.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ $S_n = S_{n-2} + S_{n-4}$
+ $S_n = 2 \cdot S_{n-2} + S_{n-4}$
+ $S_n = S_{n-2} + 4 \cdot S_{n-4}$
+ $S_n = 2 \cdot S_{n-2} + 4 \cdot S_{n-4}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f09.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f09.xml
new file mode 100644
index 00000000..e146ba52
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f09.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $S_n = S_{n-1} + S_{n-2} + 1$
+ $S_n = S_{n-1} + S_{n-2} + 2^{n-2}$
+ $S_n = S_{n-1} + S_{n-2} + 2^{n-3}$
+ $S_n = S_{n-1} + S_{n-2} + S_{n-3}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f10.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f10.xml
new file mode 100644
index 00000000..2638ff06
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f10.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ $T(n) = \frac{5}{2} \cdot 3^{n} - 1$
+ $T(n) = \frac{3}{2} \cdot 3^{n} - \frac{1}{2}$
+ $T(n) = \frac{5}{2} \cdot 3^{n} - \frac{1}{2}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f11.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f11.xml
new file mode 100644
index 00000000..cf01ce24
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f11.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ 2/3
+ 1/2
+ 1/3
+ 1/4
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f12.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f12.xml
new file mode 100644
index 00000000..207dfc4f
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f12.xml
@@ -0,0 +1,15 @@
+
+
+ suit and a rank.
+ There are four suits (spades ♠, hearts ♡, clubs ♣, and diamonds ♢),
+ and 13 ranks (Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, and King).
+ Assume you get a uniformly random hand consisting of 5 cards. What is the probability that the 5
+ cards in this hand are all of the same suit?
+ ]]>
+
+ $\left. {13 \choose 5} \middle/ {52 \choose 5} \right.$
+ $\left. {52 \choose 5} \middle/ {13 \choose 5} \right.$
+ $4 \cdot \left. {13 \choose 5} \middle/ {52 \choose 5} \right.$
+ $4 \cdot \left. {52 \choose 5} \middle/ {13 \choose 5} \right.$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f13.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f13.xml
new file mode 100644
index 00000000..39c7ce64
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f13.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ 2/7
+ 1/7
+ 2/11
+ 1/11
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f14.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f14.xml
new file mode 100644
index 00000000..4591cc23
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f14.xml
@@ -0,0 +1,20 @@
+
+
+
+ You are given two bitstrings $a_1,a_2,\dots,a_n$ and $b_1,b_2,\dots,b_n$ of length $n$. In both
+ bitstrings, each bit is 0 with probability 1/2, and 1 with probability 1/2 (independent of all
+ other bits).
+ Consider the bitstring
+ $$
+ a_1 \cdot b_1,a_2 \cdot b_2,\dots,a_n \cdot b_n
+ $$
+ where $a_i \cdot b_i$ is the result of multiplying the two bits $a_i$ and $b_i$. What is the probability that this
+ bitstring contains exactly $k$ many 1's?
+ ]]>
+
+ ${n \choose k} \cdot \left. 3^{n - k} \middle/ 4^n \right.$
+ ${n \choose k} \cdot \left. 4^{n - k} \middle/ 3^n \right.$
+ ${n \choose k} \cdot \left. 4^{n - k} \middle/ 3^k \right.$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f15.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f15.xml
new file mode 100644
index 00000000..01e60019
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f15.xml
@@ -0,0 +1,17 @@
+
+
+ a_2$",
+ B = "$a_4 > a_3$".
+ [/defs]
+ Which of the following is correct?
+ ]]>
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+ All of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f16.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f16.xml
new file mode 100644
index 00000000..9d4dd721
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f16.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+ All of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f17.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f17.xml
new file mode 100644
index 00000000..38f4fb99
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f17.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ 5/6
+ 2/3
+ 3/4
+ 1/3
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f18.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f18.xml
new file mode 100644
index 00000000..e24001c9
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f18.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ 9/13
+ 13/9
+ 8/9
+ 9/8
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f19.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f19.xml
new file mode 100644
index 00000000..a0ed5c5c
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f19.xml
@@ -0,0 +1,17 @@
+
+
+
+ Define the random variable $X$ to be the number of indices $i$ with $1 \leq i < n$
+ for which $c_i = c_{i+1}$.
+ What is the expected value $\mathbb{E}(X)$ of the random variable $X$?
+ Hint: Use indicator random variables.
+ ]]>
+
+ $\left. n \middle/ 25 \right.$
+ $\left. (n - 1) \middle/ 25 \right.$
+ $\left. n \middle/ 5 \right.$
+ $\left. (n - 1) \middle/ 5 \right.$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f20.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f20.xml
new file mode 100644
index 00000000..f1f3f0d4
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f20.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ $\frac{2 {{n}\choose{2}} + n}{{{n+2}\choose{3}}}$
+ $\frac{2 {{n}\choose{2}} + n + 1}{{{n+2}\choose{3}}}$
+ $\frac{2 {{n}\choose{2}} + 2n}{{{n+2}\choose{3}}}$
+ $\frac{2 {{n}\choose{2}} + n - 1}{{{n+2}\choose{3}}}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f21.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f21.xml
new file mode 100644
index 00000000..ae7aba26
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f21.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+ $\Pr(X = 0)$ |
+
+ $= \Pr(X = 1) = \Pr(Y = 0)$
+ $= \Pr(Y = 1) = 1/2.$
+ |
+
+
+
+
+ Define the random variable
+ $$
+ Z = (X + Y)\ \mathrm{mod}\ 2.
+ $$
+ Which of the following is correct?
+ ]]>
+
+ The random variables $X$ and $Z$ are independent.
+ The random variables $X$ and $Z$ are not independent.
+ None of the above.
+ All of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f22.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f22.xml
new file mode 100644
index 00000000..9769789e
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f22.xml
@@ -0,0 +1,55 @@
+
+
+
+ $\newcommand{\TriIsHungry}{{\rm T {\scriptsize RI} I {\scriptsize S} H {\scriptsize UNGRY}}}$
+
+
+ Zoltan's Noodle House is a popular restaurant in downtown Ottawa. When you order the surprise dish,
+ you get Mi Quang with probability 1/4, Bun Cha Ca with probability 1/3, and
+ Banh Xeo with probability 5/12.
+ Tri enjoys going to this restaurant, because the food reminds him of his mommy's food back home in Da Nang.
+ Tri runs the following recursive algorithm:
+
+
+
+ $\mathbf{Algorithm}\ \TriIsHungry\mathrm{:}$
+
+
+
+ $//$ |
+
+ $\text{the results of all}$ $\text{orders are independent}$
+ |
+
+
+
+ $\text{Tri orders the surprise dish;}$
+ $\mathbf{if}\ \mathrm{Tri}\ \mathrm{gets}\ \mathit{Mi}\ \mathit{Quang}$
+ $\mathbf{then}\ \text{Tri eats the dish;}$
+ $\qquad\ \ \TriIsHungry$
+ $\mathbf{else}\ \mathbf{if}\ \mathrm{Tri}\ \mathrm{gets}\ \mathit{Bun}\ \mathit{Cha}\ \mathit{Ca}$
+ $\qquad\, \mathbf{then}\ \text{Tri eats the dish;}$
+ $\qquad \qquad\ \ \, \TriIsHungry$
+ $\qquad\, \mathbf{else}\ \text{Tri eats the dish;}$
+
+
+
+ $\hspace{4.05em}$ |
+ $\text{Tri pays the bill}$ $\text{and goes home}$ |
+
+
+
+ $\qquad\, \mathbf{endif}$
+ $\mathbf{endif}$
+
+
+ Define the random variable $X$ to be the number of dishes that Tri eats when running algorithm $\TriIsHungry$.
+ What is the expected value $\mathbb{E}(X)$ of the random variable $X$?
+ ]]>
+
+ 5/12
+ 12/5
+ 5/7
+ 7/5
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f23.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f23.xml
new file mode 100644
index 00000000..9166ede4
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f23.xml
@@ -0,0 +1,25 @@
+
+
+
+
+ Jim is one of the students and answers the 25 questions, by choosing a uniformly random answer for
+ each question; the choices are independent of each other.
+
+ Define the random variable
+ [defs]
+ X = the number of marks that Jim recevies.
+ [/defs]
+ For what value of $z$ is the expected value $\mathbb{E}(X)$ equal to 0?
+
+ Hint: Use the Linearity of Expectation.
+ ]]>
+
+ $z = 1/4$
+ $z = 1/3$
+ $z = 1/2$
+ $z = 3/4$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f24.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f24.xml
new file mode 100644
index 00000000..5f48fcb9
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f24.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ At the end of the exam, the proctor places the backpacks in a uniformly random order $b_1,b_2,\dots,b_n$,
+ and, for each $i = 1, 2, ..., n$, gives backpack $b_i$ to student $S_i$.
+
+ Define the following random variable $X$:
+ [defs]
+ X = the number of students who get their own backpack.
+ [/defs]
+ What is the expected value $\mathbb{E}(X)$ of the random variable $X$?
+ Hint: Use indicator random variables.
+ ]]>
+
+ 1
+ 2
+ $\left. (n + 1) \middle/ n \right.$
+ $\left. (n - 1) \middle/ n \right.$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2018/f18f25.xml b/app/src/data/questions/comp2804/exam-fall-2018/f18f25.xml
new file mode 100644
index 00000000..ff04a7f8
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2018/f18f25.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ Professor Identity
+ Donald Trump
+ Alexandre-Théophile Vandermonde
+ Justin Bieber
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/exam-fall-2019.json b/app/src/data/questions/comp2804/exam-fall-2019/exam-fall-2019.json
new file mode 100644
index 00000000..ef574092
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/exam-fall-2019.json
@@ -0,0 +1,32 @@
+{
+ "id": "exam-fall-2019",
+ "title": "Fall 2019 Exam",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/exam-fall-2019/f19f01.xml",
+ "comp2804/exam-fall-2019/f19f02.xml",
+ "comp2804/exam-fall-2019/f19f03.xml",
+ "comp2804/exam-fall-2019/f19f04.xml",
+ "comp2804/exam-fall-2019/f19f05.xml",
+ "comp2804/exam-fall-2019/f19f06.xml",
+ "comp2804/exam-fall-2019/f19f07.xml",
+ "comp2804/exam-fall-2019/f19f08.xml",
+ "comp2804/exam-fall-2019/f19f09.xml",
+ "comp2804/exam-fall-2019/f19f10.xml",
+ "comp2804/exam-fall-2019/f19f11.xml",
+ "comp2804/exam-fall-2019/f19f12.xml",
+ "comp2804/exam-fall-2019/f19f13.xml",
+ "comp2804/exam-fall-2019/f19f14.xml",
+ "comp2804/exam-fall-2019/f19f15.xml",
+ "comp2804/exam-fall-2019/f19f16.xml",
+ "comp2804/exam-fall-2019/f19f17.xml",
+ "comp2804/exam-fall-2019/f19f18.xml",
+ "comp2804/exam-fall-2019/f19f19.xml",
+ "comp2804/exam-fall-2019/f19f20.xml",
+ "comp2804/exam-fall-2019/f19f21.xml",
+ "comp2804/exam-fall-2019/f19f22.xml",
+ "comp2804/exam-fall-2019/f19f23.xml",
+ "comp2804/exam-fall-2019/f19f24.xml",
+ "comp2804/exam-fall-2019/f19f25.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f01.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f01.xml
new file mode 100644
index 00000000..98333659
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f01.xml
@@ -0,0 +1,10 @@
+
+
+ How many such strings have exactly 5 letters $c$?
+ ]]>
+ ${85 \choose 5} \cdot 3^{80}$
+ ${85 \choose 5} \cdot 3^{85}$
+ ${85 \choose 5} \cdot 4^{80}$
+ ${85 \choose 5} \cdot 4^{85}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f02.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f02.xml
new file mode 100644
index 00000000..00465258
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f02.xml
@@ -0,0 +1,10 @@
+
+
+ How many such strings have exactly 15 letters $a$ and exactly 30 letters $d$?
+ ]]>
+ ${85 \choose 15} \cdot {70 \choose 30} \cdot 2^{40}$
+ ${85 \choose 15} \cdot {70 \choose 30} \cdot 3^{40}$
+ ${85 \choose 15} \cdot {70 \choose 30} \cdot 4^{40}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f03.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f03.xml
new file mode 100644
index 00000000..84e3db5d
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f03.xml
@@ -0,0 +1,12 @@
+
+
+ How many such strings have exactly 15 letters $a$ or exactly 30 letters $d$?
+ ]]>
+ ${85 \choose 15} \cdot 3^{70} + {85 \choose 30} \cdot 3^{55}$
+
+ ${85 \choose 15} \cdot 3^{70} + {85 \choose 30} \cdot 3^{55} - {85 \choose 15} \cdot {70 \choose 30} \cdot 2^{40}$
+
+ ${85 \choose 15} \cdot 4^{70} + {85 \choose 30} \cdot 4^{55}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f04.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f04.xml
new file mode 100644
index 00000000..e723fd58
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f04.xml
@@ -0,0 +1,13 @@
+
+
+ Consider subsets of these 70 bottles, that contain exactly 12 beer bottles (and any number of cider bottles)
+ or exactly 12 cider bottles (and any number of beer bottles). How many such subsets are there?
+ ]]>
+ ${20 \choose 12} + {50 \choose 12}$
+ ${20 \choose 12} + {50 \choose 12} - {20 \choose 12} \cdot {50 \choose 12}$
+ ${20 \choose 12} \cdot 2^{50} + {50 \choose 12} \cdot 2^{20}$
+
+ ${20 \choose 12} \cdot 2^{50} + {50 \choose 12} \cdot 2^{20} - {20 \choose 12} \cdot {50 \choose 12}$
+
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f05.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f05.xml
new file mode 100644
index 00000000..9bede1e5
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f05.xml
@@ -0,0 +1,13 @@
+
+
+ Consider subsets of these 70 bottles, that contain at least 3 beer bottles (and any number of cider bottles).
+ How many such subsets are there?
+ ]]>
+ $2^{70} - 2^{50} - 20 - {20 \choose 2}$
+
+ $2^{70} - 2^{50} - 20 \cdot 2^{50} - {20 \choose 2} \cdot 2^{50}$
+
+ $2^{70} - 2^{50} - 20 \cdot 2^{50}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f06.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f06.xml
new file mode 100644
index 00000000..670f6f9c
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f06.xml
@@ -0,0 +1,15 @@
+
+
+ Let $m \geq 2$ and $n \geq 2$ be integers. What does
+ $$
+ {m \choose 2} + {n \choose 2} + m \cdot n
+ $$
+ count?
+
+ The number of ways to choose a subset from a set consisting of $m + n$ elements.
+ The number of ways to choose an ordered pair of 2 elements from a set consisting of $m + n$ elements.
+
+ The number of ways to choose a 2-element subset from a set consisting of $m + n$ elements.
+
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f07.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f07.xml
new file mode 100644
index 00000000..3ce098d8
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f07.xml
@@ -0,0 +1,12 @@
+
+
+ Nick eats lots of bananas. During a period of 7 days, Nick eats a total of 25 bananas. A banana schedule
+ is a sequence of 7 numbers, whose sum is equal to 25, and whose numbers indicate the number of bananas
+ that Nick eats on each day. Three examples of such schedules are (3,2,7,4,1,3,5), (2,3,7,4,1,3,5), and
+ (3,0,9,4,1,0,8). How many banana schedules are there?
+
+ ${31 \choose 6}$
+ ${31 \choose 7}$
+ ${32 \choose 6}$
+ ${32 \choose 7}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f08.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f08.xml
new file mode 100644
index 00000000..9fea4814
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f08.xml
@@ -0,0 +1,11 @@
+
+ awesome, if
+ the string does not contain the substring OO. Thus, GEOROB is awesome, whereas GREOOB is not awesome.
+ What is the number of awesome strings?
+ ]]>
+ $6 \cdot {5 \choose 2} \cdot 3 \cdot 2$
+ $(6 \cdot {5 \choose 2} \cdot 3 \cdot 2) - 5!$
+ $6! - 5!$
+ $(6 \cdot {5 \choose 2} \cdot 3) - 5!$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f09.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f09.xml
new file mode 100644
index 00000000..37d66145
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f09.xml
@@ -0,0 +1,11 @@
+
+
+ $S_n = S_{n - 1} + S_{n - 2} + S_{n - 3}$
+ $S_n = S_{n - 1} + S_{n - 2} + 2^{n - 2}$
+ $S_n = S_{n - 1} + S_{n - 2} + 2^{n - 3}$
+ $S_n = S_{n - 1} + S_{n - 2} + 1$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f10.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f10.xml
new file mode 100644
index 00000000..1fdc799e
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f10.xml
@@ -0,0 +1,26 @@
+
+
+ $\newcommand{\IFeelLikeSinging}{{\rm IF {\scriptsize EEL} L {\scriptsize IKE} S {\scriptsize INGING}}}$
+
+
+ Consider the recursive algorithm $\IFeelLikeSinging$, which takes as input an integer $n \geq 0$:
+
+
+ $\IFeelLikeSinging(n):$
+ $\quad \mathbf{if}\ n = 0\ \mathrm{or}\ n = 1\ \mathbf{then}$
+ $\quad \quad \text{sing O Canada}$
+ $\quad \mathbf{else}\ \mathbf{if}\ n\ \text{is odd}\ \mathbf{then}$
+ $\quad \quad \IFeelLikeSinging(n + 1)$
+ $\quad \mathbf{else}$
+ $\quad \quad \IFeelLikeSinging(\frac{n}{2})$
+ $\quad \quad \IFeelLikeSinging(\frac{n}{2} - 1)$
+
+
+ If you run algorithm $\IFeelLikeSinging(9)$, how many times do you sing O Canada?
+ ]]>
+ 6
+ 7
+ 8
+ 9
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f11.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f11.xml
new file mode 100644
index 00000000..3c48d30f
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f11.xml
@@ -0,0 +1,16 @@
+
+
+ Assume you write a multiple-choice exam that has 25 questions. For each question, four options are given
+ to you, and exactly one of these options is the correct answer. Assume that you answer each question
+ uniformly at random, where the choices for different questions are independent of each other. What is the
+ probability that you have exactly 17 correct answers?
+
+ ${25 \choose 17} \cdot \left( 1 \middle/ 4 \right)^{17}$
+ ${25 \choose 17} \cdot \left( 3 \middle/ 4 \right)^{17}$
+
+ ${25 \choose 17} \cdot \left( 1 \middle/ 4 \right)^{17} \cdot \left( 3 \middle/ 4 \right)^8$
+
+
+ ${25 \choose 17} \cdot \left( 1 \middle/ 4 \right)^8 \cdot \left( 3 \middle/ 4 \right)^{17}$
+
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f12.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f12.xml
new file mode 100644
index 00000000..ba36ef52
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f12.xml
@@ -0,0 +1,15 @@
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f13.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f13.xml
new file mode 100644
index 00000000..d2081ed7
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f13.xml
@@ -0,0 +1,19 @@
+
+
+ When Nika writes the exam, what is the expected number of questions that appear on the exam and that
+ Nika has practiced on?
+
+
+ (n.b., depending on your background, it may be helpful to observe that this can be modelled using the hypergeometric
+ distribution)
+ ]]>
+ 2
+ 5
+ 10
+ 20
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f14.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f14.xml
new file mode 100644
index 00000000..1e4d0f5d
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f14.xml
@@ -0,0 +1,10 @@
+
+
+ Continuing from the previous question, what is the probability that Nika has not practiced on any of the
+ actual exam questions?
+
+ 0
+ $\left. {225 \choose 50} \middle/ {250 \choose 50} \right.$
+ $\left. {225 \choose 25} \middle/ {250 \choose 50} \right.$
+ $\left. {225 \choose 25} \middle/ {225 \choose 50} \right.$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f15.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f15.xml
new file mode 100644
index 00000000..3c8e0980
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f15.xml
@@ -0,0 +1,16 @@
+
+
+ $\frac{{4 \choose 2}}{{5 \choose 2} + {4 \choose 2}}$
+ $\frac{{5 \choose 2} + {4 \choose 2}}{{4 \choose 2}}$
+ $\frac{{4 \choose 2}}{{9 \choose 2}}$
+ $\frac{{4 \choose 2}}{{5 \choose 2} \cdot {4 \choose 2}}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f16.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f16.xml
new file mode 100644
index 00000000..67e50890
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f16.xml
@@ -0,0 +1,16 @@
+
+
+ 3/10
+ 1/3
+ 1/2
+ 2/3
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f17.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f17.xml
new file mode 100644
index 00000000..7165fd5a
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f17.xml
@@ -0,0 +1,15 @@
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f18.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f18.xml
new file mode 100644
index 00000000..d2aad426
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f18.xml
@@ -0,0 +1,15 @@
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f19.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f19.xml
new file mode 100644
index 00000000..b851a637
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f19.xml
@@ -0,0 +1,17 @@
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f20.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f20.xml
new file mode 100644
index 00000000..39052993
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f20.xml
@@ -0,0 +1,12 @@
+
+
+ 2
+ 1
+ 1/4
+ 1/2
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f21.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f21.xml
new file mode 100644
index 00000000..cff9248e
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f21.xml
@@ -0,0 +1,18 @@
+
+
+ What is the expected value $\mathbb{E}(X)$ of the random variable $X$?
+
+
+ Hint: Use indicator random variables.
+ ]]>
+ $\frac{2}{3} \cdot n$
+ $\frac{2}{3} \cdot (n - 1)$
+ $\frac{4}{9} \cdot n$
+ $\frac{4}{9} \cdot (n - 1)$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f22.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f22.xml
new file mode 100644
index 00000000..14584456
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f22.xml
@@ -0,0 +1,21 @@
+
+
+ Experiment: Roll each die once and take the sum of the two rolls. You repeat this experiment until
+ the sum of the two rolls is equal to 7. Consider the random variable
+
+
+ [defs]
+ X = the number of times you do the experiment.
+ [/defs]
+
+ (This value $X$ includes the experiment in which the sum is 7 for the first time.)
+ What is the expected value $\mathbb{E}(X)$ of the random variable $X$?
+ ]]>
+ 6
+ 5
+ 4
+ 3
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f23.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f23.xml
new file mode 100644
index 00000000..a1ac8a97
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f23.xml
@@ -0,0 +1,12 @@
+
+
+ For any random variable $X$, $\mathbb{E}\left(1 \middle/ X \right) = 1 / \mathbb{E}(X)$.
+
+ ]]>
+ The statement is true.
+ The statement is false.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f24.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f24.xml
new file mode 100644
index 00000000..34b6e471
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f24.xml
@@ -0,0 +1,46 @@
+
+ Christmas Holiday Season Party, which
+ is attended by $n$ students.
+
+
+
+
+
+ (i) |
+
+ $k$ of these $n$ students are politically correct and, thus, refuse to say Merry Christmas.
+ Instead, they say Happy Holidays.
+ |
+
+
+ (ii) |
+
+ $n - k$ of these $n$ students do not care about political correctness and, thus, they say
+ Merry Christmas.
+ |
+
+
+
+
+ Consider a uniformly random permutation of these $n$ students. The positions in this permutation are numbered
+ as $1,2,...,n$.
+
+
+ Define the random variable $X$ as the number of positions $i$ with $1 \leq i \leq \left. n \middle/2 \right.$
+ such that both students at positions $i$ and $2i$ are politically correct.
+
+
+ What is the expected value $\mathbb{E}(X)$ of the random variable $X$?
+
+
+ Hint: Use indicator random variables.
+
+ ]]>
+ $n \cdot \frac{k(k - 1)}{n(n - 1)}$
+ $n \cdot \frac{(k - 1)(k - 2)}{n(n - 1)}$
+ $\frac{n}{2} \cdot \frac{k(k - 1)}{n(n - 1)}$
+ $\frac{n}{2} \cdot \frac{(k - 1)(k - 2)}{n(n - 1)}$
+
diff --git a/app/src/data/questions/comp2804/exam-fall-2019/f19f25.xml b/app/src/data/questions/comp2804/exam-fall-2019/f19f25.xml
new file mode 100644
index 00000000..66df427a
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-fall-2019/f19f25.xml
@@ -0,0 +1,10 @@
+
+
+ How do you feel about writing an exam on Friday evening?
+
+ I would rather sit in the pub and have a beer.
+ I would rather sit in the pub and have a beer.
+ I would rather sit in the pub and have a beer.
+ I would rather sit in the pub and have a beer.
+ I would rather sit in the pub and have a beer.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/exam-winter-2014.json b/app/src/data/questions/comp2804/exam-winter-2014/exam-winter-2014.json
new file mode 100644
index 00000000..9c2ed18d
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/exam-winter-2014.json
@@ -0,0 +1,32 @@
+{
+ "id": "exam-winter-2014",
+ "title": "Winter 2014 Exam",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/exam-winter-2014/w14f01.xml",
+ "comp2804/exam-winter-2014/w14f02.xml",
+ "comp2804/exam-winter-2014/w14f03.xml",
+ "comp2804/exam-winter-2014/w14f04.xml",
+ "comp2804/exam-winter-2014/w14f05.xml",
+ "comp2804/exam-winter-2014/w14f06.xml",
+ "comp2804/exam-winter-2014/w14f07.xml",
+ "comp2804/exam-winter-2014/w14f08.xml",
+ "comp2804/exam-winter-2014/w14f09.xml",
+ "comp2804/exam-winter-2014/w14f10.xml",
+ "comp2804/exam-winter-2014/w14f11.xml",
+ "comp2804/exam-winter-2014/w14f12.xml",
+ "comp2804/exam-winter-2014/w14f13.xml",
+ "comp2804/exam-winter-2014/w14f14.xml",
+ "comp2804/exam-winter-2014/w14f15.xml",
+ "comp2804/exam-winter-2014/w14f16.xml",
+ "comp2804/exam-winter-2014/w14f17.xml",
+ "comp2804/exam-winter-2014/w14f18.xml",
+ "comp2804/exam-winter-2014/w14f19.xml",
+ "comp2804/exam-winter-2014/w14f20.xml",
+ "comp2804/exam-winter-2014/w14f21.xml",
+ "comp2804/exam-winter-2014/w14f22.xml",
+ "comp2804/exam-winter-2014/w14f23.xml",
+ "comp2804/exam-winter-2014/w14f24.xml",
+ "comp2804/exam-winter-2014/w14f25.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f01.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f01.xml
new file mode 100644
index 00000000..237c5365
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f01.xml
@@ -0,0 +1,13 @@
+
+
+ a, e, i, o, or u).
+ How many passwords are there?
+ ]]>
+
+ $5 \cdot 21^{27}$
+ $28 \cdot 5 \cdot 21^{27}$
+ $28 \cdot 5 \cdot 27^{21}$
+ $28 \cdot 5 \cdot 26^{27}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f02.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f02.xml
new file mode 100644
index 00000000..305b3e0a
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f02.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ ${10 \choose 1}26^9 + {10 \choose 2}26^8 + {10 \choose 3}26^7$
+ $10 \cdot 26^9 + 10^2 \cdot 26^8 + 10^3 \cdot 26^7$
+
+ ${10 \choose 1} \cdot 10 \cdot 26^9 + {10 \choose 2} \cdot 10^2 \cdot 26^8\ +$ $ {10 \choose 3} \cdot 10^3 \cdot 26^7$
+
+ none of the above
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f03.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f03.xml
new file mode 100644
index 00000000..97b8842d
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f03.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ $(-2)^{45}$
+ $4^{45}$
+ $(-8)^{45}$
+ $10^{45}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f04.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f04.xml
new file mode 100644
index 00000000..4248d008
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f04.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $7 \cdot 6!$
+ $2 \cdot 7 \cdot 6!$
+ $8 \cdot 6!$
+ $2 \cdot 8 \cdot 6!$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f05.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f05.xml
new file mode 100644
index 00000000..7567dc28
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f05.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $S_{n+1} = S_n + S_{n-1}\ \mathrm{for}\ n \geq 2.$
+ $S_{n+1} = 2 \cdot S_n + S_{n-1}\ \mathrm{for}\ n \geq 2.$
+ $S_{n+1} = S_n + 2 \cdot S_{n-1}\ \mathrm{for}\ n \geq 2.$
+ $S_{n+1} = 2 \cdot S_n + 2 \cdot S_{n-1}\ \mathrm{for}\ n \geq 2.$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f06.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f06.xml
new file mode 100644
index 00000000..1da6fd40
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f06.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ 30 weigh at least 150 pounds,
+
+
+ 60 are at least 6 feet tall,
+
+
+ 70 weigh less than 150 pounds and are less than 6 feet tall.
+
+
+ How many people weigh at least 150 pounds and are at least 6 feet tall?
+ ]]>
+
+ 10
+ 20
+ 30
+ 40
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f07.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f07.xml
new file mode 100644
index 00000000..a0bc0ee8
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f07.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ 64
+ 74
+ 84
+ 94
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f08.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f08.xml
new file mode 100644
index 00000000..c30601f2
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f08.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ $\frac{n!}{k(n-k)!}$
+ $\frac{n!}{k!(n-k)!}$
+ $\frac{n!}{(n-k)!}$
+ $\frac{2 \cdot n!}{(n-k)!}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f09.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f09.xml
new file mode 100644
index 00000000..88271ee2
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f09.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ ${780 \choose 3}$
+ ${780 \choose 4}$
+ ${781 \choose 3}$
+ ${781 \choose 4}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f10.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f10.xml
new file mode 100644
index 00000000..7b0f0a5d
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f10.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+ $f(0)$ |
+ $\;=\;$ |
+ $3,$ |
+
+
+ $f(n + 1)$ |
+ $\;=\;$ |
+ $f(n) + 10n + 2\; \ \text{for all}$ $\text{integers}\ n \geq 0.$ |
+
+
+
+ Which of the following is true?
+ ]]>
+
+ for all $n \geq 0$: $f(n) = 5n^{2} - 3n + 2$
+ for all $n \geq 0$: $f(n) = 5n^{2} - 3n + 3$
+ for all $n \geq 0$: $f(n) = 5n^{2} + 3n + 3$
+ for all $n \geq 0$: $f(n) = 5n^{2} - 2n + 3$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f11.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f11.xml
new file mode 100644
index 00000000..18421c17
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f11.xml
@@ -0,0 +1,30 @@
+
+
+
+ $\newcommand{\Fib}{{\rm F \scriptsize IB}}$
+
+
+ The Fibonacci numbers are defined as follows: $f_0 = 0$, $f_1 = 1$, and $f_n = f_{n-1} + f_{n-2}$ for
+ $n \geq 2$.
+
+ Consider the recursive algorithm $\Fib$, which takes as input an integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \Fib(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ f = n$
+ $\mathbf{else}\ f = \Fib(n - 1) + \Fib(n - 2)$
+ $\mathbf{endif};$
+ $\mathbf{return}\ f$
+
+
+ For $n \geq 5$, run algorithm $\Fib(n)$ and let $a_n$ be the number of times that $\Fib(4)$ is called.
+ Which of the following is true?
+ ]]>
+
+ for all $n \geq 5$, $a_n = f_n$
+ for all $n \geq 5$, $a_n = f_{n-1}$
+ for all $n \geq 5$, $a_n = f_{n-2}$
+ for all $n \geq 5$, $a_n = f_{n-3}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f12.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f12.xml
new file mode 100644
index 00000000..3d95ae0a
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f12.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ 4/16
+ 4/32
+ 5/16
+ 5/32
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f13.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f13.xml
new file mode 100644
index 00000000..008ee8f9
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f13.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $\frac{1}{100}$
+ $\frac{1}{100 \cdot 99}$
+ $\frac{1}{100 \cdot 100}$
+ $\frac{1}{{100 \choose 2}}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f14.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f14.xml
new file mode 100644
index 00000000..ecd3322e
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f14.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ 4/8
+ 5/8
+ 6/8
+ 7/8
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f15.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f15.xml
new file mode 100644
index 00000000..d8f8c3e0
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f15.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ 1/2
+ 1/4
+ 1/8
+ 1/9
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f16.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f16.xml
new file mode 100644
index 00000000..a186337c
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f16.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ 1/3
+ 1/2
+ 2/3
+ none of the above
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f17.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f17.xml
new file mode 100644
index 00000000..ce14074f
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f17.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ 1/5
+ 2/5
+ 3/5
+ 4/5
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f18.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f18.xml
new file mode 100644
index 00000000..59c42744
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f18.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $1 - \frac{12!}{12^{4} \cdot 7!}$
+ $1 - \frac{11!}{12^{4} \cdot 7!}$
+ $1 - \frac{11!}{12^{4} \cdot 6!}$
+ $1 - \frac{11!}{12^{4} \cdot 8!}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f19.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f19.xml
new file mode 100644
index 00000000..6764d249
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f19.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $\frac{1}{3}$
+ $\frac{1}{4}$
+ $\frac{1}{4} \cdot \frac{1}{3} + \frac{3}{4} \cdot \frac{1}{4}$
+ none of the above
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f20.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f20.xml
new file mode 100644
index 00000000..28865f75
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f20.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ 3
+ 2
+ 5/2
+ 3/2
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f21.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f21.xml
new file mode 100644
index 00000000..4158cb5c
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f21.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ Yes
+ No
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f22.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f22.xml
new file mode 100644
index 00000000..af3ac037
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f22.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ 27/4
+ 28/4
+ 29/4
+ 30/4
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f23.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f23.xml
new file mode 100644
index 00000000..e6f5cf95
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f23.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ 4
+ 5
+ 6
+ 7
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f24.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f24.xml
new file mode 100644
index 00000000..8365f4cf
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f24.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ $n/2$
+ $n/4$
+ $n/8$
+ $0$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2014/w14f25.xml b/app/src/data/questions/comp2804/exam-winter-2014/w14f25.xml
new file mode 100644
index 00000000..b9c4d8cd
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2014/w14f25.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ Justin Bieber
+ Fibonacci
+ Carl Friedrich Gauss
+ Simon Pratt
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/exam-winter-2015.json b/app/src/data/questions/comp2804/exam-winter-2015/exam-winter-2015.json
new file mode 100644
index 00000000..e6a0de60
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/exam-winter-2015.json
@@ -0,0 +1,32 @@
+{
+ "id": "exam-winter-2015",
+ "title": "Winter 2015 Exam",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/exam-winter-2015/w15f01.xml",
+ "comp2804/exam-winter-2015/w15f02.xml",
+ "comp2804/exam-winter-2015/w15f03.xml",
+ "comp2804/exam-winter-2015/w15f04.xml",
+ "comp2804/exam-winter-2015/w15f05.xml",
+ "comp2804/exam-winter-2015/w15f06.xml",
+ "comp2804/exam-winter-2015/w15f07.xml",
+ "comp2804/exam-winter-2015/w15f08.xml",
+ "comp2804/exam-winter-2015/w15f09.xml",
+ "comp2804/exam-winter-2015/w15f10.xml",
+ "comp2804/exam-winter-2015/w15f11.xml",
+ "comp2804/exam-winter-2015/w15f12.xml",
+ "comp2804/exam-winter-2015/w15f13.xml",
+ "comp2804/exam-winter-2015/w15f14.xml",
+ "comp2804/exam-winter-2015/w15f15.xml",
+ "comp2804/exam-winter-2015/w15f16.xml",
+ "comp2804/exam-winter-2015/w15f17.xml",
+ "comp2804/exam-winter-2015/w15f18.xml",
+ "comp2804/exam-winter-2015/w15f19.xml",
+ "comp2804/exam-winter-2015/w15f20.xml",
+ "comp2804/exam-winter-2015/w15f21.xml",
+ "comp2804/exam-winter-2015/w15f22.xml",
+ "comp2804/exam-winter-2015/w15f23.xml",
+ "comp2804/exam-winter-2015/w15f24.xml",
+ "comp2804/exam-winter-2015/w15f25.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f01.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f01.xml
new file mode 100644
index 00000000..103c29d5
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f01.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ ${20 \choose 7}$
+ ${5\choose 3} + {15 \choose 4}$
+ ${5 \choose 3}{15 \choose 4}$
+ ${5 \choose 4}{15 \choose 3}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f02.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f02.xml
new file mode 100644
index 00000000..c5d6b998
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f02.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+ ${5 \choose 5}{15 \choose 2} + {5 \choose 2}{15 \choose 5} + {5 \choose 1}{15 \choose 6} + {5 \choose 0}{15 \choose 7}$
+
+ ${5 \choose 5}{15 \choose 2} + {5 \choose 2}{15 \choose 5} - {5 \choose 5}{15 \choose 5}$
+ ${20 \choose 7} - {5 \choose 4}{15 \choose 4}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f03.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f03.xml
new file mode 100644
index 00000000..f3835277
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f03.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ $2^{73} + 2^{73}$
+ $2^{74} - 2^{69}$
+ $2^{77} - 2^{69}$
+ $2^{77} - 2^{73} - 2^{73}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f04.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f04.xml
new file mode 100644
index 00000000..35a47dd1
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f04.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ ${15 \choose 11} \cdot 2^4 \cdot 7^{11}$
+ $- {15 \choose 11} \cdot 2^4 \cdot 7^{11}$
+ ${15 \choose 11} \cdot 2^{11} \cdot 7^4$
+ $- {15 \choose 11} \cdot 2^{11} \cdot 7^4$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f05.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f05.xml
new file mode 100644
index 00000000..6ef089f9
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f05.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ 6 are blond,
+
+
+ 7 have green eyes,
+
+
+ 11 are not blond and do not have green eyes.
+
+
+ How many people in this group are blond and have green eyes?
+ ]]>
+
+ 3
+ 4
+ 5
+ 6
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f06.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f06.xml
new file mode 100644
index 00000000..dcfccace
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f06.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ Because both sides count the number of pairs $(A,B)$ of subsets of the $n$ people, such that $|A| = 2$, $|B| = 5$, and $A \subseteq B$.
+ Because both sides count the number of pairs $(A,B)$ of subsets of the $n$ people, such that $|A| = 5$, $|B| = 2$, and $A \subseteq B$.
+ Because both sides count the number of ways to choose 2 committees in a group of $n$ people, one committee has 5 members, the other committee has 2 members, and a person can be on both committees.
+
+ no person can be on both committees.
+ ]]>
+
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f07.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f07.xml
new file mode 100644
index 00000000..44d1da8c
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f07.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $S_n = S_{n-1} + S_{n-2}$
+ $S_n = 2 \cdot S_{n-1} + S_{n-2}$
+ $S_n = S_{n-1} + (3^{n-1} - S_{n-1})$
+ $S_n = 2 \cdot S_{n-1} + (3^{n-1} - S_{n-1})$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f08.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f08.xml
new file mode 100644
index 00000000..24289148
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f08.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ For all $n \geq 0$: $f(n) = 2n^2 + 7$
+ For all $n \geq 0$: $f(n) = 3n^2 + 7$
+ For all $n \geq 0$: $f(n) = 4n^2 + 7$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f09.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f09.xml
new file mode 100644
index 00000000..c411bf35
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f09.xml
@@ -0,0 +1,27 @@
+
+
+
+ $\newcommand{\Fib}{{\rm F \scriptsize IB}}$
+
+
+ Consider the recursive algorithm $\Fib$, which takes as input an
+ integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \Fib(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ f = n$
+ $\mathbf{else}\ f = \Fib(n - 1) + \Fib(n - 2)$
+ $\mathbf{endif};$
+ $\mathbf{return}\ f$
+
+
+ If we run algorithm $\Fib(77)$, how many calls are there to $\Fib(73)$?
+ ]]>
+
+ 3
+ 4
+ 5
+ 6
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f10.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f10.xml
new file mode 100644
index 00000000..fd8da1ea
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f10.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ $(1,6) \in S$.
+
+
+ If $(a,b) \in S$ then $(a+3, b+4) \in S$.
+
+
+ If $(a,b) \in S$ then $(a+5, b+2) \in S$.
+
+
+ Which of the following is true?
+ ]]>
+
+ For every element $(a,b)$ in $S$, $a + b$ is divisible by 7.
+ For every element $(a,b)$ in $S$, $a + b$ is not divisible by 7.
+ $S = \{(a,b) : a > 0$ and $b > 0$ are integers and $a + b$ is divisible by 7$\}$.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f11.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f11.xml
new file mode 100644
index 00000000..9c9a9c75
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f11.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ ${102 \choose 3}$
+ ${102 \choose 4}$
+ ${103 \choose 3}$
+ ${103 \choose 4}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f12.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f12.xml
new file mode 100644
index 00000000..237810d0
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f12.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ 5/15
+ 6/15
+ 7/15
+ 8/15
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f13.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f13.xml
new file mode 100644
index 00000000..8f70765a
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f13.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+ $\Pr\bigl(A \cup (\overline{B} \cap \overline{C})\bigr) = $ |
+ $\Pr(A) + \Pr(B)\ - $ $\Pr(C).$ |
+
+
+
+ ]]>
+
+ True
+ False
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f14.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f14.xml
new file mode 100644
index 00000000..a6f514c6
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f14.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $\left. {30 \choose 1} \middle/ {100 \choose 20} \right.$
+ $\left. {30 \choose 1}{70 \choose 19} \middle/ {100 \choose 20} \right.$
+ $1 - \left. {70 \choose 20} \middle/ {100 \choose 20} \right.$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f15.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f15.xml
new file mode 100644
index 00000000..f0ce5637
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f15.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $\frac{1}{{100 \choose 20}} \sum_{k=0}^{20} \left({70 \choose k} + {30 \choose 20 - k}\right)$
+ $\frac{1}{{100 \choose 20}} \sum_{k=0}^{20} {70 \choose k}{30 \choose 20 - k}$
+ $\frac{1}{{100 \choose 20}} \sum_{k=0}^{10} \left({70 \choose 2k} + {30 \choose 20 - 2k}\right)$
+ $\frac{1}{{100 \choose 20}} \sum_{k=0}^{10} {70 \choose 2k}{30 \choose 20 - 2k}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f16.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f16.xml
new file mode 100644
index 00000000..68cd9145
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f16.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ ${77 \choose 15}(1/3)^{15}(2/3)^{62}$
+ ${77 \choose 15}((1/3)^{15} + (2/3)^{62})$
+ ${77 \choose 15}(1/3)^{62}(2/3)^{15}$
+ ${77 \choose 15}((1/3)^{62} + (2/3)^{15})$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f17.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f17.xml
new file mode 100644
index 00000000..1af5f9bc
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f17.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ $\left. {5 \choose 2} \middle/ 2^3 \right.$
+ $\left. {5 \choose 2} \middle/ 2^4 \right.$
+ $\left. {5 \choose 2} \middle/ 2^5 \right.$
+ $\left. 2^5 \middle/ {5 \choose 2} \right.$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f18.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f18.xml
new file mode 100644
index 00000000..94466448
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f18.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f19.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f19.xml
new file mode 100644
index 00000000..f1cae8cf
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f19.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $n/2$
+ $n$
+ $3n/2$
+ $2n$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f20.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f20.xml
new file mode 100644
index 00000000..ca434366
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f20.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ $m/2$
+ $m/4$
+ $m/8$
+ $m/16$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f21.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f21.xml
new file mode 100644
index 00000000..3a46b32f
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f21.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ The random variables $X$ and $Y$ are independent.
+ The random variables $X$ and $Y$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f22.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f22.xml
new file mode 100644
index 00000000..cb3acef4
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f22.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ $\mathbb{E}(L) = 50$ and $\mathbb{E}(\max(L,S)) = 50$.
+ $\mathbb{E}(L) = 100$ and $\mathbb{E}(\max(L,S)) = 100$.
+ $\mathbb{E}(L) = 50$ and $\mathbb{E}(\max(L,S)) = 100$.
+ $\mathbb{E}(L) = 100$ and $\mathbb{E}(\max(L,S)) = 50$.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f23.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f23.xml
new file mode 100644
index 00000000..31a70880
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f23.xml
@@ -0,0 +1,38 @@
+
+
+
+ $\newcommand{\TwoTails}{{\rm T {\scriptsize WO} T {\scriptsize AILS}}}$
+
+
+ Consider the following recursive algorithm $\TwoTails$, which takes as input a positive integer $k$:
+
+
+ $\mathbf{Algorithm}\ \TwoTails(k)\mathrm{:}$
+
+
+
+ $//$ |
+
+ $\text{all coin flips made are mutually}$ $\text{independent}$
+ |
+
+
+
+ $\text{flip a fair coin twice};$
+ $\mathbf{if}\ \text{the coin came up heads exactly twice}$
+ $\mathbf{then}\ \mathrm{return}\ 2^k$
+ $\mathbf{else}\ \TwoTails(k + 1)$
+ $\mathbf{endif}$
+
+
+ You run algorithm $\TwoTails(1)$, i.e., with $k = 1$. Define the random variable $X$ to be the value of the
+ output of this algorithm.
+ Let $k \geq 1$ be an integer. What is $\Pr(X = 2^k)$?
+ ]]>
+
+ $(1/4)^{k} \cdot 3/4$
+ $(1/4)^{k-1} \cdot 3/4$
+ $(3/4)^{k} \cdot 1/4$
+ $(3/4)^{k-1} \cdot 1/4$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f24.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f24.xml
new file mode 100644
index 00000000..e0ccfe5b
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f24.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ 36
+ 30
+ 20
+ 12
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2015/w15f25.xml b/app/src/data/questions/comp2804/exam-winter-2015/w15f25.xml
new file mode 100644
index 00000000..d32cabb0
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2015/w15f25.xml
@@ -0,0 +1,15 @@
+
+ Who is Lindsay Bangs?
+ A world-renowned rapper.
+
+ The Hamburglar.
+ ]]>
+
+ President of the Carleton Computer Science Society.
+
+ Leo's Early Breakfast IPA.
+ ]]>
+
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/exam-winter-2017.json b/app/src/data/questions/comp2804/exam-winter-2017/exam-winter-2017.json
new file mode 100644
index 00000000..90fe6f61
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/exam-winter-2017.json
@@ -0,0 +1,32 @@
+{
+ "id": "exam-winter-2017",
+ "title": "Winter 2017 Exam",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/exam-winter-2017/w17f01.xml",
+ "comp2804/exam-winter-2017/w17f02.xml",
+ "comp2804/exam-winter-2017/w17f03.xml",
+ "comp2804/exam-winter-2017/w17f04.xml",
+ "comp2804/exam-winter-2017/w17f05.xml",
+ "comp2804/exam-winter-2017/w17f06.xml",
+ "comp2804/exam-winter-2017/w17f07.xml",
+ "comp2804/exam-winter-2017/w17f08.xml",
+ "comp2804/exam-winter-2017/w17f09.xml",
+ "comp2804/exam-winter-2017/w17f10.xml",
+ "comp2804/exam-winter-2017/w17f11.xml",
+ "comp2804/exam-winter-2017/w17f12.xml",
+ "comp2804/exam-winter-2017/w17f13.xml",
+ "comp2804/exam-winter-2017/w17f14.xml",
+ "comp2804/exam-winter-2017/w17f15.xml",
+ "comp2804/exam-winter-2017/w17f16.xml",
+ "comp2804/exam-winter-2017/w17f17.xml",
+ "comp2804/exam-winter-2017/w17f18.xml",
+ "comp2804/exam-winter-2017/w17f19.xml",
+ "comp2804/exam-winter-2017/w17f20.xml",
+ "comp2804/exam-winter-2017/w17f21.xml",
+ "comp2804/exam-winter-2017/w17f22.xml",
+ "comp2804/exam-winter-2017/w17f23.xml",
+ "comp2804/exam-winter-2017/w17f24.xml",
+ "comp2804/exam-winter-2017/w17f25.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f01.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f01.xml
new file mode 100644
index 00000000..1b224fdc
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f01.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ $a_1,a_3,a_5,a_7,a_9$ are all odd and
+
+
+ $a_2,a_4,a_6,a_8,a_{10}$ are all even.
+
+
+ How many such permutations are there?
+ ]]>
+
+ $10!$
+ $5^5 \cdot 5^5$
+ $(5!)^2$
+ $2 \cdot (5!)^2$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f02.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f02.xml
new file mode 100644
index 00000000..a1d9992c
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f02.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $\frac{n!}{2}$
+ $n!$
+ $2{n \choose 2} \cdot (n-2)!$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f03.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f03.xml
new file mode 100644
index 00000000..efd10353
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f03.xml
@@ -0,0 +1,24 @@
+
+
+
+
+ exactly 5 beer bottles and zero or more cider bottles,
+
+
+ or
+
+ -
+ exactly 5 cider bottles and zero or more beer bottles.
+
+
+ How many such subsets are there?
+ ]]>
+
+ ${17 \choose 5} \cdot 2^{28} + 2^{17} \cdot {28 \choose 5}$
+ ${17 \choose 5} \cdot 2^{28} + 2^{17} \cdot {28 \choose 5} - {17 \choose 5} \cdot {28 \choose 5}$
+ $2^{45} - {17 \choose 5} - {28 \choose 5}$
+ $2^{45} - {17 \choose 5} \cdot {28 \choose 5}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f04.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f04.xml
new file mode 100644
index 00000000..f1797acc
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f04.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $2^{n-1}$
+ $2^{n-2}$
+ $2^{(n-1)/2}$
+ $2^{(n+1)/2}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f05.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f05.xml
new file mode 100644
index 00000000..f058dd4c
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f05.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ The number of bitstrings of length $n$ in which the first bit is 0 or the last bit is 1.
+ The number of bitstrings of length $n$ in which the first bit is 0 and the last bit is 1.
+ The number of bitstrings of length $n$ in which the first bit is equal to the last bit.
+ The number of bitstrings of length $n$ in which the first bit is not equal to the last bit.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f06.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f06.xml
new file mode 100644
index 00000000..f0dc99e1
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f06.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ 63 students like beer,
+
+
+ 71 students like cider, and
+
+
+ 25 students do not like beer and do not like cider.
+
+
+ How many students like beer and cider?
+ ]]>
+
+ 57
+ 58
+ 59
+ 60
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f07.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f07.xml
new file mode 100644
index 00000000..cfd0109d
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f07.xml
@@ -0,0 +1,24 @@
+
+
+
+
+ For any even integer $n$, let $S_n$ be the number of bitstrings of length $n$ that have both of the
+ following two properties:
+
+ -
+ There is a 0 at every even position.
+
+ -
+ The entire bitstring does not contain the substring 101.
+
+
+ Which of the following is true for all even integers $n \geq 6$?
+ ]]>
+
+ $S_n = S_{n/2} + S_{(n/2)-3}$
+ $S_n = S_{n-1} + S_{n-3}$
+ $S_n = S_{n-2} + S_{n-3}$
+ $S_n = S_{n-2} + S_{n-4}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f08.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f08.xml
new file mode 100644
index 00000000..edc3ebbc
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f08.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $S_n = S_{n-1} + S_{n-2} + 2^{n-2}$
+ $S_n = S_{n-1} + S_{n-2} + S_{n-3} + 2^{n-3}$
+ $S_n = S_{n-1} + S_{n-2} + S_{n-3}$
+ $S_n = S_{n-1} + S_{n-2} + S_{n-3} + 2^{n-4}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f09.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f09.xml
new file mode 100644
index 00000000..00a5430a
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f09.xml
@@ -0,0 +1,32 @@
+
+
+
+ $\newcommand{\Hello}{{\rm H {\scriptsize ELLO}}}
+ \newcommand{\elsesp}{\phantom{\mathbf{else}\ }}
+ \newcommand{\thensp}{\phantom{\mathbf{then}\ }}$
+
+
+ Consider the recursive algorithm $\Hello$, which takes as input an integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \Hello(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ \text{print ``hello''}$
+ $\mathbf{else}\ \mathbf{if}\ n\ \mathrm{is}\ \mathrm{even}$
+ $\elsesp \mathbf{then}\ \Hello(\frac{n}{2});$
+ $\elsesp \thensp \Hello(\frac{n}{2} - 1)$
+ $\elsesp \mathbf{else}\ \Hello(n - 1);$
+ $\elsesp \elsesp \Hello(n - 2)$
+ $\elsesp \mathbf{endif};$
+ $\mathbf{endif}$
+
+
+ If we run algorithm $\Hello(7)$, how many times is the word "hello" printed?
+ ]]>
+
+ 9
+ 10
+ 11
+ 12
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f10.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f10.xml
new file mode 100644
index 00000000..f35240ce
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f10.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ $1 - (21/26)^{14}$
+ $1 - (26/21)^{14}$
+ $5 \cdot (5/26) \cdot (21/26)^{13}$
+ $14 \cdot (5/26) \cdot (21/26)^{13}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f11.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f11.xml
new file mode 100644
index 00000000..d5353f48
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f11.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $11 \cdot {6 \choose 2} \cdot 10!$
+ $11 \cdot 6 \cdot 5 \cdot 10!$
+ $12 \cdot 6 \cdot 5 \cdot 10!$
+ $13 \cdot 6 \cdot 5 \cdot 10!$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f12.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f12.xml
new file mode 100644
index 00000000..7da2d186
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f12.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ 4/8
+ 5/8
+ 4/9
+ 5/9
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f13.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f13.xml
new file mode 100644
index 00000000..06599cf0
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f13.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ 1/3
+ 2/3
+ 2/5
+ 1/4
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f14.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f14.xml
new file mode 100644
index 00000000..62201d34
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f14.xml
@@ -0,0 +1,16 @@
+
+
+ a_1$".
+ [/defs]
+ Which of the following is true?
+ ]]>
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f15.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f15.xml
new file mode 100644
index 00000000..07e9c81e
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f15.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ ${\frac{1}{n}} - {\frac{1}{n(n-1)}}$
+ ${\frac{2}{n}} - {\frac{1}{n(n-1)}}$
+ ${\frac{2}{n}} - {\frac{1}{n^{2}}}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f16.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f16.xml
new file mode 100644
index 00000000..21d4f2e3
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f16.xml
@@ -0,0 +1,19 @@
+
+
+ 0.
+ \end{align}
+ $$
+ Which of the following is true?
+ ]]>
+
+ $\Pr(A) < 1/2$
+ $\Pr(A) > 1/2$
+ $\Pr(A) < 1$
+ $\Pr(A) > 0$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f17.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f17.xml
new file mode 100644
index 00000000..ec6c7703
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f17.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ 1/3
+ 2/3
+ 1/5
+ 1/6
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f18.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f18.xml
new file mode 100644
index 00000000..67c68335
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f18.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ 5/18
+ 1/6
+ 1/4
+ 1/3
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f19.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f19.xml
new file mode 100644
index 00000000..755beacd
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f19.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ Define the random variable $X$ to be the number of unordered triples $\{P_i,P_j,P_k\}$ of people
+ (i.e., subsets consisting of three people) that have the same birthday.
+
+ What is the expected value $\mathbb{E}(X)$ of $X$?
+ Hint: Use indicator random variables.
+ ]]>
+
+ ${\frac{1}{365^2}} \cdot {n \choose 3}$
+ ${\frac{1}{365^3}} \cdot {n \choose 3}$
+ ${\frac{1}{365^2}} \cdot n^3$
+ ${\frac{1}{365^3}} \cdot n^3$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f20.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f20.xml
new file mode 100644
index 00000000..a474e7da
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f20.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ What is the expected value $\mathbb{E}(X)$ of $X$?
+ ]]>
+
+ 80
+ 100
+ 120
+ 140
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f21.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f21.xml
new file mode 100644
index 00000000..e4e844aa
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f21.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ The random variables $X$ and $Y$ are independent.
+ The random variables $X$ and $Y$ are not independent.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f22.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f22.xml
new file mode 100644
index 00000000..30f6675c
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f22.xml
@@ -0,0 +1,38 @@
+
+
+
+ $\newcommand{\TwoTails}{{\rm T {\scriptsize WO} T {\scriptsize AILS}}}$
+
+
+ Consider the following recursive algorithm $\TwoTails$, which takes as input a positive integer $k$:
+
+
+ $\mathbf{Algorithm}\ \TwoTails(k)\mathrm{:}$
+
+
+
+ $//$ |
+
+ $\text{all coin flips made are mutually}$ $\text{independent}$
+ |
+
+
+
+ $\text{flip a fair coin twice};$
+ $\mathbf{if}\ \text{the coin came up heads exactly twice}$
+ $\mathbf{then}\ \mathrm{return}\ 2^k$
+ $\mathbf{else}\ \TwoTails(k + 1)$
+ $\mathbf{endif}$
+
+
+ You run algorithm $\TwoTails(1)$, i.e., with $k = 1$. Define the random variable $X$ to be the value of the
+ output of this algorithm.
+ Let $m \geq 1$ be an integer. What is $\Pr(X = 2^m)$?
+ ]]>
+
+ $(1/4)^{m} \cdot 3/4$
+ $(1/4)^{m-1} \cdot 3/4$
+ $(3/4)^{m} \cdot 1/4$
+ $(3/4)^{m-1} \cdot 1/4$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f23.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f23.xml
new file mode 100644
index 00000000..2c88d0c6
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f23.xml
@@ -0,0 +1,14 @@
+
+
+
+ For any two random variables $X$ and $Y$,
+ $\mathbb{E}(X \cdot Y) = \mathbb{E}(X) \cdot \mathbb{E}(Y)$.
+
+ ]]>
+
+ The statement is true.
+ The statement is false.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f24.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f24.xml
new file mode 100644
index 00000000..3d882b35
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f24.xml
@@ -0,0 +1,22 @@
+
+
+
+
+ Elisa orders 7 ciders, one cider at a time. Let $(D_1,D_2,\dots,D_7)$ be the sequence of drinks
+ that Tan serves. Define the following random variable $X$:
+ [defs]
+ X = the number of indices $i$ such that $D_i$ is a cider and $D_{i+1}$ is not a cider.
+ [/defs]
+ What is the expected value $\mathbb{E}(X)$ of $X$?
+ ]]>
+
+ 44/144
+ 55/144
+ 66/144
+ 77/144
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2017/w17f25.xml b/app/src/data/questions/comp2804/exam-winter-2017/w17f25.xml
new file mode 100644
index 00000000..480fc2d6
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2017/w17f25.xml
@@ -0,0 +1,4 @@
+
+ How do you feel about writing an exam on Sunday afternoon?
+ I hate it!
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/exam-winter-2018.json b/app/src/data/questions/comp2804/exam-winter-2018/exam-winter-2018.json
new file mode 100644
index 00000000..dea1f659
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/exam-winter-2018.json
@@ -0,0 +1,32 @@
+{
+ "id": "exam-winter-2018",
+ "title": "Winter 2018 Exam",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/exam-winter-2018/w18f01.xml",
+ "comp2804/exam-winter-2018/w18f02.xml",
+ "comp2804/exam-winter-2018/w18f03.xml",
+ "comp2804/exam-winter-2018/w18f04.xml",
+ "comp2804/exam-winter-2018/w18f05.xml",
+ "comp2804/exam-winter-2018/w18f06.xml",
+ "comp2804/exam-winter-2018/w18f07.xml",
+ "comp2804/exam-winter-2018/w18f08.xml",
+ "comp2804/exam-winter-2018/w18f09.xml",
+ "comp2804/exam-winter-2018/w18f10.xml",
+ "comp2804/exam-winter-2018/w18f11.xml",
+ "comp2804/exam-winter-2018/w18f12.xml",
+ "comp2804/exam-winter-2018/w18f13.xml",
+ "comp2804/exam-winter-2018/w18f14.xml",
+ "comp2804/exam-winter-2018/w18f15.xml",
+ "comp2804/exam-winter-2018/w18f16.xml",
+ "comp2804/exam-winter-2018/w18f17.xml",
+ "comp2804/exam-winter-2018/w18f18.xml",
+ "comp2804/exam-winter-2018/w18f19.xml",
+ "comp2804/exam-winter-2018/w18f20.xml",
+ "comp2804/exam-winter-2018/w18f21.xml",
+ "comp2804/exam-winter-2018/w18f22.xml",
+ "comp2804/exam-winter-2018/w18f23.xml",
+ "comp2804/exam-winter-2018/w18f24.xml",
+ "comp2804/exam-winter-2018/w18f25.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f01.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f01.xml
new file mode 100644
index 00000000..8434375f
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f01.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ ${20 \choose 12} \cdot {38 \choose 18}$
+ ${20 \choose 12} \cdot {50 \choose 18}$
+ ${50 \choose 12} \cdot {20 \choose 18}$
+ ${70 \choose 30} \cdot {20 \choose 12}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f02.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f02.xml
new file mode 100644
index 00000000..5ddbbc89
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f02.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ ${20 \choose 12} + {50 \choose 12}$
+ ${20 \choose 12} + {50 \choose 12} - {20 \choose 12} \cdot {50 \choose 12}$
+ ${20 \choose 12} \cdot 2^{50} + {50 \choose 12} \cdot 2^{20}$
+ ${20 \choose 12} \cdot 2^{50} + {50 \choose 12} \cdot 2^{20} - {20 \choose 12} \cdot {50 \choose 12}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f03.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f03.xml
new file mode 100644
index 00000000..6a5e4d6d
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f03.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $2^{70} - 2^{50} - 20 - {20 \choose 2}$
+ $2^{70} - 2^{50} - 20 \cdot 2^{50} - {20 \choose 2} \cdot 2^{50}$
+ $2^{70} - 2^{50} - 20 \cdot 2^{50}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f04.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f04.xml
new file mode 100644
index 00000000..61b4e4af
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f04.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $2 \cdot {40 \choose 5} \cdot 3^{35} - {40 \choose 5} \cdot {35 \choose 5} \cdot 2^{30}$
+ $2 \cdot {40 \choose 5} \cdot 3^{35}$
+ ${40 \choose 5} + {35 \choose 5} - {40 \choose 5} \cdot {35 \choose 5}$
+ $2 \cdot {40 \choose 5} - {40 \choose 5} \cdot {35 \choose 5}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f05.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f05.xml
new file mode 100644
index 00000000..5d138168
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f05.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ The number of ways to choose a subset from a set consisting of $m + n$ elements.
+ The number of ways to choose an ordered pair of 2 elements from a set consisting of $m + n$ elements.
+ The number of ways to choose a 2-element subset from a set consisting of $m + n$ elements.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f06.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f06.xml
new file mode 100644
index 00000000..ecf6995b
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f06.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ ${31 \choose 6}$
+ ${31 \choose 7}$
+ ${32 \choose 6}$
+ ${32 \choose 7}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f07.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f07.xml
new file mode 100644
index 00000000..1a64422a
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f07.xml
@@ -0,0 +1,17 @@
+
+
+
+ BOOGER
+
+ is called awesome, if the string does not contain the substring OO.
+ Thus, GEOROB is awesome, whereas GREOOB is not awesome.
+ What is the number of awesome strings?
+ ]]>
+
+ $6 \cdot {5 \choose 2} \cdot 3 \cdot 2$
+ $(6 \cdot {5 \choose 2} \cdot 3 \cdot 2) - 5!$
+ $6! - 5!$
+ $(6 \cdot {5 \choose 2} \cdot 3) - 5!$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f08.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f08.xml
new file mode 100644
index 00000000..56d9e86b
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f08.xml
@@ -0,0 +1,15 @@
+
+
+ valid, if it does not contain $aa$, it does not contain $bb$,
+ it does not contain $cc$, and it does not contain $dd$.
+
+ For any integer $n \geq 2$, what is the number of valid strings of length $n$?
+ ]]>
+
+ $4^{n} - 4(n-1)$
+ $4^{n} - 4n$
+ $4 \cdot 3^{n}$
+ $4 \cdot 3^{n-1}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f09.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f09.xml
new file mode 100644
index 00000000..e146ba52
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f09.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $S_n = S_{n-1} + S_{n-2} + 1$
+ $S_n = S_{n-1} + S_{n-2} + 2^{n-2}$
+ $S_n = S_{n-1} + S_{n-2} + 2^{n-3}$
+ $S_n = S_{n-1} + S_{n-2} + S_{n-3}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f10.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f10.xml
new file mode 100644
index 00000000..b22563bd
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f10.xml
@@ -0,0 +1,48 @@
+
+
+
+ $\newcommand{\SundayEveningExam}{{\rm S {\scriptsize UNDAY} E {\scriptsize VENING} E {\scriptsize XAM}}}
+ \newcommand{\elsesp}{\phantom{\mathbf{else}\ }}$
+
+
+ Consider the recursive algorithm $\SundayEveningExam$, which takes as input an integer $n \geq 1$:
+
+
+ $\mathbf{Algorithm}\ \SundayEveningExam(n)\mathrm{:}$
+ $\mathbf{if}\ n = 1$
+
+
+
+
+ $\mathbf{then}\ \mathrm{print}\ \text{``}$
+ |
+ $\text{I don't like Sunday}$ $\text{evening exams''}$ |
+
+
+
+ $\mathbf{else}\ \mathbf{for}\ i = 1\ \mathbf{to}\ n$
+
+
+
+
+ $\elsesp \mathbf{do}\ \mathrm{print}\ \text{``}$
+ |
+ $\text{I don't like Sunday}$ $\text{evening exams''}$ |
+
+
+
+ $\elsesp \mathbf{endfor};$
+ $\elsesp \SundayEveningExam(n - 1)$
+ $\mathbf{endif}$
+
+
+ Let $P(n)$ be the number of times the line "I don't like Sunday evening exams" is printed when running
+ algorithm $\SundayEveningExam(n)$. Which of the following is true for all $n \geq 1$?
+ ]]>
+
+ $P(n) = 1 + \frac{n(n-1)}{2}$
+ $P(n) = \frac{n(n-1)}{2}$
+ $P(n) = \frac{n(n+1)}{2}$
+ $P(n) = 1 + \frac{n(n+1)}{2}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f11.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f11.xml
new file mode 100644
index 00000000..f3cc2f1d
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f11.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ ${18 \choose 3} \cdot \left(5 \middle/ 6 \right)^{18}$
+ $18 \cdot \left. 5^{15} \middle/ 6^{18} \right.$
+ ${18 \choose 3} \cdot \left. 5^{15} \middle/ 6^{18} \right.$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f12.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f12.xml
new file mode 100644
index 00000000..ee2cec45
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f12.xml
@@ -0,0 +1,20 @@
+
+
+ palindrome, if
+ $$
+ s_1s_2{\dots}s_{n-1}s_n = s_ns_{n-1}{\dots}s_2s_1,
+ $$
+ i.e., reading the string from left to right gives the
+ same result as reading the string from right to left.
+
+ Let $n \geq 3$ be an odd integer. You are given a string of length $n$, in which each character is a
+ uniformly random element of $\{a,b,c\}$. The characters are independent of each other. What is the
+ probability that this string is a palindrome?
+ ]]>
+
+ $(1/3)^{(n+1)/2}$
+ $(1/3)^{(n-1)/2}$
+ $(1/2)^{(n+1)/2}$
+ $(1/2)^{(n-1)/2}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f13.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f13.xml
new file mode 100644
index 00000000..0950b6aa
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f13.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ 12/16
+ 13/16
+ 14/16
+ 15/16
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f14.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f14.xml
new file mode 100644
index 00000000..c8527378
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f14.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ Consider the string
+ $$
+ a_1-b_1,a_2-b_2,\dots,a_{77}-b_{77}.
+ $$
+ What is the probability that each element in this string is non-zero?
+ ]]>
+
+ $(3/8)^{77}$
+ $(4/8)^{77}$
+ $(5/8)^{77}$
+ $(6/8)^{77}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f15.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f15.xml
new file mode 100644
index 00000000..d1a127ee
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f15.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+ All of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f16.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f16.xml
new file mode 100644
index 00000000..8ca755b2
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f16.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+ All of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f17.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f17.xml
new file mode 100644
index 00000000..9cb1f17a
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f17.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ $\frac{2(2n-1)}{n-1}$
+ $\frac{n-1}{4n}$
+ $\frac{n-1}{2(2n-1)}$
+ $\frac{n}{2(2n-1)}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f18.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f18.xml
new file mode 100644
index 00000000..5b3bf191
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f18.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+ $X = \bigg\{$ |
+ $1\ $ |
+ if the red coin flip resulted in heads$,$ |
+
+
+ $0\ $ |
+ if the red coin flip resulted in tails$,$ |
+
+
+ $Y = \bigg\{$ |
+ $1\ $ |
+ if the blue coin flip resulted in heads$,$ |
+
+
+ $0\ $ |
+ if the blue coin flip resulted in tails$,$ |
+
+
+
+
+ and
+ [defs]
+ Z = $\min(X,Y).$
+ [/defs]
+ What is the expected value $\mathbb{E}(Z)$ of the random variable $Z$?
+ ]]>
+
+ 1/4
+ 1/2
+ 3/4
+ 1
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f19.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f19.xml
new file mode 100644
index 00000000..a9826872
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f19.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ Define the random variable $X$ to be the number of indices $i$ with $1 \leq i < n$ for which $b_i
+ \cdot b_{i+1} = 0$.
+
+ What is the expected value $\mathbb{E}(X)$ of the random variable $X$?
+ Hint: Use indicator random variables.
+ ]]>
+
+ $n/4$
+ $(n-1)/4$
+ $3n/4$
+ $3(n-1)/4$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f20.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f20.xml
new file mode 100644
index 00000000..a8e26cee
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f20.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ 1
+ $\frac{n+2}{n+1}$
+ $\frac{n+1}{n}$
+ $\frac{n+3}{n+1}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f21.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f21.xml
new file mode 100644
index 00000000..c69def89
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f21.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+ $\Pr(X = 0)$ |
+
+ $= \Pr(X = 1) = \Pr(Y = 0)$
+ $= \Pr(Y = 1) = 1/2.$
+ |
+
+
+
+
+ Define the random variable $Z = X \cdot Y$. Which of the following is correct?
+ ]]>
+
+ The random variables $X$ and $Z$ are independent.
+ The random variables $X$ and $Z$ are not independent.
+ None of the above.
+ All of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f22.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f22.xml
new file mode 100644
index 00000000..6bac896d
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f22.xml
@@ -0,0 +1,48 @@
+
+
+
+ $\newcommand{\WhoGoesFirst}{{\rm W {\scriptsize HO} G {\scriptsize OES} F {\scriptsize IRST}}}
+ \newcommand{\thensp}{\phantom{\mathbf{then}\ }}$
+
+
+ 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}$
+
+
+ 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.
+ What is the expected value $\mathbb{E}(X)$ of the random variable $X$?
+ ]]>
+
+ 3/2
+ 5/4
+ 5/6
+ 6/5
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f23.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f23.xml
new file mode 100644
index 00000000..3804449b
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f23.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ The statement is true.
+ The statement is false.
+ None of the above.
+ All of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f24.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f24.xml
new file mode 100644
index 00000000..b64b8b37
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f24.xml
@@ -0,0 +1,21 @@
+
+
+
+ Define the following random variable $X$:
+ [defs]
+ X = the number of students who get exactly 2 ciders.
+ [/defs]
+ What is the expected value $\mathbb{E}(X)$ of the random variable $X$?
+ Hint: Use indicator random variables.
+ ]]>
+
+ $2^{4} \cdot 3^{2} \cdot \left. 5^{2} \middle/ 3^{8} \right.$
+ $2^{4} \cdot 3^{2} \cdot \left. 2^{5} \middle/ 8^{3} \right.$
+ $2^{4} \cdot 3^{2} \left. \cdot 5^{2} \middle/ 8^{3} \right.$
+ $3^{2} \cdot \left. 5^{2} \middle/ 8^{3} \right.$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2018/w18f25.xml b/app/src/data/questions/comp2804/exam-winter-2018/w18f25.xml
new file mode 100644
index 00000000..d8134dc0
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2018/w18f25.xml
@@ -0,0 +1,4 @@
+
+ Are you happy that this is the last question?
+ Yes.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/exam-winter-2019.json b/app/src/data/questions/comp2804/exam-winter-2019/exam-winter-2019.json
new file mode 100644
index 00000000..b9323073
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/exam-winter-2019.json
@@ -0,0 +1,32 @@
+{
+ "id": "exam-winter-2019",
+ "title": "Winter 2019 Exam",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/exam-winter-2019/w19f01.xml",
+ "comp2804/exam-winter-2019/w19f02.xml",
+ "comp2804/exam-winter-2019/w19f03.xml",
+ "comp2804/exam-winter-2019/w19f04.xml",
+ "comp2804/exam-winter-2019/w19f05.xml",
+ "comp2804/exam-winter-2019/w19f06.xml",
+ "comp2804/exam-winter-2019/w19f07.xml",
+ "comp2804/exam-winter-2019/w19f08.xml",
+ "comp2804/exam-winter-2019/w19f09.xml",
+ "comp2804/exam-winter-2019/w19f10.xml",
+ "comp2804/exam-winter-2019/w19f11.xml",
+ "comp2804/exam-winter-2019/w19f12.xml",
+ "comp2804/exam-winter-2019/w19f13.xml",
+ "comp2804/exam-winter-2019/w19f14.xml",
+ "comp2804/exam-winter-2019/w19f15.xml",
+ "comp2804/exam-winter-2019/w19f16.xml",
+ "comp2804/exam-winter-2019/w19f17.xml",
+ "comp2804/exam-winter-2019/w19f18.xml",
+ "comp2804/exam-winter-2019/w19f19.xml",
+ "comp2804/exam-winter-2019/w19f20.xml",
+ "comp2804/exam-winter-2019/w19f21.xml",
+ "comp2804/exam-winter-2019/w19f22.xml",
+ "comp2804/exam-winter-2019/w19f23.xml",
+ "comp2804/exam-winter-2019/w19f24.xml",
+ "comp2804/exam-winter-2019/w19f25.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f01.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f01.xml
new file mode 100644
index 00000000..3aeb8662
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f01.xml
@@ -0,0 +1,10 @@
+
+
+ ${85 \choose 5} \cdot 3^{80}$
+ ${85 \choose 5} \cdot 3^{85}$
+ ${85 \choose 5} \cdot 4^{80}$
+ ${85 \choose 5} \cdot 4^{85}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f02.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f02.xml
new file mode 100644
index 00000000..55e1c157
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f02.xml
@@ -0,0 +1,10 @@
+
+
+ ${85 \choose 15} \cdot {70 \choose 30} \cdot 2^{40}$
+ ${85 \choose 15} \cdot {70 \choose 30} \cdot 3^{40}$
+ ${85 \choose 15} \cdot {70 \choose 30} \cdot 4^{40}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f03.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f03.xml
new file mode 100644
index 00000000..7ab01009
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f03.xml
@@ -0,0 +1,10 @@
+
+
+ ${55 \choose 10} - {30 \choose 10} - {30 \choose 9}$
+ ${55 \choose 10} - {30 \choose 10} - 25 \cdot {29 \choose 9}$
+ ${55 \choose 10} - {30 \choose 10} - 25 \cdot {30 \choose 9}$
+ ${55 \choose 10} - {30 \choose 10} - 25 \cdot {30 \choose 10}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f04.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f04.xml
new file mode 100644
index 00000000..75c7aec8
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f04.xml
@@ -0,0 +1,12 @@
+
+ awesome, if $x$ is even or $y$ is even.
+ What is the number of awesome elements in $S$?
+ ]]>
+ 104
+ 105
+ 106
+ 107
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f05.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f05.xml
new file mode 100644
index 00000000..623bd7ec
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f05.xml
@@ -0,0 +1,18 @@
+
+
+ Let $m \geq 2$ and $n \geq 2$ be integers. Why does the identity
+ $$
+ {m + n \choose 2} = {m \choose 2} + {n \choose 2} + mn
+ $$
+ hold?
+
+
+ Because both sides count the number of ways $m$ men and $n$ women can be arranged on a line,
+ such that no two men are standing next to each other.
+
+ Because both sides count the number of ordered pairs in a set of size $m + n$.
+
+ Because both sides count the number of 2-element subsets of a set of size $m + n$.
+
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f06.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f06.xml
new file mode 100644
index 00000000..06ba83be
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f06.xml
@@ -0,0 +1,9 @@
+
+
+ ${55 \choose 20} \cdot 5^{35} \cdot 3^{20}$
+ $-{55 \choose 20} \cdot 5^{35} \cdot 3^{20}$
+ ${55 \choose 35} \cdot 5^{20} \cdot 3^{35}$
+ $-{55 \choose 35} \cdot 5^{20} \cdot 3^{35}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f07.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f07.xml
new file mode 100644
index 00000000..287b7041
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f07.xml
@@ -0,0 +1,20 @@
+
+ POOPERSCOOPER
+ is called cool, if each occurrence of E has the letter R to its left or
+ right, and each occurrence of R has the letter E to its left or right. Thus, both
+ POOPERSCOOPER
+ and
+ OPRECSOOOERPP
+ are cool, whereas
+ EPOOPRSCOOPER
+ is not cool. What is the number of cool strings?
+ ]]>
+ ${11 \choose 3} \cdot {8 \choose 4} \cdot {4 \choose 2} \cdot {2 \choose 1} \cdot {1 \choose 1}$
+ ${11 \choose 3} \cdot {8 \choose 4} \cdot {4 \choose 2} \cdot {2 \choose 1} \cdot {1 \choose 1} \cdot 2$
+ ${11 \choose 3} \cdot {8 \choose 4} \cdot {4 \choose 2} \cdot {2 \choose 1} \cdot {1 \choose 1} \cdot 3$
+
+ ${11 \choose 3} \cdot {8 \choose 4} \cdot {4 \choose 2} \cdot {2 \choose 1} \cdot {1 \choose 1} \cdot 4$
+
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f08.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f08.xml
new file mode 100644
index 00000000..1059ea69
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f08.xml
@@ -0,0 +1,13 @@
+
+ free, if it does not contain two 0's next to each other.
+ In class, we have seen that for any $m \geq 1$, the number of 00-free bitstrings of length $m$
+ is equal to the $(m + 2)$-th Fibonacci number $f_{m+2}$.
+ What is the number of 00-free bitstrings of length 20 that have 1 at position 11 and 0 at
+ position 20? (The positions are numbered $1,2,...,20$.)
+ ]]>
+ $f_{10} \cdot f_{12}$
+ $f_9 \cdot f_{12}$
+ $f_8 \cdot f_{11}$
+ $f_7 \cdot f_{10}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f09.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f09.xml
new file mode 100644
index 00000000..2be5c9b6
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f09.xml
@@ -0,0 +1,11 @@
+
+
+ $S_n = 1 + S_{n - 1}$
+ $S_n = 1 + S_{n - 2}$
+ $S_n = S_{n - 1} + S_{n - 3}$
+ $S_n = S_{n - 2} + S_{n - 3}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f10.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f10.xml
new file mode 100644
index 00000000..6f8a645b
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f10.xml
@@ -0,0 +1,16 @@
+
+
+ $f(n) = \frac{5}{2} \cdot 3^n - 1$
+ $f(n) = \frac{3}{2} \cdot 3^n - \frac{1}{2}$
+ $f(n) = \frac{5}{2} \cdot 3^n - \frac{1}{2}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f11.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f11.xml
new file mode 100644
index 00000000..f91fa4bb
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f11.xml
@@ -0,0 +1,11 @@
+
+
+ You flip a fair coin 6 times; the flips are independent of each other.
+ What is the probability that in these 6 coin flips, the coin comes up heads exactly
+ 3 times?
+
+ 3/16
+ 4/16
+ 5/16
+ 6/16
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f12.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f12.xml
new file mode 100644
index 00000000..8836d561
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f12.xml
@@ -0,0 +1,13 @@
+
+ suit and a rank.
+ There are four suits (spades ♠, hearts ♡, clubs ♣, and diamonds ♢), and 13 ranks
+ (Ace, 2,3,4,5,6,7,8,9,10, Jack, Queen, and King).
+ Assume you get a uniformly random hand consisting of 5 cards. What is the probability
+ that the 5 cards in this hand consist of 3 Aces and 2 Queens?
+ ]]>
+ $\left. 24 \middle/ {52 \choose 5} \right.$
+ $\left. 25 \middle/ {52 \choose 5} \right.$
+ $\left. 26 \middle/ {52 \choose 5} \right.$
+ $\left. 27 \middle/ {52 \choose 5} \right.$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f13.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f13.xml
new file mode 100644
index 00000000..6c5d773d
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f13.xml
@@ -0,0 +1,16 @@
+
+
+ 17/57
+ 18/57
+ 19/57
+ 20/57
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f14.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f14.xml
new file mode 100644
index 00000000..470799ef
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f14.xml
@@ -0,0 +1,17 @@
+
+
+ You are given two bitstrings $a_1,a_2,...,a_n$ and $b_1,b_2,...,b_n$, both of length $n$.
+ In both bitstrings, each bit is 0 with probability 1/2, and 1 with probability 1/2
+ (independent of all other bits).
+ For each $i$ with $1 \leq i \leq n$, let $c_i = a_i - b_i$. Consider the set
+ $$
+ P = \{i : 1 \leq i \leq n \text{ and } c_i \geq 0\}.
+ $$
+ What is the probability that the size of the set $P$ is equal to $k$?
+ ]]>
+ ${n \choose k} \cdot (3/4)^{n - k} \cdot (1/4)^k$
+ ${n \choose k} \cdot (3/4)^k \cdot (1/4)^{n - k}$
+ ${n \choose k} \cdot (3/4)^k \cdot (1/2)^k$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f15.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f15.xml
new file mode 100644
index 00000000..bec46e75
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f15.xml
@@ -0,0 +1,17 @@
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+ All of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f16.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f16.xml
new file mode 100644
index 00000000..98a1cd8e
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f16.xml
@@ -0,0 +1,17 @@
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+ All of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f17.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f17.xml
new file mode 100644
index 00000000..a9414c08
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f17.xml
@@ -0,0 +1,17 @@
+
+
+ The events $A$ and $B$ are independent.
+ The events $A$ and $B$ are not independent.
+ None of the above.
+ All of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f18.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f18.xml
new file mode 100644
index 00000000..0ce3ba83
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f18.xml
@@ -0,0 +1,11 @@
+
+
+ 3/4
+ 2/3
+ 1/2
+ 1/3
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f19.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f19.xml
new file mode 100644
index 00000000..cec56320
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f19.xml
@@ -0,0 +1,33 @@
+
+
+ Step 1: Choose a uniformly random number from
+ the red box, and denote it by $x$.
+ Step 2:
+
+ -
+ If $x = 0$ or $x = 2$,
+ then choose a uniformly random number from the green box, and denote it by $y$.
+
+ -
+ Otherwise (i.e., if $x = 1$),
+ choose a uniformly random number from the blue box, and denote it by $y$.
+
+
+ Consider the random variables
+
+ [defs]
+ X = the number $x$ you choose in Step 1,
+ Y = the number $y$ you choose in Step 2,
+ Z = $\max(X,Y).$
+ [/defs]
+
+ What is the expected value $\mathbb{E}(Z)$ of the random variable $Z$?
+ ]]>
+ 1
+ 3/2
+ 2
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f20.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f20.xml
new file mode 100644
index 00000000..850e83a2
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f20.xml
@@ -0,0 +1,14 @@
+
+
+ What is the expected value $\mathbb{E}(X)$ of the random variable $X$?
+ Hint: Use indicator random variables.
+ ]]>
+ $\frac{2}{3} \cdot n$
+ $\frac{2}{3} \cdot (n - 1)$
+ $\frac{4}{9} \cdot n$
+ $\frac{4}{9} \cdot (n - 1)$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f21.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f21.xml
new file mode 100644
index 00000000..11ff4f36
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f21.xml
@@ -0,0 +1,17 @@
+
+
+ $\frac{n}{n + 2} + \frac{2n + 6}{(n + 1)(n + 2)}$
+ $\frac{n}{n + 2} + \frac{2n + 2}{(n + 1)(n + 2)}$
+ $\frac{n}{n + 2} + \frac{4n + 6}{(n + 1)(n + 2)}$
+ $\frac{n}{n + 2} + \frac{4n + 2}{(n + 1)(n + 2)}$
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f22.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f22.xml
new file mode 100644
index 00000000..1f055969
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f22.xml
@@ -0,0 +1,21 @@
+
+
+ The random variables $G$ and $B$ are independent.
+ The random variables $G$ and $B$ are not independent.
+ None of the above.
+ All of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f23.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f23.xml
new file mode 100644
index 00000000..ae3f1f3d
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f23.xml
@@ -0,0 +1,19 @@
+
+ Experiment: Roll each die once and take the sum of the two rolls.
+ You repeat this experiment until the sum of the two rolls is equal to 7.
+ Consider the random variable
+
+ [defs]
+ X = the number of times you do the experiment.
+ [/defs]
+
+ (This value $X$ includes the experiment in which the sum is 7 for the first time.)
+ What is the expected value $\mathbb{E}(X)$ of the random variable $X$?
+ ]]>
+ 6
+ 5
+ 4
+ 3
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f24.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f24.xml
new file mode 100644
index 00000000..791391ad
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f24.xml
@@ -0,0 +1,27 @@
+
+
+ Consider $n$ students $S_1,S_2,...,S_n$ who hand in an assignment for COMP 2804. This assignment has 2 questions.
+ For $i = 1,2,...,n$ let $A_i$ be the assignment handed in by student $S_i$.
+ Alexa and Zoltan are TAs for the course. Alexa is supposed to mark the first question, whereas Zoltan
+ is supposed to mark the second question. Since both TAs are lazy, they use the following scheme
+ (all random choices are mutually independent):
+ For $i = 1,2,...,n$,
+
+ - Alexa marks the first question of assignment $A_i$ with probability $p,$
+ - Zoltan marks the second question of assignment $A_i$ with probability $q.$
+
+ Consider the random variable
+
+ [defs]
+ X = the number of assignments that are marked by both Alexa and Zoltan.
+ [/defs]
+
+ What is the expected value $\mathbb{E}(X)$ of the random variable $X$?
+ Hint: Use indicator random variables.
+ ]]>
+ $(p + q) \cdot n$
+ $\frac{n}{p \cdot q}$
+ $p \cdot q \cdot n$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/exam-winter-2019/w19f25.xml b/app/src/data/questions/comp2804/exam-winter-2019/w19f25.xml
new file mode 100644
index 00000000..a71893fb
--- /dev/null
+++ b/app/src/data/questions/comp2804/exam-winter-2019/w19f25.xml
@@ -0,0 +1,11 @@
+
+
+ Who discovered the Fibonacci numbers?
+
+ Donald Trump
+
+ The Italian mathematician Fibonacci, also known as Leonardo Bonacci, Leonardo of Pisa, or Leonardo Bigollo Pisano
+
+ Alexandre-Théophile Vandermonde
+ Keith Richards (the guitarist of the greatest rock band in the universe)
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m01.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m01.xml
new file mode 100644
index 00000000..cc74191a
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m01.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ ${n \choose 2} \cdot 2^{n-2}$
+ $n \cdot 2^{n-1}$
+ $2^{n} - 1 - n$
+ $2^{n} - n$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m02.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m02.xml
new file mode 100644
index 00000000..50db1f9c
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m02.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ $2^{91}$
+ $2^{95} + 2^{95}$
+ $2^{96} - 2^{91}$
+ $2^{99} - 2^{96}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m03.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m03.xml
new file mode 100644
index 00000000..8ff10b58
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m03.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $17! + 17!$
+ $2(17! + 17!)$
+ $(17!)^2$
+ $2(17!)^2$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m04.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m04.xml
new file mode 100644
index 00000000..9b757822
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m04.xml
@@ -0,0 +1,25 @@
+
+
+
+
+ all boys stand next to each other,
+
+
+ all girls stand next to each other,
+
+
+ all dogs stand next to each other,
+
+
+ none of the boys are standing next to any of the girls.
+
+
+ ]]>
+
+ $12! + 17! + 25!$
+ $2(12! + 17! + 25!)$
+ $(12!)(17!)(25!)$
+ $2(12!)(17!)(25!)$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m05.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m05.xml
new file mode 100644
index 00000000..de11e9e0
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m05.xml
@@ -0,0 +1,10 @@
+
+
+
+
+ True
+ False
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m06.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m06.xml
new file mode 100644
index 00000000..516fbf4b
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m06.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ At least two of these $n$ points are at distance at most $1$.
+ At least two of these $n$ points are at distance at most $\left. 1 \middle/ \sqrt{2} \right.$.
+ At least two of these $n$ points are at distance at most $\sqrt{2}$.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m07.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m07.xml
new file mode 100644
index 00000000..b2af2669
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m07.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ $-{100 \choose 80} 5^{20}3^{80}$
+ ${100 \choose 80} 5^{20}3^{80}$
+ ${100 \choose 80} 5^{80}3^{20}$
+ ${80 \choose 100} 5^{20}3^{80}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m08.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m08.xml
new file mode 100644
index 00000000..a0f1bfdc
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m08.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ ${30 \choose 3}$
+ ${30 \choose 4}$
+ ${31 \choose 3}$
+ ${31 \choose 4}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m09.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m09.xml
new file mode 100644
index 00000000..c2f6e282
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m09.xml
@@ -0,0 +1,27 @@
+
+
+ valid, if in each step, it either goes one unit to the right or one unit upwards.
+ In the example below, you see a valid path for the case when $m = 5$ and $n = 3$.
+
+
+
+ How many valid paths are there?
+ ]]>
+
+ ${m + n \choose n - 1}$
+ ${m + n \choose n}$
+ $2^{m + n}$
+ $2^m + 2^n$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m10.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m10.xml
new file mode 100644
index 00000000..116cc109
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m10.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ $f(n) = 2n^{2} - 5n + 7$
+ $f(n) = 2n^{2} - 5n + 8$
+ $f(n) = 3n^{2} - 5n + 8$
+ $f(n) = 4n^{2} - 5n + 8$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m11.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m11.xml
new file mode 100644
index 00000000..33581606
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m11.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $B_n = B_{n-1} + B_{n-2} + B_{n-3}$
+ $B_n = B_{n-1} + B_{n-2} + B_{n-3} + B_{n-4}$
+ $B_n = 2^{n} - 2^{n-4}$
+ $B_n = 2^{n} - (n-3) \cdot 2^{n-4}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m12.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m12.xml
new file mode 100644
index 00000000..236fef2f
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m12.xml
@@ -0,0 +1,27 @@
+
+
+
+ $\newcommand{\Fib}{{\rm F \scriptsize IB}}$
+
+
+ Consider the following recursive algorithm $\Fib$, which takes as input an
+ integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \Fib(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ f = n$
+ $\mathbf{else}\ f = \Fib(n - 1) + \Fib(n - 2)$
+ $\mathbf{endif};$
+ $\mathbf{return}\ f$
+
+
+ When running $\Fib(9)$, how many calls are there to $\Fib(4)$?
+ ]]>
+
+ 6
+ 7
+ 8
+ 9
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m13.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m13.xml
new file mode 100644
index 00000000..00a48f13
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m13.xml
@@ -0,0 +1,33 @@
+
+
+
+ $\newcommand{\Silly}{{\rm S \scriptsize ILLY}}
+ \newcommand{\elsesp}{\phantom{\mathbf{else}\ }}$
+
+
+ Consider the following recursive algorithm $\Silly$, which takes as input an integer $n \geq 1$ which is a power of 2:
+
+
+ $\mathbf{Algorithm}\ \Silly(n)\mathrm{:}$
+ $\mathbf{if}\ n = 1$
+ $\mathbf{then}\ \text{drink one pint of beer}$
+ $\mathbf{else}\ \mathbf{if}\ n = 2$
+ $\elsesp \mathbf{then}\ \text{fart once}$
+ $\elsesp \mathbf{else}\ \text{fart once};$
+ $\elsesp \elsesp \Silly(n / 2);$
+ $\elsesp \elsesp \text{fart once}$
+ $\elsesp \mathbf{endif}$
+ $\mathbf{endif}$
+
+
+ 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?
+ (n.b., $\log$ denotes the base-2 logarithm)
+ ]]>
+
+ $F(n) = \log n\ \mathrm{for}\ n \geq 1.$
+ $F(n) = 2 \log n\ \mathrm{for}\ n \geq 1.$
+ $F(n) = (2 \log n) - 1\ \mathrm{for}\ n \geq 1.$
+ $F(n) = (2 \log n) - 1\ \mathrm{for}\ n \geq 2.$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m14.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m14.xml
new file mode 100644
index 00000000..ec2c0b23
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m14.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ 1/4
+ 1/2
+ 3/4
+ 1
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m15.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m15.xml
new file mode 100644
index 00000000..d4658b4e
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m15.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ $\Pr(A) = \Pr(B)$
+ $\Pr(A) < \Pr(B)$
+ $\Pr(A) > \Pr(B)$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m16.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m16.xml
new file mode 100644
index 00000000..38c39218
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m16.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $\frac{10!}{10^{10}}$
+ $\frac{10^{10}}{10!}$
+ $1 - \frac{10 \cdot (9/10)^{10}}{10^{10}}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/f14m17.xml b/app/src/data/questions/comp2804/midterm-fall-2014/f14m17.xml
new file mode 100644
index 00000000..65ea8110
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/f14m17.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $\frac{100}{4^{100}}$
+ $\frac{3^{99}}{4^{100}}$
+ $\frac{100 + 3^{99}}{4^{100}}$
+ $\frac{100 \cdot 3^{99}}{4^{100}}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2014/midterm-fall-2014.json b/app/src/data/questions/comp2804/midterm-fall-2014/midterm-fall-2014.json
new file mode 100644
index 00000000..354c7d04
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2014/midterm-fall-2014.json
@@ -0,0 +1,24 @@
+{
+ "id": "midterm-fall-2014",
+ "title": "Fall 2014 Midterm",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/midterm-fall-2014/f14m01.xml",
+ "comp2804/midterm-fall-2014/f14m02.xml",
+ "comp2804/midterm-fall-2014/f14m03.xml",
+ "comp2804/midterm-fall-2014/f14m04.xml",
+ "comp2804/midterm-fall-2014/f14m05.xml",
+ "comp2804/midterm-fall-2014/f14m06.xml",
+ "comp2804/midterm-fall-2014/f14m07.xml",
+ "comp2804/midterm-fall-2014/f14m08.xml",
+ "comp2804/midterm-fall-2014/f14m09.xml",
+ "comp2804/midterm-fall-2014/f14m10.xml",
+ "comp2804/midterm-fall-2014/f14m11.xml",
+ "comp2804/midterm-fall-2014/f14m12.xml",
+ "comp2804/midterm-fall-2014/f14m13.xml",
+ "comp2804/midterm-fall-2014/f14m14.xml",
+ "comp2804/midterm-fall-2014/f14m15.xml",
+ "comp2804/midterm-fall-2014/f14m16.xml",
+ "comp2804/midterm-fall-2014/f14m17.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m01.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m01.xml
new file mode 100644
index 00000000..c7c13a7d
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m01.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ $n{n \choose 2}{n \choose 5}$
+ $(n-2){n\choose 2}{n-2 \choose 5}$
+ $(n-5){n \choose 2}{n-1 \choose 5}$
+ $(n-7){n \choose 2}{n-2 \choose 5}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m02.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m02.xml
new file mode 100644
index 00000000..fbf44223
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m02.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $2^{25} - 2^{22}$
+ $2^{25} - 2^{24} + 2^{23}$
+ $2^{22}$
+ $2^{23}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m03.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m03.xml
new file mode 100644
index 00000000..52f9cf9c
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m03.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $5 \cdot 6 \cdot 7 \cdot 8 \cdot 9 \cdot 10 \cdot 11 \cdot 12 \cdot 13$
+ $6 \cdot 7 \cdot 8 \cdot 9 \cdot 10 \cdot 11 \cdot 12 \cdot 13$
+ $7 \cdot 8 \cdot 9 \cdot 10 \cdot 11 \cdot 12 \cdot 13$
+ $8 \cdot 9 \cdot 10 \cdot 11 \cdot 12 \cdot 13$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m04.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m04.xml
new file mode 100644
index 00000000..d69f490a
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m04.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $S_n = 2^{n-2}$
+ $S_n = 2^{n-1}$
+ $S_n = 2^{n} - 2^{n-2}$
+ $S_n = 2^{n} - 2^{n-1} + 2^{n-2}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m05.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m05.xml
new file mode 100644
index 00000000..b8b653d1
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m05.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $3^{96} + 3^{96}$
+ $3^{99} - 2 \cdot 3^{96}$
+ $2 \cdot 3^{96} - 3^{93}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m06.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m06.xml
new file mode 100644
index 00000000..ff59120b
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m06.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ The number of non-empty subsets of a set of size $m$.
+ The number of subsets of a set of size $m$.
+ The number of bitstrings of length $m$ having exactly $k$ many 1s.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m07.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m07.xml
new file mode 100644
index 00000000..78674a6e
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m07.xml
@@ -0,0 +1,17 @@
+
+
+
+ $\newcommand{\ShortLastName}{{\rm S {\scriptsize HORT} L {\scriptsize AST} N {\scriptsize AME}}}$
+
+
+ In the city of $\ShortLastName$, every person has a last name consisting of two characters, the first one being
+ an uppercase letter and the second one being a lowercase letter. What is the minimum number of people
+ needed so that we can guarantee that at least 4 of them have the same last name?
+ ]]>
+
+ $3 \cdot 26^{2}$
+ $4 \cdot 26^{2}$
+ $3 \cdot 26^{2} + 1$
+ $4 \cdot 26^{2} + 1$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m08.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m08.xml
new file mode 100644
index 00000000..9dacc0c0
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m08.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ ${88 \choose 7} \cdot 3^{81} \cdot 17^7$
+ $- {88 \choose 7} \cdot 3^{81} \cdot 17^7$
+ ${88 \choose 7} \cdot 3^7 \cdot 17^{81}$
+ $- {88 \choose 7} \cdot 3^7 \cdot 17^{81}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m09.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m09.xml
new file mode 100644
index 00000000..69ca408c
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m09.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ ${58 \choose 3}$
+ ${58 \choose 4}$
+ ${59 \choose 3}$
+ ${59 \choose 4}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m10.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m10.xml
new file mode 100644
index 00000000..21051dc9
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m10.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ $f(n) = 4n^2 - 2n + 7$
+ $f(n) = 4n^2 - n + 7$
+ $f(n) = 5n^2 - 2n + 7$
+ $f(n) = 5n^2 - n + 7$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m11.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m11.xml
new file mode 100644
index 00000000..26e812c2
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m11.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $S_n = S_{n-1} + S_{n-2} + S_{n-3} + S_{n-4}$
+ $S_n = S_{n-1} + S_{n-2} + S_{n-3} + S_{n-4}\ +$ $ 2^{n-4}$
+ $S_n = S_{n-1} + S_{n-2} + S_{n-3}$
+ $S_n = S_{n-1} + S_{n-2} + S_{n-3} + 2^{n-3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m12.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m12.xml
new file mode 100644
index 00000000..36013787
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m12.xml
@@ -0,0 +1,35 @@
+
+
+
+
+ the order in which the 1s and 2s occur in the sum matters, and
+
+
+ it is not allowed to have two consecutive 2s.
+
+
+ For example, if $n = 7$, then both
+ $$
+ 7 = 1 + 2 + 1 + 2 + 1
+ $$
+ and
+ $$
+ 7 = 2 + 1 + 1 + 2 + 1
+ $$
+ are allowed, whereas
+ $$
+ 7 = 1 + 2 + 2 + 1 + 1
+ $$
+ is not allowed.
+
+ Which of the following is true?
+ ]]>
+
+ $S_n = S_{n-1} + S_{n-2}$
+ $S_n = S_{n-1} + S_{n-3}$
+ $S_n = S_{n-2} + S_{n-3}$
+ $S_n = S_{n-1} + S_{n-2} + S_{n-3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m13.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m13.xml
new file mode 100644
index 00000000..56caa3ef
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m13.xml
@@ -0,0 +1,27 @@
+
+
+
+ $\newcommand{\Fib}{{\rm F \scriptsize IB}}$
+
+
+ Consider the following recursive algorithm $\Fib$, which takes as input an
+ integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \Fib(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ f = n$
+ $\mathbf{else}\ f = \Fib(n - 1) + \Fib(n - 2)$
+ $\mathbf{endif};$
+ $\mathbf{return}\ f$
+
+
+ When running $\Fib(55)$, how many calls are there to $\Fib(50)$?
+ ]]>
+
+ 6
+ 7
+ 8
+ 9
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m14.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m14.xml
new file mode 100644
index 00000000..db4a18b9
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m14.xml
@@ -0,0 +1,53 @@
+
+
+
+ $\newcommand{\JustinBieber}{{\rm J {\scriptsize USTIN} B {\scriptsize IEBER}}}
+ \newcommand{\elsesp}{\phantom{\mathbf{else}\ }}$
+
+
+ Consider the following recursive algorithm $\JustinBieber$, which takes as input an integer $n \geq 1$,
+ which is a power of 2:
+
+
+ $\mathbf{Algorithm}\ \JustinBieber(n)\mathrm{:}$
+ $\mathbf{if}\ n = 1$
+ $\mathbf{then}\ \text{order chicken wings}$
+ $\mathbf{else}\ \mathbf{if}\ n = 2$
+
+
+
+ $\elsesp \mathbf{then}$ |
+
+ $\text{drink one pint of}$ $\text{India Pale Ale}$
+ |
+
+
+
+
+
+
+
+ $\elsesp \mathbf{else}\ \mathrm{print}\ \text{``}$
+ |
+
+ $\text{I don't like}$ $\text{Justin Bieber''};$
+ |
+
+
+
+ $\elsesp \elsesp \JustinBieber(n / 2)$
+ $\elsesp \mathbf{endif}$
+ $\mathbf{endif}$
+
+
+ For $n$ a power of 2, let $B(n)$ be the number of times you print "I don't like Justin Bieber" when
+ running algorithm $\JustinBieber(n)$. Which of the following is true?
+ (n.b., $\log$ denotes the base-2 logarithm)
+ ]]>
+
+ $B(n) = \log n - 1\ \text{for all}\ n \geq 2.$
+ $B(n) = \log n - 1\ \text{for all}\ n \geq 1.$
+ $B(n) = \log n\ \text{for all}\ n \geq 2.$
+ $B(n) = n - 2\ \text{for all}\ n \geq 2.$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m15.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m15.xml
new file mode 100644
index 00000000..37d9376e
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m15.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ $\frac{2^5 + 2}{2^7}$
+ $1/2$
+ $1/3$
+ $1/4$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m16.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m16.xml
new file mode 100644
index 00000000..dce84e8f
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m16.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ $\Pr(A) = \Pr(B)$
+ $\Pr(A) < \Pr(B)$
+ $\Pr(A) > \Pr(B)$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/f15m17.xml b/app/src/data/questions/comp2804/midterm-fall-2015/f15m17.xml
new file mode 100644
index 00000000..f1f4dec3
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/f15m17.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ 7/15
+ 15/7
+ 3/7
+ 7/3
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2015/midterm-fall-2015.json b/app/src/data/questions/comp2804/midterm-fall-2015/midterm-fall-2015.json
new file mode 100644
index 00000000..05663a3d
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2015/midterm-fall-2015.json
@@ -0,0 +1,24 @@
+{
+ "id": "midterm-fall-2015",
+ "title": "Fall 2015 Midterm",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/midterm-fall-2015/f15m01.xml",
+ "comp2804/midterm-fall-2015/f15m02.xml",
+ "comp2804/midterm-fall-2015/f15m03.xml",
+ "comp2804/midterm-fall-2015/f15m04.xml",
+ "comp2804/midterm-fall-2015/f15m05.xml",
+ "comp2804/midterm-fall-2015/f15m06.xml",
+ "comp2804/midterm-fall-2015/f15m07.xml",
+ "comp2804/midterm-fall-2015/f15m08.xml",
+ "comp2804/midterm-fall-2015/f15m09.xml",
+ "comp2804/midterm-fall-2015/f15m10.xml",
+ "comp2804/midterm-fall-2015/f15m11.xml",
+ "comp2804/midterm-fall-2015/f15m12.xml",
+ "comp2804/midterm-fall-2015/f15m13.xml",
+ "comp2804/midterm-fall-2015/f15m14.xml",
+ "comp2804/midterm-fall-2015/f15m15.xml",
+ "comp2804/midterm-fall-2015/f15m16.xml",
+ "comp2804/midterm-fall-2015/f15m17.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m01.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m01.xml
new file mode 100644
index 00000000..4e6b5654
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m01.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ ${f + m \choose 4}$
+ $f \cdot {f + m - 1 \choose 3}$
+ $f \cdot {f + m \choose 3}$
+ $(f - 1) \cdot {f + m \choose 3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m02.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m02.xml
new file mode 100644
index 00000000..d9879574
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m02.xml
@@ -0,0 +1,12 @@
+
+
+ and do not contain 2?
+ ]]>
+
+ ${n - 1 \choose k - 1}$
+ ${n - 1 \choose k}$
+ ${n - 2 \choose k - 2}$
+ ${n - 2 \choose k}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m03.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m03.xml
new file mode 100644
index 00000000..05571924
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m03.xml
@@ -0,0 +1,12 @@
+
+
+ or do not contain 2?
+ ]]>
+
+ ${n - 1 \choose k} + {n - 1 \choose k}$
+ ${n - 2 \choose k}$
+ ${n \choose k} - {n - 2 \choose k - 2}$
+ ${n \choose k} - {n - 1 \choose k - 1} - {n - 1 \choose k - 1}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m04.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m04.xml
new file mode 100644
index 00000000..f9f20b95
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m04.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $B_n = 2 \cdot 2^{n - 3}$
+ $B_n = 6 \cdot 2^{n - 3}$
+ $B_n = 2^n - 2$
+ $B_n = 2^n - 6$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m05.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m05.xml
new file mode 100644
index 00000000..0c855c14
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m05.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ 17
+ 18
+ 19
+ 20
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m06.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m06.xml
new file mode 100644
index 00000000..866d1b9f
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m06.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $4^{n - 2} + 4^{n - 3} - 4^{n - 5}$
+ $4^{n - 2} + 4^{n - 3}$
+ $4^n - 4^{n - 5}$
+ $4^n - 4^{n - 2} - 4^{n - 3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m07.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m07.xml
new file mode 100644
index 00000000..18a72f34
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m07.xml
@@ -0,0 +1,25 @@
+
+
+ What does
+ $$
+ {w \choose 3} \cdot {m \choose 2} + {w \choose 4} \cdot m + {w \choose 5}
+ $$
+ count?
+
+
+ The number of ways to choose 5 people out of a group consisting of $w$ women and $m$ men,
+ where at most 3 women can be chosen.
+
+
+ The number of ways to choose 5 people out of a group consisting of $w$ women and $m$ men,
+ where at most 3 men can be chosen.
+
+
+ The number of ways to choose 5 people out of a group consisting of $w$ women and $m$ men,
+ where at least 3 women must be chosen.
+
+
+ The number of ways to choose 5 people out of a group consisting of $w$ women and $m$ men,
+ where at least 3 men must be chosen.
+
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m08.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m08.xml
new file mode 100644
index 00000000..3f04f2a5
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m08.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $n - 1$
+ $n$
+ $n + 1$
+ $n + 2$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m09.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m09.xml
new file mode 100644
index 00000000..f623ae77
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m09.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ $- {50 \choose 24} \cdot 5^{26} \cdot 7^{24}$
+ $- {50 \choose 26} \cdot 5^{24} \cdot 7^{26}$
+ ${50 \choose 24} \cdot 5^{26} \cdot 7^{24}$
+ ${50 \choose 26} \cdot 5^{24} \cdot 7^{26}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m10.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m10.xml
new file mode 100644
index 00000000..93a4fed7
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m10.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ $f(n) = 7 \cdot \frac{n!}{3^n}$
+ $f(n) = 7^n \cdot \frac{n!}{3^n}$
+ $f(n) = 7 \cdot \frac{(n + 1)!}{3^n}$
+ $f(n) = 7^n \cdot \frac{(n + 1)!}{3^n}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m11.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m11.xml
new file mode 100644
index 00000000..82fa1abb
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m11.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $B_n = B_{n - 1} + B_{n - 2}$
+ $B_n = B_{n - 1} + B_{n - 3}$
+ $B_n = B_{n - 2} + B_{n - 3}$
+ $B_n = B_{n - 2} + B_{n - 4}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m12.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m12.xml
new file mode 100644
index 00000000..08974e67
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m12.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+ $11$ |
+
+ $= 3 + 4 + 4 = 4 + 3 + 4$
+ $= 4 + 4 + 3.$
+ |
+
+
+
+
+ Which of the following is true for any $n \geq 5$?
+ ]]>
+
+ $S_n = 2 \cdot S_{n - 1}$
+ $S_n = S_{n - 1} + S_{n - 2}$
+ $S_n = S_{n - 2} + S_{n - 3}$
+ $S_n = S_{n - 3} + S_{n - 4}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m13.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m13.xml
new file mode 100644
index 00000000..38e9221a
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m13.xml
@@ -0,0 +1,27 @@
+
+
+
+ $\newcommand{\Fib}{{\rm F \scriptsize IB}}$
+
+
+ Consider the following recursive algorithm $\Fib$, which takes as input an
+ integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \Fib(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ f = n$
+ $\mathbf{else}\ f = \Fib(n - 1) + \Fib(n - 2)$
+ $\mathbf{endif};$
+ $\mathbf{return}\ f$
+
+
+ When running $\Fib(12)$, how many calls are there to $\Fib(8)$?
+ ]]>
+
+ 4
+ 5
+ 6
+ 7
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m14.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m14.xml
new file mode 100644
index 00000000..d5ea4d54
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m14.xml
@@ -0,0 +1,31 @@
+
+
+
+ $\newcommand{\ElisaDrinksCider}{{\rm E {\scriptsize LISA} D {\scriptsize RINKS} C {\scriptsize IDER}}}
+ \newcommand{\elsesp}{\phantom{\mathbf{else}\ }}$
+
+
+ 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}$
+
+
+ For $n$ a power of 2, let $C(n)$ be the total number of bottles of cider that you drink when running algorithm
+ $\ElisaDrinksCider(n)$. Which of the following is true for any $n \geq 1$ that is a power of 2?
+ (n.b., $\log$ denotes the base-2 logarithm)
+ ]]>
+
+ $C(n) = n \log n - 1$
+ $C(n) = n \log n + 1$
+ $C(n) = n \log n$
+ $C(n) = 2n \log n$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m15.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m15.xml
new file mode 100644
index 00000000..2fa3e89d
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m15.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ 1/4
+ 1/3
+ 1/2
+ 1
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m16.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m16.xml
new file mode 100644
index 00000000..b7ca9ccb
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m16.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ ${4 \choose 2} \cdot \frac{1}{365}$
+
+ ${4 \choose 2} \cdot \frac{1}{365} + {4 \choose 3} \cdot \frac{1}{365^2} + {4 \choose 4} \cdot \frac{1}{365^3}$
+
+ $1 - \frac{361 \cdot 362 \cdot 363 \cdot 364}{365^4}$
+ $1 - \frac{362 \cdot 363 \cdot 364}{365^3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/f16m17.xml b/app/src/data/questions/comp2804/midterm-fall-2016/f16m17.xml
new file mode 100644
index 00000000..94774750
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/f16m17.xml
@@ -0,0 +1,18 @@
+
+
+ Hearthstone, you are given a deck of 18 distinct cards. One of the cards is the Raven Idol.
+ You choose a uniformly random hand of 3 cards. Define the event
+
+ [defs]
+ A = $\text{``}$the hand of 3 cards contains the Raven Idol$\,\text{''}.$
+ [/defs]
+
+ What is $\Pr(A)$?
+ ]]>
+
+ 3/17
+ 3/18
+ 3/19
+ 4/19
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2016/midterm-fall-2016.json b/app/src/data/questions/comp2804/midterm-fall-2016/midterm-fall-2016.json
new file mode 100644
index 00000000..4a595c72
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2016/midterm-fall-2016.json
@@ -0,0 +1,24 @@
+{
+ "id": "midterm-fall-2016",
+ "title": "Fall 2016 Midterm",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/midterm-fall-2016/f16m01.xml",
+ "comp2804/midterm-fall-2016/f16m02.xml",
+ "comp2804/midterm-fall-2016/f16m03.xml",
+ "comp2804/midterm-fall-2016/f16m04.xml",
+ "comp2804/midterm-fall-2016/f16m05.xml",
+ "comp2804/midterm-fall-2016/f16m06.xml",
+ "comp2804/midterm-fall-2016/f16m07.xml",
+ "comp2804/midterm-fall-2016/f16m08.xml",
+ "comp2804/midterm-fall-2016/f16m09.xml",
+ "comp2804/midterm-fall-2016/f16m10.xml",
+ "comp2804/midterm-fall-2016/f16m11.xml",
+ "comp2804/midterm-fall-2016/f16m12.xml",
+ "comp2804/midterm-fall-2016/f16m13.xml",
+ "comp2804/midterm-fall-2016/f16m14.xml",
+ "comp2804/midterm-fall-2016/f16m15.xml",
+ "comp2804/midterm-fall-2016/f16m16.xml",
+ "comp2804/midterm-fall-2016/f16m17.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m01.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m01.xml
new file mode 100644
index 00000000..d8074714
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m01.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ ${n/2 \choose 4} \cdot {n/2 \choose 3}$
+ ${n \choose 4} \cdot {n \choose 3}$
+ ${n/2 \choose 4} + {n/2 \choose 3}$
+ ${n \choose 4} + {n \choose 3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m02.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m02.xml
new file mode 100644
index 00000000..9879809d
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m02.xml
@@ -0,0 +1,26 @@
+
+
+
+
+ $s$ students who are dressed up as Superman,
+
+
+ $t$ students who are dressed up as Donald Trump,
+
+
+ $k$ students who are dressed up as Kim Jong Un.
+
+
+ These $s+t+k$ students are arranged on a line, such that all Supermen are standing next to each
+ other, all Trumps are standing next to each other, all Kims are standing next to each other, and no
+ Trump is standing next to any Kim. How many such arrangements are there?
+ ]]>
+
+ $\left. (s+t+k)! \middle/ (s! \cdot t! \cdot k!) \right.$
+ $\left. (s+t+k)! \middle/ (2 \cdot s! \cdot t! \cdot k!) \right.$
+ $s! \cdot t! \cdot k!$
+ $2 \cdot s! \cdot t! \cdot k!$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m03.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m03.xml
new file mode 100644
index 00000000..186d74a0
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m03.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ $(7n)^{n}$
+ $n^{7n}$
+ $n^{n}$
+ $7^{n}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m04.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m04.xml
new file mode 100644
index 00000000..167a9c88
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m04.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ ${n \choose 5} + {n \choose 3} \cdot {m \choose 2} + n \cdot {m \choose 4}$
+ ${m \choose 5} + {m \choose 3} \cdot {n \choose 2} + m \cdot {n \choose 4}$
+ ${m+n \choose 5} - {n \choose 5}$
+ ${m \choose 5} \cdot {n \choose 5}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m05.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m05.xml
new file mode 100644
index 00000000..269d43a7
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m05.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $(n/2) \cdot 2^{n/2}$
+ $2^{n/2} + 2^{n/2}$
+ $2^{n} - 2^{n/2}$
+ $2^{n} + 2^{n/2}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m06.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m06.xml
new file mode 100644
index 00000000..91c7aee6
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m06.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $4^{n-3} + 4^{n-4}$
+ $4^{n-3} + 4^{n-4} - 4^{n-7}$
+ $2 \cdot 4^{n-3} - 4^{n-7}$
+ $2 \cdot 4^{n-4} - 4^{n-7}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m07.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m07.xml
new file mode 100644
index 00000000..e5396e04
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m07.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ The number of strings of length $n$, where each character is $a$ or $b$, that contain at least one $a$.
+ The number of strings of length $n$, where each character is $a$ or $b$, that contain at least 2 many $a$'s.
+ The number of strings of length $n$, where each character is $a$, $b$, or $c$, that contain at least one $a$.
+ The number of strings of length $n$, where each character is $a$, $b$, or $c$, that contain at least 2 many $a$'s.
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m08.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m08.xml
new file mode 100644
index 00000000..82306d7b
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m08.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ 4
+ 5
+ 6
+ 7
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m09.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m09.xml
new file mode 100644
index 00000000..24a4d334
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m09.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ ${100 \choose 80} \cdot 7^{20} \cdot 13^{80}$
+ $- {100 \choose 80} \cdot 7^{20} \cdot 13^{80}$
+ ${100 \choose 20} \cdot 7^{80} \cdot 13^{20}$
+ $- {100 \choose 20} \cdot 7^{80} \cdot 13^{20}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m10.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m10.xml
new file mode 100644
index 00000000..9f2df3d2
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m10.xml
@@ -0,0 +1,12 @@
+
+
+ free if it does not contain 01.
+ Let $n \geq 2$ be an integer. How many 01-free bitstrings of length $n$ are there?
+ ]]>
+
+ $n-1$
+ $n$
+ $n+1$
+ $n+2$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m11.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m11.xml
new file mode 100644
index 00000000..291e9da1
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m11.xml
@@ -0,0 +1,16 @@
+
+
+ free if it does not contain two 0's next to each other.
+ In class, we have seen that for any $m \geq 1$, the number of 00-free
+ bitstrings of length $m$ is equal to the $(m + 2)$-th Fibonacci number $f_{m+2}$.
+
+ What is the number of 00-free bitstrings of length 20 that have 0 at position 7?
+ (The positions are numbered $1,2,\dots,20$.)
+ ]]>
+
+ $f_{7} \cdot f_{15}$
+ $f_{8} \cdot f_{14}$
+ $f_{8} \cdot f_{15}$
+ $f_{7} \cdot f_{14}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m12.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m12.xml
new file mode 100644
index 00000000..ae58c3c0
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m12.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+ $f(m, 0)$ |
+ $= m\ \;$ |
+ $\mathrm{if}\ m \geq 0,$ |
+
+
+ $f(m, n)$ |
+ $= 1 + f(m, n - 1)\ \;$ |
+ $\mathrm{if}\ m \geq 0$ $\mathrm{and}\ n \geq 1,$ |
+
+
+ $g(0)$ |
+ $= 1,$ |
+
+
+ $g(n)$ |
+ $= 5 \cdot g(n - 1)\ \;$ |
+ $\mathrm{if}\ n \geq 1.$ |
+
+
+
+
+ For any integer $n \geq 0$, what is $f(g(n), g(n))$?
+ ]]>
+
+ $2 \cdot 5^{n}$
+ $2 \cdot 5^{n-1}$
+ $(5^{n})^{2}$
+ $(5^{n-1})^{2}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m13.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m13.xml
new file mode 100644
index 00000000..14fb77bb
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m13.xml
@@ -0,0 +1,14 @@
+
+
+ ccc-free
+ if it does not contain ccc.
+
+ For any integer $n \geq 4$, let $B_n$ be the number of ccc-free strings of length $n$. Which of the following is true?
+ ]]>
+
+ $B_n = B_{n-1} + B_{n-2} + B_{n-3}$
+ $B_n = 2 \cdot B_{n-1} + 2 \cdot B_{n-2} + 2 \cdot B_{n-3}$
+ $B_n = 2 \cdot B_{n-1} + 2 \cdot B_{n-2} + B_{n-3}$
+ $B_n = B_{n-1} + B_{n-2} + 2 \cdot B_{n-3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m14.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m14.xml
new file mode 100644
index 00000000..c6cd52d4
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m14.xml
@@ -0,0 +1,35 @@
+
+
+
+
+ A brick is a horizontal or vertical board consisting of 2 square cells; see the bottom part of the figure
+ above. A tiling of the board $B_n$ is a placement of bricks on the board such that
+
+ - the bricks exactly cover $B_n$ and
+ - no two bricks overlap.
+
+ The figure below shows a tiling of $B_{13}$.
+
+
+
+ Let $T_n$ be the number of different tilings of the board $B_n$. Which of the following is true for any $n \geq 3$?
+ ]]>
+
+ $T_n = T_{n + 1} + T_{n + 2}$
+ $T_n = T_{n - 1} + T_{n - 2}$
+ $T_n = 2 \cdot T_{n - 1} + T_{n - 2}$
+ $T_n = T_{n - 1} + 2 \cdot T_{n - 2}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m15.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m15.xml
new file mode 100644
index 00000000..3968cc1a
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m15.xml
@@ -0,0 +1,28 @@
+
+
+
+ $\newcommand{\Hello}{{\rm H {\scriptsize ELLO}}}
+ \newcommand{\elsesp}{\phantom{\mathbf{else}\ }}$
+
+
+ Consider the recursive algorithm $\Hello$, which takes as input an integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \Hello(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ \text{print ``hello''}$
+ $\mathbf{else}\ \Hello(n - 1);$
+ $\elsesp \text{print ``hello''};$
+ $\elsesp \Hello(n - 2)$
+ $\mathbf{endif}$
+
+
+ If you run algorithm $\Hello(5)$, how many times is the word "hello" printed?
+ ]]>
+
+ 13
+ 14
+ 15
+ 16
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m16.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m16.xml
new file mode 100644
index 00000000..4b755133
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m16.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ $\frac{{19 \choose 6} + {19 \choose 6}}{{20 \choose 7}}$
+ $\frac{2 \cdot {20 \choose 6} - {20 \choose 5}}{{20 \choose 7}}$
+ $\frac{2 \cdot {19 \choose 7} - {18 \choose 7}}{{20 \choose 7}}$
+ $\frac{2 \cdot {19 \choose 6} - {18 \choose 5}}{{20 \choose 7}}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/f17m17.xml b/app/src/data/questions/comp2804/midterm-fall-2017/f17m17.xml
new file mode 100644
index 00000000..5f653ad9
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/f17m17.xml
@@ -0,0 +1,22 @@
+
+
+
+
+ Let $m \geq 7$ and $n \geq 7$ be integers. There are $m$ houses whose owners hand out candy and
+ there are $n$ houses whose owners do not hand out candy.
+
+ The ladies choose a uniformly random subset of 7 houses and visit these 7 houses. Define the event
+ [defs]
+ A = "the ladies throw rotten eggs at exactly 2 of the 7 chosen houses".
+ [/defs]
+ What is $\Pr(A)$?
+ ]]>
+
+ $\frac{{m \choose 5} + {n \choose 2}}{{m+n \choose 7}}$
+ $\frac{{m \choose 5} \cdot {n \choose 2}}{{m+n \choose 7}}$
+ $\frac{{7 \choose 2}}{{m \choose 5} \cdot {n \choose 2}}$
+ $\frac{{7 \choose 2}}{{m+n \choose 7}}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2017/midterm-fall-2017.json b/app/src/data/questions/comp2804/midterm-fall-2017/midterm-fall-2017.json
new file mode 100644
index 00000000..b94578dd
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2017/midterm-fall-2017.json
@@ -0,0 +1,24 @@
+{
+ "id": "midterm-fall-2017",
+ "title": "Fall 2017 Midterm",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/midterm-fall-2017/f17m01.xml",
+ "comp2804/midterm-fall-2017/f17m02.xml",
+ "comp2804/midterm-fall-2017/f17m03.xml",
+ "comp2804/midterm-fall-2017/f17m04.xml",
+ "comp2804/midterm-fall-2017/f17m05.xml",
+ "comp2804/midterm-fall-2017/f17m06.xml",
+ "comp2804/midterm-fall-2017/f17m07.xml",
+ "comp2804/midterm-fall-2017/f17m08.xml",
+ "comp2804/midterm-fall-2017/f17m09.xml",
+ "comp2804/midterm-fall-2017/f17m10.xml",
+ "comp2804/midterm-fall-2017/f17m11.xml",
+ "comp2804/midterm-fall-2017/f17m12.xml",
+ "comp2804/midterm-fall-2017/f17m13.xml",
+ "comp2804/midterm-fall-2017/f17m14.xml",
+ "comp2804/midterm-fall-2017/f17m15.xml",
+ "comp2804/midterm-fall-2017/f17m16.xml",
+ "comp2804/midterm-fall-2017/f17m17.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m01.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m01.xml
new file mode 100644
index 00000000..677cfce9
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m01.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ $2^n$
+ $3^n$
+ $4^n$
+ $5^n$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m02.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m02.xml
new file mode 100644
index 00000000..48d78487
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m02.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ the bit at each even position is 0, or
+
+
+ the bitstring starts with 1010?
+
+
+ ]]>
+
+ 54
+ 56
+ 58
+ 60
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m03.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m03.xml
new file mode 100644
index 00000000..eb895664
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m03.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $52^{15} - 26^{15} - 15 \cdot 26^{14}$
+ $52^{15} - 26^{15} - 15 \cdot 26^{15}$
+ $52^{15} - 15 \cdot 26^{15}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m04.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m04.xml
new file mode 100644
index 00000000..5392dc35
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m04.xml
@@ -0,0 +1,16 @@
+
+
+
+ In how many ways can Elisa place these orders of cider, such that exactly 4 of her friends get a
+ cider of type $C_3$?
+ ]]>
+
+ ${7 \choose 4} \cdot 7^3$
+ ${7 \choose 4} \cdot 8^3$
+ ${7 \choose 4} \cdot 7^4$
+ ${7 \choose 4} \cdot 8^4$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m05.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m05.xml
new file mode 100644
index 00000000..5b1f19de
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m05.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ ${22 \choose 5}$
+ ${22 \choose 4}$
+ ${21 \choose 5}$
+ ${21 \choose 4}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m06.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m06.xml
new file mode 100644
index 00000000..84952642
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m06.xml
@@ -0,0 +1,12 @@
+
+
+
+ What is the minimum size of this subset $S$, such that there must be at least two elements in $S$ whose sum is equal to 51?
+ ]]>
+
+ 25
+ 26
+ 27
+ 28
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m07.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m07.xml
new file mode 100644
index 00000000..373819b9
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m07.xml
@@ -0,0 +1,13 @@
+
+
+
+ How many such subsets have the property that $x_3 = 7$?
+ ]]>
+
+ ${6 \choose 2} \cdot {10 \choose 2}$
+ ${6 \choose 2} \cdot {9 \choose 2}$
+ ${7 \choose 2} \cdot {10 \choose 2}$
+ ${7 \choose 2} \cdot {9 \choose 2}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m08.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m08.xml
new file mode 100644
index 00000000..c234af29
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m08.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ Consider subsets $X$ of $\mathcal{B} \cup \mathcal{C}$, such that $X$ consists of exactly 5 beer
+ bottles and all cider bottles in $X$ have an even index.
+
+ How many such subsets $X$ are there?
+ ]]>
+
+ ${12 \choose 5} \cdot 2^6$
+ ${13 \choose 5} \cdot 2^5$
+ ${13 \choose 5} \cdot 2^6$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m09.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m09.xml
new file mode 100644
index 00000000..4c349692
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m09.xml
@@ -0,0 +1,16 @@
+
+
+ palindrome, if $$s_1s_2...s_{n-1}s_n = s_ns_{n-1}...s_2s_1,$$
+ i.e., reading the string from left to right gives the same string as when reading from right to left.
+
+ For any integer $n \geq 1$, let $P_n$ be the number of bitstrings of length $n$ that are palindromes.
+
+ Which of the following is true for any integer $n \geq 3$?
+ ]]>
+
+ $P_n = 2 + P_{n-2}$
+ $P_n = 2 \cdot P_{n/2}$
+ $P_n = 2 \cdot P_{n-1}$
+ $P_n = 2 \cdot P_{n-2}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m10.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m10.xml
new file mode 100644
index 00000000..f17e8d26
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m10.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ For any integer $k$ with $0 \leq k \leq n$, consider subsets $X$ of $\mathcal{B} \cup \mathcal{C}$,
+ such that $X$ consists of exactly $k$ bottles and no two bottles in $X$ have the same index. (For
+ example, if $B_n \in X$, then $C_n \notin X$.)
+
+ Let $F(n,k)$ be the number of such subsets X.
+ Which of the following is true for all integers $n \geq 2$ and $k$ with $1 \leq k \leq n - 1$?
+ ]]>
+
+ $F(n,k) = F(n-1,k)\ +$ $ F(n-1,k-1)$
+ $F(n,k) = F(n-1,k)\ +$ $ 2 \cdot F(n-1,k-1)$
+ $F(n,k) = F(n,k-1)\ +$ $ F(n-1,k-1)$
+ $F(n,k) = F(n,k-1)\ +$ $ 2 \cdot F(n-1,k-1)$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m11.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m11.xml
new file mode 100644
index 00000000..8872d37f
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m11.xml
@@ -0,0 +1,16 @@
+
+
+ free, if it does not contain two 0's next to each other.
+ In class, we have seen that for any $m \geq 1$,
+ the number of 00-free bitstrings of length $m$ is equal to the $(m+2)$-th Fibonacci number $f_{m+2}$.
+
+ What is the number of 00-free bitstrings of length 55 that have 0 at position 9, and 1 at position 40?
+ (The positions are numbered $1,2,\dots,55$.)
+ ]]>
+
+ $f_7 \cdot f_{29} \cdot f_{15}$
+ $f_8 \cdot f_{30} \cdot f_{16}$
+ $f_9 \cdot f_{31} \cdot f_{17}$
+ $f_{10} \cdot f_{32} \cdot f_{18}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m12.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m12.xml
new file mode 100644
index 00000000..422e38e9
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m12.xml
@@ -0,0 +1,21 @@
+
+
+
+
+ $3 + 5 \cdot 2^{n}$
+ $5 + 3 \cdot 2^{n}$
+ $2^{3 + 5n}$
+ $2^{5 + 3n}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m13.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m13.xml
new file mode 100644
index 00000000..82ff6b78
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m13.xml
@@ -0,0 +1,15 @@
+
+
+ -free, if it does not contain two $q$'s next to each other.
+ For any integer $n \geq 1$, let $Q_n$ be the number of $qq$-free strings of length $n$.
+
+ Which of the following is true for any integer $n \geq 3$?
+ ]]>
+
+ $Q(n) = 26 \cdot Q(n-1) + 26 \cdot Q(n-2)$
+ $Q(n) = 25 \cdot Q(n-1) + 25 \cdot Q(n-2)$
+ $Q(n) = 26 \cdot Q(n-1) + 25 \cdot Q(n-2)$
+ $Q(n) = 25 \cdot Q(n-1) + 26 \cdot Q(n-2)$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m14.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m14.xml
new file mode 100644
index 00000000..aaf25f2b
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m14.xml
@@ -0,0 +1,33 @@
+
+
+
+ $\newcommand{\Fart}{{\rm F {\scriptsize ART}}}
+ \newcommand{\elsesp}{\phantom{\mathbf{else}\ }}
+ \newcommand{\thensp}{\phantom{\mathbf{then}\ }}$
+
+
+ Consider the recursive algorithm $\Fart$, which takes as input an integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \Fart(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ \text{eat one can of beans}$
+ $\mathbf{else}\ \mathbf{if}\ n\ \mathrm{is}\ \mathrm{even}$
+ $\elsesp \mathbf{then}\ \text{fart once};$
+ $\elsesp \thensp \Fart \left( n \middle/ 2 \right)$
+ $\elsesp \mathbf{else}\ \Fart(n + 1);$
+ $\elsesp \elsesp \text{fart once};$
+ $\elsesp \elsesp \Fart(n - 1)$
+ $\elsesp \mathbf{endif};$
+ $\mathbf{endif}$
+
+
+ If you run algorithm $\Fart(9)$, how many times do you fart?
+ ]]>
+
+ 11
+ 12
+ 13
+ 14
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m15.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m15.xml
new file mode 100644
index 00000000..e47b28ab
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m15.xml
@@ -0,0 +1,29 @@
+
+
+
+
+ one student is dressed up as Donald Trump,
+
+
+ one student is dressed up as Kim Jong Un,
+
+
+ the remaining 57 students are dressed up as Kim Kardashian.
+
+
+ These students are arranged, uniformly at random, on a line.
+
+ Define the event,
+ [defs]
+ A = "Donald Trump is standing next to Kim Jong Un".
+ [/defs]
+ What is $\Pr(A)$?
+ ]]>
+
+ 1/58
+ 2/58
+ 1/59
+ 2/59
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m16.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m16.xml
new file mode 100644
index 00000000..33bbf22b
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m16.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ Define the event
+ [defs]
+ A = "Alexa, Tri, and Zoltan have different birthdays".
+ [/defs]
+ What is $\text{Pr}(A)$?
+ ]]>
+
+ $\frac{365^2}{363 \cdot 364}$
+ $\frac{363^3}{362 \cdot 363 \cdot 364}$
+ $\frac{363 \cdot 364}{365^2}$
+ $\frac{362 \cdot 363 \cdot 364}{365^3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/f18m17.xml b/app/src/data/questions/comp2804/midterm-fall-2018/f18m17.xml
new file mode 100644
index 00000000..444d39eb
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/f18m17.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ Define the event
+ [defs]
+ A = "you answer exactly 7 questions correctly".
+ [/defs]
+ What $\Pr(A)$?
+ ]]>
+
+ $\frac{{17 \choose 7} \cdot 3^{10}}{4^{17}}$
+ $\frac{{17 \choose 7} \cdot 2^{10}}{4^{17}}$
+ $\frac{{17 \choose 7}}{4^{17}}$
+ $\frac{4^{17}}{{17 \choose 7}}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2018/midterm-fall-2018.json b/app/src/data/questions/comp2804/midterm-fall-2018/midterm-fall-2018.json
new file mode 100644
index 00000000..b78c5e38
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2018/midterm-fall-2018.json
@@ -0,0 +1,24 @@
+{
+ "id": "midterm-fall-2018",
+ "title": "Fall 2018 Midterm",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/midterm-fall-2018/f18m01.xml",
+ "comp2804/midterm-fall-2018/f18m02.xml",
+ "comp2804/midterm-fall-2018/f18m03.xml",
+ "comp2804/midterm-fall-2018/f18m04.xml",
+ "comp2804/midterm-fall-2018/f18m05.xml",
+ "comp2804/midterm-fall-2018/f18m06.xml",
+ "comp2804/midterm-fall-2018/f18m07.xml",
+ "comp2804/midterm-fall-2018/f18m08.xml",
+ "comp2804/midterm-fall-2018/f18m09.xml",
+ "comp2804/midterm-fall-2018/f18m10.xml",
+ "comp2804/midterm-fall-2018/f18m11.xml",
+ "comp2804/midterm-fall-2018/f18m12.xml",
+ "comp2804/midterm-fall-2018/f18m13.xml",
+ "comp2804/midterm-fall-2018/f18m14.xml",
+ "comp2804/midterm-fall-2018/f18m15.xml",
+ "comp2804/midterm-fall-2018/f18m16.xml",
+ "comp2804/midterm-fall-2018/f18m17.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m01.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m01.xml
new file mode 100644
index 00000000..7031cbd4
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m01.xml
@@ -0,0 +1,13 @@
+
+
+ ${f + m \choose 3}$
+ $f \cdot {f + m - 1 \choose 3}$
+ $f \cdot {f + m \choose 3}$
+ $(f - 1) \cdot {f + m \choose 3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m02.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m02.xml
new file mode 100644
index 00000000..f9addcde
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m02.xml
@@ -0,0 +1,10 @@
+
+ and do not contain 2?
+ ]]>
+ ${n - 1 \choose k - 1}$
+ ${n - 1 \choose k}$
+ ${n - 2 \choose k - 2}$
+ ${n - 2 \choose k}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m03.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m03.xml
new file mode 100644
index 00000000..873a746d
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m03.xml
@@ -0,0 +1,10 @@
+
+ or do not contain 2?
+ ]]>
+ ${n - 1 \choose k} + {n - 1 \choose k}$
+ ${n - 2 \choose k}$
+ ${n \choose k} - {n - 2 \choose k - 2}$
+ ${n \choose k} - {n - 1 \choose k - 1} - {n - 1 \choose k - 1}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m04.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m04.xml
new file mode 100644
index 00000000..ecb78afb
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m04.xml
@@ -0,0 +1,10 @@
+
+
+ $B_n = 2 \cdot 2^{n - 3}$
+ $B_n = 6 \cdot 2^{n - 3}$
+ $B_n = 2^n - 2$
+ $B_n = 2^n - 6$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m05.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m05.xml
new file mode 100644
index 00000000..18377f1a
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m05.xml
@@ -0,0 +1,10 @@
+
+
+ 17
+ 18
+ 19
+ 20
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m06.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m06.xml
new file mode 100644
index 00000000..801080e7
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m06.xml
@@ -0,0 +1,10 @@
+
+
+ $4^{n - 2} + 4^{n - 3} - 4^{n - 5}$
+ $4^{n - 2} + 4^{n - 3}$
+ $4^n - 4^{n - 5}$
+ $4^n - 4^{n - 2} - 4^{n - 3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m07.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m07.xml
new file mode 100644
index 00000000..18a72f34
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m07.xml
@@ -0,0 +1,25 @@
+
+
+ What does
+ $$
+ {w \choose 3} \cdot {m \choose 2} + {w \choose 4} \cdot m + {w \choose 5}
+ $$
+ count?
+
+
+ The number of ways to choose 5 people out of a group consisting of $w$ women and $m$ men,
+ where at most 3 women can be chosen.
+
+
+ The number of ways to choose 5 people out of a group consisting of $w$ women and $m$ men,
+ where at most 3 men can be chosen.
+
+
+ The number of ways to choose 5 people out of a group consisting of $w$ women and $m$ men,
+ where at least 3 women must be chosen.
+
+
+ The number of ways to choose 5 people out of a group consisting of $w$ women and $m$ men,
+ where at least 3 men must be chosen.
+
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m08.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m08.xml
new file mode 100644
index 00000000..e8634d05
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m08.xml
@@ -0,0 +1,11 @@
+
+
+ $n - 1$
+ $n$
+ $n + 1$
+ $n + 2$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m09.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m09.xml
new file mode 100644
index 00000000..855e005b
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m09.xml
@@ -0,0 +1,9 @@
+
+
+ $- {50 \choose 24} \cdot 5^{26} \cdot 7^{24}$
+ $- {50 \choose 26} \cdot 5^{24} \cdot 7^{26}$
+ ${50 \choose 24} \cdot 5^{26} \cdot 7^{24}$
+ ${50 \choose 26} \cdot 5^{24} \cdot 7^{26}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m10.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m10.xml
new file mode 100644
index 00000000..3d09cc24
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m10.xml
@@ -0,0 +1,16 @@
+
+
+ $f(n) = 7 \cdot \frac{n!}{3^n}$
+ $f(n) = 7^n \cdot \frac{n!}{3^n}$
+ $f(n) = 7 \cdot \frac{(n + 1)!}{3^n}$
+ $f(n) = 7^n \cdot \frac{(n + 1)!}{3^n}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m11.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m11.xml
new file mode 100644
index 00000000..e3ea3e87
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m11.xml
@@ -0,0 +1,11 @@
+
+
+ $B_n = B_{n - 1} + B_{n - 2}$
+ $B_n = B_{n - 1} + B_{n - 3}$
+ $B_n = B_{n - 2} + B_{n - 3}$
+ $B_n = B_{n - 2} + B_{n - 4}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m12.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m12.xml
new file mode 100644
index 00000000..d8ce881a
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m12.xml
@@ -0,0 +1,26 @@
+
+
+
+
+ $11$ |
+
+ $= 3 + 4 + 4 = 4 + 3 + 4$
+ $= 4 + 4 + 3.$
+ |
+
+
+
+
+ Which of the following is true for any $n \geq 5$?
+ ]]>
+ $S_n = 2 \cdot S_{n - 1}$
+ $S_n = S_{n - 1} + S_{n - 2}$
+ $S_n = S_{n - 2} + S_{n - 3}$
+ $S_n = S_{n - 3} + S_{n - 4}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m13.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m13.xml
new file mode 100644
index 00000000..cb6e3504
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m13.xml
@@ -0,0 +1,23 @@
+
+ $\newcommand{\Fib}{{\rm F \scriptsize IB}}$
+
+ Consider the following recursive algorithm $\Fib$, which takes as input an
+ integer $n \geq 0$:
+
+
+ $\Fib(n):$
+ $\quad \mathbf{if}\ n = 0\ \mathrm{or}\ n = 1\ \mathbf{then}$
+ $\quad \quad f = n$
+ $\quad \mathbf{else}$
+ $\quad \quad f = \Fib(n - 1) + \Fib(n - 2)$
+ $\quad \mathbf{return}\ f$
+
+
+ When running $\Fib(12)$, how many calls are there to $\Fib(8)$?
+ ]]>
+ 4
+ 5
+ 6
+ 7
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m14.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m14.xml
new file mode 100644
index 00000000..8413f79b
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m14.xml
@@ -0,0 +1,28 @@
+
+
+ $\newcommand{\ElisaDrinksCider}{{\rm E {\scriptsize LISA} D {\scriptsize RINKS} C {\scriptsize IDER}}}$
+
+
+ Consider the following recursive algorithm $\ElisaDrinksCider$, which takes as input an integer
+ $n \geq 1$, which is a power of 2:
+
+
+ $\ElisaDrinksCider(n):$
+ $\quad \mathbf{if}\ n = 1\ \mathbf{then}$
+ $\quad \quad \text{then order Fibonachos}$
+ $\quad \mathbf{else}$
+ $\quad \quad \ElisaDrinksCider\left(n \middle/ 2 \right)$
+ $\quad \quad \mathrm{drink}\ n\ \text{bottles of cider}$
+ $\quad \quad \ElisaDrinksCider\left(n \middle/ 2 \right)$
+
+
+ For $n$ a power of 2, let $C(n)$ be the total number of bottles of cider that you drink when running algorithm
+ $\ElisaDrinksCider(n)$. Which of the following is true for any $n \geq 1$ that is a power of 2?
+ (n.b., $\log$ denotes the base-2 logarithm)
+ ]]>
+ $C(n) = n \log n - 1$
+ $C(n) = n \log n + 1$
+ $C(n) = n \log n$
+ $C(n) = 2n \log n$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m15.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m15.xml
new file mode 100644
index 00000000..4734ec9d
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m15.xml
@@ -0,0 +1,14 @@
+
+
+ 1/4
+ 1/3
+ 1/2
+ 1
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m16.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m16.xml
new file mode 100644
index 00000000..eb177623
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m16.xml
@@ -0,0 +1,18 @@
+
+
+ ${4 \choose 2} \cdot \frac{1}{365}$
+
+ ${4 \choose 2} \cdot \frac{1}{365} + {4 \choose 3} \cdot \frac{1}{365^2} + {4 \choose 4} \cdot \frac{1}{365^3}$
+
+ $1 - \frac{361 \cdot 362 \cdot 363 \cdot 364}{365^4}$
+ $1 - \frac{362 \cdot 363 \cdot 364}{365^3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/f19m17.xml b/app/src/data/questions/comp2804/midterm-fall-2019/f19m17.xml
new file mode 100644
index 00000000..06c198a7
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/f19m17.xml
@@ -0,0 +1,16 @@
+
+ Raven Idol.
+ You choose a uniformly random hand of 3 cards. Define the event
+
+ [defs]
+ A = "the hand of 3 cards contains the Raven Idol".
+ [/defs]
+
+ What is $\Pr(A)$?
+ ]]>
+ 3/17
+ 3/18
+ 4/19
+ $1 - (17/18)^3$
+
diff --git a/app/src/data/questions/comp2804/midterm-fall-2019/midterm-fall-2019.json b/app/src/data/questions/comp2804/midterm-fall-2019/midterm-fall-2019.json
new file mode 100644
index 00000000..d794868b
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-fall-2019/midterm-fall-2019.json
@@ -0,0 +1,24 @@
+{
+ "id": "midterm-fall-2019",
+ "title": "Fall 2019 Midterm",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/midterm-fall-2019/f19m01.xml",
+ "comp2804/midterm-fall-2019/f19m02.xml",
+ "comp2804/midterm-fall-2019/f19m03.xml",
+ "comp2804/midterm-fall-2019/f19m04.xml",
+ "comp2804/midterm-fall-2019/f19m05.xml",
+ "comp2804/midterm-fall-2019/f19m06.xml",
+ "comp2804/midterm-fall-2019/f19m07.xml",
+ "comp2804/midterm-fall-2019/f19m08.xml",
+ "comp2804/midterm-fall-2019/f19m09.xml",
+ "comp2804/midterm-fall-2019/f19m10.xml",
+ "comp2804/midterm-fall-2019/f19m11.xml",
+ "comp2804/midterm-fall-2019/f19m12.xml",
+ "comp2804/midterm-fall-2019/f19m13.xml",
+ "comp2804/midterm-fall-2019/f19m14.xml",
+ "comp2804/midterm-fall-2019/f19m15.xml",
+ "comp2804/midterm-fall-2019/f19m16.xml",
+ "comp2804/midterm-fall-2019/f19m17.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/midterm-winter-2014.json b/app/src/data/questions/comp2804/midterm-winter-2014/midterm-winter-2014.json
new file mode 100644
index 00000000..e49eddee
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/midterm-winter-2014.json
@@ -0,0 +1,24 @@
+{
+ "id": "midterm-winter-2014",
+ "title": "Winter 2014 Midterm",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/midterm-winter-2014/w14m01.xml",
+ "comp2804/midterm-winter-2014/w14m02.xml",
+ "comp2804/midterm-winter-2014/w14m03.xml",
+ "comp2804/midterm-winter-2014/w14m04.xml",
+ "comp2804/midterm-winter-2014/w14m05.xml",
+ "comp2804/midterm-winter-2014/w14m06.xml",
+ "comp2804/midterm-winter-2014/w14m07.xml",
+ "comp2804/midterm-winter-2014/w14m08.xml",
+ "comp2804/midterm-winter-2014/w14m09.xml",
+ "comp2804/midterm-winter-2014/w14m10.xml",
+ "comp2804/midterm-winter-2014/w14m11.xml",
+ "comp2804/midterm-winter-2014/w14m12.xml",
+ "comp2804/midterm-winter-2014/w14m13.xml",
+ "comp2804/midterm-winter-2014/w14m14.xml",
+ "comp2804/midterm-winter-2014/w14m15.xml",
+ "comp2804/midterm-winter-2014/w14m16.xml",
+ "comp2804/midterm-winter-2014/w14m17.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m01.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m01.xml
new file mode 100644
index 00000000..0b766122
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m01.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ ${m + n + k \choose 7} - (m + n + k)$
+ ${m + n + k \choose 7} - {m \choose 2} - {n \choose 2} - {k \choose 2}$
+
+ ${m \choose 3}{n \choose 2}{k \choose 2} + {m \choose 2}{n \choose 3}{k \choose 2} + {m \choose 2}{n \choose 2}{k \choose 3}$
+
+ ${m \choose 2}{n \choose 2}{k \choose 2}(m + n + k)$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m02.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m02.xml
new file mode 100644
index 00000000..5c787ee9
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m02.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $\frac{24!}{9!15!}$
+ ${24 \choose 9}(9!)(15!)$
+ $(9!)(15!)$
+ $2(9!)(15!)$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m03.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m03.xml
new file mode 100644
index 00000000..55f1294c
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m03.xml
@@ -0,0 +1,12 @@
+
+
+ and $y$, but do not contain $z$?
+ ]]>
+
+ $2^{33}$
+ $2^{34}$
+ $2^{35}$
+ $2^{37} - 2^{35} - 2^{36}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m04.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m04.xml
new file mode 100644
index 00000000..e6baff36
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m04.xml
@@ -0,0 +1,12 @@
+
+
+ or $y$, but do not contain $z$?
+ ]]>
+
+ $2^{36} - 2^{34}$
+ $2^{36} - 2^{35}$
+ $2^{37} - 2^{34}$
+ $2^{37} - 2^{35}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m05.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m05.xml
new file mode 100644
index 00000000..923a9dec
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m05.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $10^{12} + 10^{13} - 9^{12} - 9^{13}$
+ $12^{10} + 13^{10} - 12^{9} - 13^{9}$
+ $10^{12} + 10^{13} - 7^{12} - 7^{13}$
+ $12^{10} + 13^{10} - 12^{7} - 13^{7}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m06.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m06.xml
new file mode 100644
index 00000000..1c5d4362
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m06.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ $2^k - 1 < {n \choose 7}$
+ $2^k - 1 \geq {n \choose 7}$
+ $2^k - 1 < \left. 2^n \middle/ {n \choose n-7} \right.$
+ $2^k - 1 \geq \left. 2^n \middle/ {n \choose n-7} \right.$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m07.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m07.xml
new file mode 100644
index 00000000..fb8824fb
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m07.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ ${25 \choose 16} 7^{16}21^{9}$
+ ${16 \choose 25} 7^{9}21^{16}$
+ ${25 \choose 16} 7^{25}3^{16}$
+ none of the above
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m08.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m08.xml
new file mode 100644
index 00000000..7dd154c5
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m08.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ ${19 \choose 16}$
+ ${19 \choose 17}$
+ ${20 \choose 16}$
+ ${20 \choose 17}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m09.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m09.xml
new file mode 100644
index 00000000..cab38630
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m09.xml
@@ -0,0 +1,14 @@
+
+
+
+ POOPERSCOOPER
+
+ ]]>
+
+ $13!$
+ ${13 \choose 4}{9 \choose 2}{7 \choose 2}{5 \choose 3}$
+ ${13 \choose 4}{9 \choose 3}{6 \choose 2}{4 \choose 2}$
+ ${13 \choose 1}{12 \choose 4}{8 \choose 2}{6 \choose 1}{5 \choose 2}{3 \choose 3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m10.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m10.xml
new file mode 100644
index 00000000..664f1085
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m10.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ $f(n) = 3n^{2} - 5n + 2$
+ $f(n) = 3n^{2} + 5n + 2$
+ $f(n) = 2n^{2} - 5n + 2$
+ $f(n) = 2n^{2} + 5n + 2$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m11.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m11.xml
new file mode 100644
index 00000000..d0d16ba0
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m11.xml
@@ -0,0 +1,27 @@
+
+
+
+ $\newcommand{\Fib}{{\rm F \scriptsize IB}}$
+
+
+ Consider the following recursive algorithm $\Fib$, which takes as input an
+ integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \Fib(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ f = n$
+ $\mathbf{else}\ f = \Fib(n - 1) + \Fib(n - 2)$
+ $\mathbf{endif};$
+ $\mathbf{return}\ f$
+
+
+ When running $\Fib(7)$, how many calls are there to $\Fib(3)$?
+ ]]>
+
+ 4
+ 5
+ 6
+ 7
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m12.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m12.xml
new file mode 100644
index 00000000..e9e765d7
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m12.xml
@@ -0,0 +1,26 @@
+
+
+
+
+ Consider again the recursive algorithm $\Fib$, which takes as input an integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \Fib(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ f = n$
+ $\mathbf{else}\ f = \Fib(n - 1) + \Fib(n - 2)$
+ $\mathbf{endif};$
+ $\mathbf{return}\ f$
+
+
+ For $n \geq 3$, run algorithm $\Fib(n)$ and let $a_n$ be the number of times that $\Fib(2)$ is called.
+ Which of the following is true?
+ ]]>
+
+ For $n \geq 3$, $a_n = f_{n - 1}$
+ For $n \geq 3$, $a_n = f_n$
+ For $n \geq 3$, $a_n = f_{n + 1}$
+ For $n \geq 3$, $a_n = -1 + f_n$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m13.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m13.xml
new file mode 100644
index 00000000..c7825785
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m13.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $B_n = B_{n-1} + B_{n-2} + 2^{n-3}$
+ $B_n = B_{n-1} + B_{n-2} + 2^{n-3} - B_{n-3}$
+ $B_n = B_{n-1} + B_{n-2} + B_{n-3}$
+ $B_n = B_{n-1} + B_{n-2} + B_{n-3} + 2^{n-4}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m14.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m14.xml
new file mode 100644
index 00000000..9d2c95c2
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m14.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $1 - \left. {48 \choose 7} \middle/ {52 \choose 9} \right.$
+ $\left. \bigl\{ {4 \choose 2} + {48 \choose 7} \bigr\} \middle/ {52 \choose 9} \right.$
+ $\left. {52 \choose 9} \middle/ \bigl\{ {4 \choose 2}{48 \choose 7} \bigr\} \right.$
+ $\left. {4 \choose 2}{48 \choose 7} \middle/ {52 \choose 9} \right.$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m15.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m15.xml
new file mode 100644
index 00000000..5f617a87
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m15.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $1 - (1/2)^{25} - 25(1/2)^{25}$
+ $1 + (1/2)^{25} - 25(1/2)^{25}$
+ $\sum_{k=2}^{25} {{25}\choose{k}}(1/2)^{k}$
+ none of the above
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m16.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m16.xml
new file mode 100644
index 00000000..bcded6f7
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m16.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $1 - \frac{365^2}{364 \cdot 363}$
+ $1 - \frac{364 \cdot 363}{365^2}$
+ $1 - \left. {3 \choose 2} \middle/ 365^3 \right.$
+ $1 - \left. \bigl\{ {3\choose 2} + {3 \choose 3} \bigr\} \middle/ 365^3 \right.$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2014/w14m17.xml b/app/src/data/questions/comp2804/midterm-winter-2014/w14m17.xml
new file mode 100644
index 00000000..1dffa4b4
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2014/w14m17.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ Herbal tea
+ India Pale Ale
+ Poutine
+ None of the above, because Simon doesn't like beer
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/midterm-winter-2015.json b/app/src/data/questions/comp2804/midterm-winter-2015/midterm-winter-2015.json
new file mode 100644
index 00000000..5ff68ce3
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/midterm-winter-2015.json
@@ -0,0 +1,24 @@
+{
+ "id": "midterm-winter-2015",
+ "title": "Winter 2015 Midterm",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/midterm-winter-2015/w15m01.xml",
+ "comp2804/midterm-winter-2015/w15m02.xml",
+ "comp2804/midterm-winter-2015/w15m03.xml",
+ "comp2804/midterm-winter-2015/w15m04.xml",
+ "comp2804/midterm-winter-2015/w15m05.xml",
+ "comp2804/midterm-winter-2015/w15m06.xml",
+ "comp2804/midterm-winter-2015/w15m07.xml",
+ "comp2804/midterm-winter-2015/w15m08.xml",
+ "comp2804/midterm-winter-2015/w15m09.xml",
+ "comp2804/midterm-winter-2015/w15m10.xml",
+ "comp2804/midterm-winter-2015/w15m11.xml",
+ "comp2804/midterm-winter-2015/w15m12.xml",
+ "comp2804/midterm-winter-2015/w15m13.xml",
+ "comp2804/midterm-winter-2015/w15m14.xml",
+ "comp2804/midterm-winter-2015/w15m15.xml",
+ "comp2804/midterm-winter-2015/w15m16.xml",
+ "comp2804/midterm-winter-2015/w15m17.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m01.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m01.xml
new file mode 100644
index 00000000..d58688c4
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m01.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ $(n - 7) + {n \choose 7}$
+ $n + {n \choose 7}$
+ $(n - 7) \cdot {n \choose 7}$
+ $n \cdot {n \choose 7}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m02.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m02.xml
new file mode 100644
index 00000000..2852335f
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m02.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $7^{15}$
+ $15^7$
+ $15!/7!$
+ ${15 \choose 7}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m03.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m03.xml
new file mode 100644
index 00000000..f2d46aa5
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m03.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $8 \cdot 9 \cdot 10 \cdot 11 \cdot 12 \cdot 13 \cdot 14 \cdot 15$
+ $9 \cdot 10 \cdot 11 \cdot 12 \cdot 13 \cdot 14 \cdot 15$
+ $10 \cdot 11 \cdot 12 \cdot 13 \cdot 14 \cdot 15$
+ $9 \cdot 10 \cdot 11 \cdot 12 \cdot 13 \cdot 14$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m04.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m04.xml
new file mode 100644
index 00000000..1ccc17f6
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m04.xml
@@ -0,0 +1,16 @@
+
+
+ valid,
+ if no two consecutive characters are equal. Thus, $abacbac$ is valid, whereas $abaccac$ is not
+ valid.
+
+ Let $n \geq 1$ be an integer and let $V_n$ be the number of valid strings of length $n$. Which of
+ the following is true?
+ ]]>
+
+ $V_n = 3 \cdot 2^{n-1}$
+ $V_n = 3^n - (n - 1) \cdot 3$
+ $V_n = 3^n - (n - 1) \cdot 3 \cdot 3^{n-2}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m05.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m05.xml
new file mode 100644
index 00000000..b8b653d1
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m05.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $3^{96} + 3^{96}$
+ $3^{99} - 2 \cdot 3^{96}$
+ $2 \cdot 3^{96} - 3^{93}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m06.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m06.xml
new file mode 100644
index 00000000..89d25dea
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m06.xml
@@ -0,0 +1,19 @@
+
+
+
+ $\newcommand{\Silly}{{\rm S \scriptsize ILLY}}$
+
+
+ What does
+ $$
+ \sum_{k=2}^{n-1} (k-1)(n-k)
+ $$
+ count?
+ ]]>
+
+ The number of 3-element subsets of an $(n-1)$-element set.
+ The number of 3-element subsets of an $n$-element set.
+ The number of 3-element subsets of an $(n+1)$-element set.
+ The number of times you fart when running algorithm $\Silly(n)$.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m07.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m07.xml
new file mode 100644
index 00000000..7e66d076
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m07.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $365^2$
+ $365^2 + 1$
+ $2 \cdot 365$
+ $2 \cdot 365 + 1$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m08.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m08.xml
new file mode 100644
index 00000000..61e5b18f
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m08.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ $2^{16} \cdot 17^{82} \cdot {99 \choose 16}$
+ $2^{17} \cdot 17^{82} \cdot {99 \choose 17}$
+ $2^{82} \cdot 17^{17} \cdot {99 \choose 17}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m09.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m09.xml
new file mode 100644
index 00000000..88dbcd57
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m09.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ ${101 \choose 2}$
+ ${101 \choose 3}$
+ ${102 \choose 2}$
+ ${102 \choose 3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m10.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m10.xml
new file mode 100644
index 00000000..ffaec5bf
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m10.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ $f(n) = 3n^{2} + 2n + 15$
+ $f(n) = 3n^{2} - 2n + 15$
+ $f(n) = 3n^{2} + n + 15$
+ $f(n) = 3n^{2} - n + 15$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m11.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m11.xml
new file mode 100644
index 00000000..42479d5f
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m11.xml
@@ -0,0 +1,13 @@
+
+
+ valid,
+ if it does not contain the substring $aaa$. Let $S_n$ be the number of valid strings of length
+ $n$. Which of the following is true?
+ ]]>
+
+ $S_n = 2 \cdot S_{n-1} + 2 \cdot S_{n-2}$
+ $S_n = 2 \cdot S_{n-1} + 2 \cdot S_{n-2} + S_{n-3}$
+ $S_n = 2 \cdot S_{n-1} + S_{n-2} + 2 \cdot S_{n-3}$
+ $S_n = 2 \cdot S_{n-1} + 2 \cdot S_{n-2} + 2 \cdot S_{n-3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m12.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m12.xml
new file mode 100644
index 00000000..026bac49
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m12.xml
@@ -0,0 +1,30 @@
+
+
+
+
+ the order in which the 1s and 2s occur in the sum matters, and
+
+
+ it is not allowed to have two consecutive 1s.
+
+
+ For example, if $n = 7$, then
+ $$
+ 7 = 1 + 2 + 1 + 2 + 1
+ $$ is allowed, whereas
+ $$
+ 7 = 1 + 2 + 1 + 1 + 2
+ $$
+ is not allowed.
+
+ Which of the following is true?
+ ]]>
+
+ $S_n = S_{n-1} + S_{n-2}$
+ $S_n = S_{n-1} + S_{n-3}$
+ $S_n = S_{n-2} + S_{n-3}$
+ $S_n = S_{n-1} + S_{n-2} + S_{n-3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m13.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m13.xml
new file mode 100644
index 00000000..bb0c3c29
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m13.xml
@@ -0,0 +1,27 @@
+
+
+
+ $\newcommand{\Fib}{{\rm F \scriptsize IB}}$
+
+
+ Consider the following recursive algorithm $\Fib$, which takes as input an
+ integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \Fib(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ f = n$
+ $\mathbf{else}\ f = \Fib(n - 1) + \Fib(n - 2)$
+ $\mathbf{endif};$
+ $\mathbf{return}\ f$
+
+
+ When running $\Fib(99)$, how many calls are there to $\Fib(95)$?
+ ]]>
+
+ 4
+ 5
+ 6
+ 7
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m14.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m14.xml
new file mode 100644
index 00000000..2719e04e
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m14.xml
@@ -0,0 +1,31 @@
+
+
+
+ $\newcommand{\NationalAnthem}{{\rm N {\scriptsize ATIONAL} A {\scriptsize NTHEM}}}
+ \newcommand{\elsesp}{\phantom{\mathbf{else}\ }}$
+
+
+ Consider the following recursive algorithm $\NationalAnthem$, which takes as input an integer $n \geq 1$,
+ which is a power of 2:
+
+
+ $\mathbf{Algorithm}\ \NationalAnthem(n)\mathrm{:}$
+ $\mathbf{if}\ n = 1$
+ $\mathbf{then}\ \mathrm{sing}\ {\it O\ Canada}\ \mathrm{once}$
+ $\mathbf{else}\ \NationalAnthem(n / 2);$
+ $\elsesp \mathrm{sing}\ {\it O\ Canada}\ \mathrm{once};$
+ $\elsesp \NationalAnthem(n / 2)$
+ $\mathbf{endif}$
+
+
+ For $n$ a power of 2, let $S(n)$ be the number of times you sing O Canada when running algorithm
+ $\NationalAnthem(n)$. Which of the following is true?
+ (n.b., $\log$ denotes the base-2 logarithm)
+ ]]>
+
+ $S(n) = 1 + \log n$
+ $S(n) = 1 + n \log n$
+ $S(n) = 2n + 1$
+ $S(n) = 2n - 1$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m15.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m15.xml
new file mode 100644
index 00000000..4e1c1e67
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m15.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ 3/8
+ 4/8
+ 5/8
+ 6/8
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m16.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m16.xml
new file mode 100644
index 00000000..9f9f1285
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m16.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ $\Pr(A) = \Pr(B)$
+ $\Pr(A) < \Pr(B)$
+ $\Pr(A) > \Pr(B)$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2015/w15m17.xml b/app/src/data/questions/comp2804/midterm-winter-2015/w15m17.xml
new file mode 100644
index 00000000..8d5fd101
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2015/w15m17.xml
@@ -0,0 +1,25 @@
+
+
+
+
+ There are 7 beers of the pilsner type.
+
+
+ There are 5 beers of the India pale ale type.
+
+
+ There are 4 beers of the German wheatbeer type.
+
+
+ You order 4 different beers with at least one beer of each type. What is the number of ways in which
+ you can do this? (The order in which you order the beers does not matter.)
+ ]]>
+
+ ${16 \choose 4}$
+ ${7 \choose 2} \cdot 5 \cdot 4 + 7 \cdot {5 \choose 2} \cdot 4 + 7 \cdot 5 \cdot {4 \choose 2}$
+ ${16 \choose 4} - {7 \choose 3} - {5 \choose 3} - {4 \choose 3}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/midterm-winter-2017.json b/app/src/data/questions/comp2804/midterm-winter-2017/midterm-winter-2017.json
new file mode 100644
index 00000000..fb9549bb
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/midterm-winter-2017.json
@@ -0,0 +1,24 @@
+{
+ "id": "midterm-winter-2017",
+ "title": "Winter 2017 Midterm",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/midterm-winter-2017/w17m01.xml",
+ "comp2804/midterm-winter-2017/w17m02.xml",
+ "comp2804/midterm-winter-2017/w17m03.xml",
+ "comp2804/midterm-winter-2017/w17m04.xml",
+ "comp2804/midterm-winter-2017/w17m05.xml",
+ "comp2804/midterm-winter-2017/w17m06.xml",
+ "comp2804/midterm-winter-2017/w17m07.xml",
+ "comp2804/midterm-winter-2017/w17m08.xml",
+ "comp2804/midterm-winter-2017/w17m09.xml",
+ "comp2804/midterm-winter-2017/w17m10.xml",
+ "comp2804/midterm-winter-2017/w17m11.xml",
+ "comp2804/midterm-winter-2017/w17m12.xml",
+ "comp2804/midterm-winter-2017/w17m13.xml",
+ "comp2804/midterm-winter-2017/w17m14.xml",
+ "comp2804/midterm-winter-2017/w17m15.xml",
+ "comp2804/midterm-winter-2017/w17m16.xml",
+ "comp2804/midterm-winter-2017/w17m17.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m01.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m01.xml
new file mode 100644
index 00000000..b3fb363e
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m01.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ $f \cdot {f+m-1 \choose 7}$
+ $f + {f+m-1 \choose 5} + {f+m-6 \choose 2}$
+ $f \cdot {f+m-1 \choose 5} \cdot {f+m-6 \choose 2}$
+ $f \cdot {f+m \choose 5} \cdot {f+m \choose 2}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m02.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m02.xml
new file mode 100644
index 00000000..9aafaf45
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m02.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $(b + g)!$
+ $g \cdot (b + g - 1)!$
+ $(b + g)! / b$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m03.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m03.xml
new file mode 100644
index 00000000..2b6f2a1b
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m03.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $(b+g)!$
+ $(b+g)! - b \cdot (b+g-1)! -\ $ $ g \cdot (b+g-1)!$
+ $g \cdot (b+g-1)! + b \cdot (b+g-1)!\ -$ $ b \cdot g \cdot (b+g-1)!$
+ $g \cdot (b+g-1)! + b \cdot (b+g-1)!\ -$ $ b \cdot g \cdot (b+g-2)!$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m04.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m04.xml
new file mode 100644
index 00000000..53ea2ebe
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m04.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ ${n \choose 12} \cdot {12 \choose 7}$
+ ${n \choose 7} + {n \choose 5}$
+ ${n \choose 7} + {n \choose 5} - {n \choose 5} \cdot {n - 5 \choose 7}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m05.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m05.xml
new file mode 100644
index 00000000..12e49b2d
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m05.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ 79
+ 80
+ 81
+ 82
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m06.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m06.xml
new file mode 100644
index 00000000..a6cf4752
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m06.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $4^{n}$
+ $4^{n-1}$
+ $4^{n-2}$
+ $4^{n-3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m07.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m07.xml
new file mode 100644
index 00000000..067b46bf
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m07.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ The number of ways to choose an ordered pair $(x,y)$ from a group consisting of $m$ men and $n$ women, where $x$ must be a man and $y$ must be a woman.
+ The number of ways to choose an ordered pair $(x,y)$ from a group consisting of $m$ men and $n$ women, where $x$ and $y$ cannot both be men.
+ The number of ways to choose an unordered pair of people from a group consisting of $m$ men and $n$ women, where at least one man must be chosen.
+ The number of ways to choose an unordered pair of people from a group consisting of $m$ men and $n$ women.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m08.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m08.xml
new file mode 100644
index 00000000..60dff348
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m08.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ What is the minimum number of students such that we can guarantee that at least two of them have the
+ same student number?
+ ]]>
+
+ $1 + 10^{5}$
+ $1 + 5^{10}$
+ $1 + \frac{10!}{5!}$
+ $1 + \frac{5!}{10!}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m09.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m09.xml
new file mode 100644
index 00000000..24a4d334
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m09.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ ${100 \choose 80} \cdot 7^{20} \cdot 13^{80}$
+ $- {100 \choose 80} \cdot 7^{20} \cdot 13^{80}$
+ ${100 \choose 20} \cdot 7^{80} \cdot 13^{20}$
+ $- {100 \choose 20} \cdot 7^{80} \cdot 13^{20}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m10.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m10.xml
new file mode 100644
index 00000000..4e416946
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m10.xml
@@ -0,0 +1,14 @@
+
+
+
+ POOPERSCOOPER
+
+ ]]>
+
+ $13!$
+ ${13 \choose 4}{13 \choose 3}{13 \choose 2}{13 \choose 2}{13 \choose 1}$
+ ${13 \choose 4}{9 \choose 3}{6 \choose 2}{4 \choose 2}$
+ ${13 \choose 4}{9 \choose 3}{6 \choose 2}{4 \choose 2}{2 \choose 1}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m11.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m11.xml
new file mode 100644
index 00000000..e7f8dfd4
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m11.xml
@@ -0,0 +1,17 @@
+
+
+ free if it does not contain two 0's next to each other.
+ In class, we have seen that for any $m \geq 1$,
+ the number of 00-free bitstrings of length $m$ is equal to the $(m+2)$-th Fibonacci number $f_{m+2}$.
+
+ Let $n \geq 3$ be an integer. What is the number of 00-free bitstrings of length $3n-1$ that have 0 at position $n$
+ and 1 at position $2n$? (The positions are numbered $1,2,\dots,3n-1)$.
+ (n.b., $f^2_x = f_x \cdot f_x$)
+ ]]>
+
+ ${f^2_{n+1}} \cdot f_n$
+ ${f^2_{n}} \cdot f_{n+1}$
+ ${f^2_{n+2}} \cdot f_{n+1}$
+ ${f^2_{n+1}} \cdot f_{n+2}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m12.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m12.xml
new file mode 100644
index 00000000..571c114d
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m12.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ $f(n) = \frac{2^{n}}{(n-1)^{2}}$
+ $f(n) = \frac{2^{n-1}}{n^{2}}$
+ $f(n) = \frac{2^{n}}{n^{2}}$
+ $f(n) = \frac{n^{2}}{2^{n}}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m13.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m13.xml
new file mode 100644
index 00000000..5062d61e
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m13.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $B_n = n$
+ $B_n = n+1$
+ $B_n = f_{n+1}$, the $(n+1)$-st Fibonacci number.
+ $B_n = f_{n+2}$, the $(n+2)$-nd Fibonacci number.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m14.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m14.xml
new file mode 100644
index 00000000..e5b634f5
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m14.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+ $11$ |
+
+ $= 3 + 4 + 4 = 4 + 3 + 4$
+ $= 4 + 4 + 3.$
+ |
+
+
+
+
+ Which of the following is true for any $n \geq 5$?
+ ]]>
+
+ $S_n = 2 \cdot S_{n - 1}$
+ $S_n = S_{n - 1} + S_{n - 2}$
+ $S_n = S_{n - 2} + S_{n - 3}$
+ $S_n = S_{n - 3} + S_{n - 4}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m15.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m15.xml
new file mode 100644
index 00000000..0c05a838
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m15.xml
@@ -0,0 +1,30 @@
+
+
+
+ $\newcommand{\Hello}{{\rm H {\scriptsize ELLO}}}
+ \newcommand{\elsesp}{\phantom{\mathbf{else}\ }}$
+
+
+ Consider the recursive algorithm $\Hello$, which takes as input an integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \Hello(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ \text{print ``hello''}$
+ $\mathbf{else}\ \mathbf{if}\ n\ \mathrm{is}\ \mathrm{even}$
+ $\elsesp \mathbf{then}\ \Hello(n / 2)$
+ $\elsesp \mathbf{else}\ \Hello(n - 1);$
+ $\elsesp \elsesp \Hello(n - 2)$
+ $\elsesp \mathbf{endif};$
+ $\mathbf{endif}$
+
+
+ If we run algorithm $\Hello(7)$, how many times is the word "hello" printed?
+ ]]>
+
+ 4
+ 5
+ 6
+ 7
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m16.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m16.xml
new file mode 100644
index 00000000..0c5b237c
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m16.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ 1/2
+ 1/4
+ 1/6
+ 1/8
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2017/w17m17.xml b/app/src/data/questions/comp2804/midterm-winter-2017/w17m17.xml
new file mode 100644
index 00000000..b64a296a
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2017/w17m17.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ $\left. n^2 \middle/ {2n \choose 2} \right.$
+ $\left. {2n \choose 2} \middle/ n^2 \right.$
+ $\left. n^2 \middle/ {n \choose 2} \right.$
+ $\left. {n \choose 2} \middle/ n^2 \right.$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/midterm-winter-2018.json b/app/src/data/questions/comp2804/midterm-winter-2018/midterm-winter-2018.json
new file mode 100644
index 00000000..017b4060
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/midterm-winter-2018.json
@@ -0,0 +1,23 @@
+{
+ "id": "midterm-winter-2018",
+ "title": "Winter 2018 Midterm",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/midterm-winter-2018/w18m01.xml",
+ "comp2804/midterm-winter-2018/w18m02.xml",
+ "comp2804/midterm-winter-2018/w18m03.xml",
+ "comp2804/midterm-winter-2018/w18m04.xml",
+ "comp2804/midterm-winter-2018/w18m05.xml",
+ "comp2804/midterm-winter-2018/w18m06.xml",
+ "comp2804/midterm-winter-2018/w18m07.xml",
+ "comp2804/midterm-winter-2018/w18m08.xml",
+ "comp2804/midterm-winter-2018/w18m09.xml",
+ "comp2804/midterm-winter-2018/w18m10.xml",
+ "comp2804/midterm-winter-2018/w18m11.xml",
+ "comp2804/midterm-winter-2018/w18m12.xml",
+ "comp2804/midterm-winter-2018/w18m13.xml",
+ "comp2804/midterm-winter-2018/w18m14.xml",
+ "comp2804/midterm-winter-2018/w18m15.xml",
+ "comp2804/midterm-winter-2018/w18m16.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m01.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m01.xml
new file mode 100644
index 00000000..105ebdfb
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m01.xml
@@ -0,0 +1,22 @@
+
+
+
+
+ How many such strings have the property that
+
+ -
+ each even position contains an element of $\{a,b,c\}$, and
+
+ -
+ each odd position contains an element of $\{d,e\}$?
+
+
+ ]]>
+
+ $6^6$
+ $5^{12}$
+ $6^3 \cdot 6^2$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m02.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m02.xml
new file mode 100644
index 00000000..57519780
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m02.xml
@@ -0,0 +1,22 @@
+
+
+
+
+ How many such strings have the property that
+
+ -
+ each even position contains an element of $\{a, b, c\}$, or
+
+ -
+ each odd position contains an element of $\{d,e\}$?
+
+
+ ]]>
+
+ $6^{3} \cdot 6^{5} + 6^{2} \cdot 6^{5}$
+ $3^{6} \cdot 5^{6} + 2^{6} \cdot 5^{6}$
+ $3^{6} \cdot 5^{6} + 2^{5} \cdot 5^{6} - 2^{6} \cdot 3^{6}$
+ $6^{3} \cdot 6^{5} + 6^{2} \cdot 6^{5} - 6^{2} \cdot 6^{3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m03.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m03.xml
new file mode 100644
index 00000000..ed926745
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m03.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ How many such strings contain at least two $a$'s?
+ ]]>
+
+ $5^{12} - 4^{12} - 12 \cdot 4^{11}$
+ $5^{12} - 4^{12} - 12 \cdot 4^{12}$
+ $12^{5} - 12^{4} - 12 \cdot 11^{4}$
+ $12^{5} - 12^{4} - 12 \cdot 12^{4}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m04.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m04.xml
new file mode 100644
index 00000000..6a0977ea
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m04.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ In how many ways can Elisa place these orders, such that exactly 4 people get a beer?
+ ]]>
+
+ ${6 \choose 4} \cdot b^{4} \cdot c^{2}$
+ ${6 \choose 4} \cdot b^{4} \cdot c^{3}$
+ ${7 \choose 4} \cdot b^{4} \cdot c^{3}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m05.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m05.xml
new file mode 100644
index 00000000..e833c9ab
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m05.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ 60 do not like Donald Trump and do not like Kim Jong Un, and
+
+
+ 25 like Kim Jong Un.
+
+
+ How many people in this group like Donald Trump and do not like Kim Jong Un?
+ ]]>
+
+ 10
+ 15
+ 20
+ 25
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m06.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m06.xml
new file mode 100644
index 00000000..398cbda7
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m06.xml
@@ -0,0 +1,16 @@
+
+
+ ShortLastName, every person has a last name consisting of one uppercase letter,
+ followed by two lowercase letters. No two letters in a last name can be equal. Thus, Lin
+ is a valid last name, whereas Xax is not a valid last name.
+
+ What is the minimum size of the population of ShortLastName, such that there must be at least two people
+ who have the same last name?
+ ]]>
+
+ $1 + 26!$
+ $1 + 26^{3}$
+ $1 + \frac{24 \cdot 25 \cdot 26}{3!}$
+ $1 + 24 \cdot 25 \cdot 26$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m07.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m07.xml
new file mode 100644
index 00000000..d7ff1fc8
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m07.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ The number of bitstrings of length $n$.
+ The number of bitstrings of length $\left. (n-2) \middle/ 2 \right.$.
+ The number of bitstrings of length $n$ having an odd number of 0's.
+
+ The number of bitstrings of length $n$ in which the number of 0's plus the number of 1's is at most $\left. (n-1) \middle/ 2 \right.$.
+
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m08.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m08.xml
new file mode 100644
index 00000000..0a53bf73
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m08.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ Consider subsets $X$ of $A \cup B$, such that $|X| = k, |X \cap A| = 17$, and all elements of $X \cap A$ are even.
+
+ How many such subsets $X$ are there?
+ ]]>
+
+ ${m/2 \choose 17} \cdot {n \choose k-17}$
+ ${m \choose 17} \cdot {n \choose k-17}$
+ ${m+n \choose 17} \cdot {n \choose k-17}$
+ ${m/2+n \choose 17} \cdot {n \choose k-17}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m09.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m09.xml
new file mode 100644
index 00000000..85d89aea
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m09.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ ${36 \choose 4}$
+ ${36 \choose 3}$
+ ${37 \choose 4}$
+ ${37 \choose 3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m10.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m10.xml
new file mode 100644
index 00000000..31dce6eb
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m10.xml
@@ -0,0 +1,21 @@
+
+
+
+
+ Since having finished marking assignment 2, Nick has been working hard to improve his Spiderman-skills:
+ In one step, Nick can move up either two floors or three floors. (Nick lost his ability to move up one floor in one step.)
+
+ Let $n \geq 2$ be an integer and consider a building with $n$ floors, numbered $1,2,\dots,n$. (The first floor has number 1;
+ this is not the ground floor.) Nick is standing in front of this building, at the ground level.
+
+ Let $N_n$ be the number of different ways in which Nick can climb to the $n$-th floor.
+ Which of the following is true for any $n \geq 5$?
+ ]]>
+
+ $N_n = N_{n-1} + N_{n-2} + N_{n-3}$
+ $N_n = N_{n-1} + N_{n-2}$
+ $N_n = N_{n-1} + N_{n-3}$
+ $N_n = N_{n-2} + N_{n-3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m11.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m11.xml
new file mode 100644
index 00000000..4518855a
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m11.xml
@@ -0,0 +1,16 @@
+
+
+ free, if it does not contain two 0's next to each other.
+ In class, we have seen that for any $m \geq 1$,
+ the number of 00-free bitstrings of length $m$ is equal to the $(m+2)$-th Fibonacci number $f_{m+2}$.
+
+ What is the number of 00-free bitstrings of length 55 that have 0 at position 9, and 1 at position 40?
+ (The positions are numbered $1,2,\dots,55$.)
+ ]]>
+
+ $f_7 \cdot f_{29} \cdot f_{15}$
+ $f_8 \cdot f_{30} \cdot f_{16}$
+ $f_9 \cdot f_{31} \cdot f_{17}$
+ $f_{10} \cdot f_{32} \cdot f_{18}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m12.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m12.xml
new file mode 100644
index 00000000..6d9d760e
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m12.xml
@@ -0,0 +1,21 @@
+
+
+
+
+ $7^{2n}$
+ $7^{n}$
+ $(2n)^{7}$
+ $n^{7}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m13.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m13.xml
new file mode 100644
index 00000000..d15ec03a
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m13.xml
@@ -0,0 +1,15 @@
+
+
+ ccc-free, if it does not contain ccc.
+
+ For any integer $n \geq 4$, let $B_n$ be the number of ccc-free bitstrings of length $n$.
+ Which of the following is true?
+ ]]>
+
+ $B_n = B_{n-1} + B_{n-2} + B_{n-3}$
+ $B_n = 2 \cdot B_{n-1} + 2 \cdot B_{n-2} + 2 \cdot B_{n-3}$
+ $B_n = 2 \cdot B_{n-1} + 2 \cdot B_{n-2} + B_{n-3}$
+ $B_n = B_{n-1} + B_{n-2} + 2 \cdot B_{n-3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m14.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m14.xml
new file mode 100644
index 00000000..9eb38703
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m14.xml
@@ -0,0 +1,30 @@
+
+
+
+ $\newcommand{\IFeelLikeSinging}{{\rm IF {\scriptsize EEL} L {\scriptsize IKE} S {\scriptsize INGING}}}
+ \newcommand{\elsesp}{\phantom{\mathbf{else}\ }}$
+
+
+ Consider the recursive algorithm $\IFeelLikeSinging$, which takes as input an integer $n \geq 0$:
+
+
+ $\mathbf{Algorithm}\ \IFeelLikeSinging(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ \mathrm{sing}\ {\it O\ Canada}$
+ $\mathbf{else}\ \mathbf{if}\ n\ \text{is odd}$
+ $\elsesp \mathbf{then}\ \IFeelLikeSinging(n + 1)$
+ $\elsesp \mathbf{else}\ \IFeelLikeSinging(\frac{n}{2});$
+ $\elsesp \elsesp \IFeelLikeSinging(\frac{n}{2} - 1)$
+ $\elsesp \mathbf{endif};$
+ $\mathbf{endif}$
+
+
+ If you run algorithm $\IFeelLikeSinging(9)$, how many times do you sing O Canada?
+ ]]>
+
+ 6
+ 7
+ 8
+ 9
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m15.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m15.xml
new file mode 100644
index 00000000..36fbd3c7
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m15.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ ${12 \choose 2} \cdot \left. 5^{10} \middle/ 6^{12} \right.$
+ $12^{2} \cdot \left. 5^{10} \middle/ 6^{12} \right.$
+ ${12 \choose 2} \cdot \left. 5^{12} \middle/ 6^{12} \right.$
+ $12^{2} \cdot \left. 5^{12} \middle/ 6^{12} \right.$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2018/w18m16.xml b/app/src/data/questions/comp2804/midterm-winter-2018/w18m16.xml
new file mode 100644
index 00000000..e896e1a4
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2018/w18m16.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ Nick buys 25 bananas at Alexa's Banana Emporium (ABE) and 30 bananas at Shelly's Fruit Market (SFM).
+ Nick chooses, uniformly at random, a 15-element subset of these bananas. Define the event
+ [defs]
+ A = "the subset chosen by Nick contains exactly 7 bananas from ABE".
+ [/defs]
+ What is $\Pr(A)$?
+ ]]>
+
+ $\frac{{25 \choose 8} + {30 \choose 7}}{55 \choose 15}$
+ $\frac{{25 \choose 8} \cdot {30 \choose 7}}{55 \choose 15}$
+ $\frac{{25 \choose 7} + {30 \choose 8}}{55 \choose 15}$
+ $\frac{{25 \choose 7} \cdot {30 \choose 8}}{55 \choose 15}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/midterm-winter-2019.json b/app/src/data/questions/comp2804/midterm-winter-2019/midterm-winter-2019.json
new file mode 100644
index 00000000..02db5f3a
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/midterm-winter-2019.json
@@ -0,0 +1,24 @@
+{
+ "id": "midterm-winter-2019",
+ "title": "Winter 2019 Midterm",
+ "Author": "Michiel Smid",
+ "questions": [
+ "comp2804/midterm-winter-2019/w19m01.xml",
+ "comp2804/midterm-winter-2019/w19m02.xml",
+ "comp2804/midterm-winter-2019/w19m03.xml",
+ "comp2804/midterm-winter-2019/w19m04.xml",
+ "comp2804/midterm-winter-2019/w19m05.xml",
+ "comp2804/midterm-winter-2019/w19m06.xml",
+ "comp2804/midterm-winter-2019/w19m07.xml",
+ "comp2804/midterm-winter-2019/w19m08.xml",
+ "comp2804/midterm-winter-2019/w19m09.xml",
+ "comp2804/midterm-winter-2019/w19m10.xml",
+ "comp2804/midterm-winter-2019/w19m11.xml",
+ "comp2804/midterm-winter-2019/w19m12.xml",
+ "comp2804/midterm-winter-2019/w19m13.xml",
+ "comp2804/midterm-winter-2019/w19m14.xml",
+ "comp2804/midterm-winter-2019/w19m15.xml",
+ "comp2804/midterm-winter-2019/w19m16.xml",
+ "comp2804/midterm-winter-2019/w19m17.xml"
+ ]
+}
\ No newline at end of file
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m01.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m01.xml
new file mode 100644
index 00000000..6f301d16
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m01.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ 32
+ 64
+ 128
+ 256
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m02.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m02.xml
new file mode 100644
index 00000000..e9957c2c
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m02.xml
@@ -0,0 +1,12 @@
+
+
+
+ How many such permutations are there?
+ ]]>
+
+ $7! - 6!$
+ $7! - 5!$
+ $7! - 4!$
+ $7! - 3!$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m03.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m03.xml
new file mode 100644
index 00000000..304b400f
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m03.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ $52^{15} - 26^{15}$
+ $52^{15} - 2 \cdot 26^{15}$
+ $52^{15} - 3 \cdot 26^{15}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m04.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m04.xml
new file mode 100644
index 00000000..a6de04dd
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m04.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ ${n \choose k} - {n/2 \choose k - 1} - \frac{n}{2} \cdot {n/2 \choose k}$
+ ${n \choose k} - {n/2 \choose k - 1} - \frac{n}{2} \cdot {n/2 \choose k - 1}$
+ ${n \choose k} - {n/2 \choose k} - \frac{n}{2} \cdot {n/2 \choose k}$
+ ${n \choose k} - {n/2 \choose k} - \frac{n}{2} \cdot {n/2 \choose k - 1}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m05.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m05.xml
new file mode 100644
index 00000000..9a6891b9
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m05.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ 37 students like beer,
+
+
+ 18 students like cider,
+
+
+ 55 students do not like beer and do not like cider.
+
+
+ How many students like beer and cider?
+ ]]>
+
+ 8
+ 9
+ 10
+ 11
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m06.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m06.xml
new file mode 100644
index 00000000..fb8d956e
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m06.xml
@@ -0,0 +1,13 @@
+
+
+
+ What is the minimum value for $n$, such that there must be at least four students who receive the same grade?
+ ]]>
+
+ 14
+ 15
+ 16
+ 17
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m07.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m07.xml
new file mode 100644
index 00000000..05bfcbc7
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m07.xml
@@ -0,0 +1,12 @@
+
+
+
+ How many such subsets have the property that the largest element in the subset is equal to 30?
+ ]]>
+
+ ${{29}\choose{16}}$
+ ${29 \choose 17}$
+ ${30 \choose 16}$
+ ${30 \choose 17}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m08.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m08.xml
new file mode 100644
index 00000000..5adedbec
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m08.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+ (beer bottle, cider bottle, wine bottle)
+
+ in a set consisting of $n$ beer bottles, $n$ cider bottles, and $n$ wine bottles.
+ ]]>
+
+
+ The number of ways to choose a 3-element subset of a set consisting of $n$ beer bottles, $n$ cider bottles, and $n$ wine bottles.
+
+
+ The number of ways to choose 3 elements (with repetitions allowed) in a set consisting of $n$ beer bottles, $n$ cider bottles, and $n$ wine bottles.
+
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m09.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m09.xml
new file mode 100644
index 00000000..fd8b472e
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m09.xml
@@ -0,0 +1,24 @@
+
+
+
+
+ each character is an element of $\{a, b, c\}$,
+
+
+ the number of $a$'s is equal to $k$, and
+
+
+ each $a$ is at an even position.
+
+
+ How many such strings are there?
+ ]]>
+
+ ${n/2 \choose k} \cdot 2^{n-k}$
+ ${n/2 \choose k} \cdot 2^{n/2}$
+ ${n \choose k} \cdot 2^{n-k}$
+ ${n \choose k} \cdot 2^{n/2}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m10.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m10.xml
new file mode 100644
index 00000000..7a5ea8e1
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m10.xml
@@ -0,0 +1,15 @@
+
+
+ free, if it does not contain two 0's next to each other.
+ In class, we have seen that for any $m \geq 1$,
+ the number of 00-free bitstrings of length $m$ is equal to the $(m+2)$-th Fibonacci number
+ $f_{m+2}$.
+ What is the number of 00-free bitstrings of length 77 that have 0 at position 59? (The positions are numbered $1,2,\dots,77$.)
+ ]]>
+
+ $f_{17} \cdot f_{57}$
+ $f_{18} \cdot f_{58}$
+ $f_{19} \cdot f_{59}$
+ $f_{20} \cdot f_{60}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m11.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m11.xml
new file mode 100644
index 00000000..8d0161f7
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m11.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ $f(n) = 6 \cdot 4^{n} - 2^{n}$
+ $f(n) = 7 \cdot 4^{n} - 2^{n}$
+ $f(n) = 8 \cdot 4^{n} - 2^{n+1}$
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m12.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m12.xml
new file mode 100644
index 00000000..e9c68100
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m12.xml
@@ -0,0 +1,14 @@
+
+
+ awesome, if it does not contain $aa$, and does not contain $aba$, and does not contain $abb$.
+ For any integer $n \geq 1$, let $A_n$ be the number of awesome strings of length $n$.
+ Which of the following is true for any integer $n \geq 4$?
+ ]]>
+
+ $A_n = A_{n-1} + 2 \cdot A_{n-2} + 2 \cdot A_{n-3}$
+ $A_n = A_{n-1} + 2 \cdot A_{n-2} + A_{n-3}$
+ $A_n = 2 \cdot A_{n-1} + A_{n-2} + 2 \cdot A_{n-3}$
+ $A_n = 2 \cdot A_{n-1} + A_{n-2} + A_{n-3}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m13.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m13.xml
new file mode 100644
index 00000000..c19e2fbc
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m13.xml
@@ -0,0 +1,23 @@
+
+
+ $1 \atop 1$-column,
+ if both bits in the column are 1.
+ For any integer $n \geq 1$ and integer $k$ with $0 \leq k \leq n$, let $M(n,k)$ be the number of binary $2 \times n$ matrices
+
+ -
+ that do not contain any $1 \atop 1$-column, and
+
+ -
+ contain exactly $k$ many 1's.
+
+
+ Which of the following is true for all integers $n \geq 2$ and $k$ with $1 \leq k \leq n-1$?
+ ]]>
+
+ $M(n,k) = M(n-1,k)\ +$$\ M(n-1,k-1)$
+ $M(n,k) = M(n-1,k)\ +$$\ 2 \cdot M(n-1,k-1)$
+ $M(n,k) = M(n,k-1)\ +$$\ M(n-1,k-1)$
+ $M(n,k) = M(n,k-1)\ +$$\ 2 \cdot M(n-1,k-1)$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m14.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m14.xml
new file mode 100644
index 00000000..27f07e22
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m14.xml
@@ -0,0 +1,26 @@
+
+
+ $\newcommand{\HelloWorld}{{\rm H {\scriptsize ELLO} W {\scriptsize ORLD}}}$
+
+ Consider the recursive algorithm $\HelloWorld$, which takes as input an integer $n \geq 0$:
+
+ $\mathbf{Algorithm}\ \HelloWorld(n)\mathrm{:}$
+ $\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
+ $\mathbf{then}\ \mathrm{print}\ \mathit{Hello}\ \mathit{World}$
+ $\mathbf{else}\ \mathbf{if}\ n \text{ is a multiple of } 3$
+ $\qquad \mathbf{then}\ \HelloWorld\left( n \middle/ 3 \right);$
+ $\qquad \qquad \ \ \mathrm{print}\ \mathit{Hello}\ \mathit{World};$
+ $\qquad \qquad \ \ \HelloWorld\left( 2n \middle/ 3 \right)$
+ $\qquad \mathbf{else}\ \HelloWorld(n + 1)$
+ $\qquad \mathbf{endif};$
+ $\mathbf{endif}$
+
+ Which of the following is correct?
+ ]]>
+
+ For any integer $n \geq 0$, algorithm $\HelloWorld(n)$ terminates.
+ There exists an integer $n \geq 0$, for which algorithm $\HelloWorld(n)$ does not terminate.
+ All of the above.
+ None of the above.
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m15.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m15.xml
new file mode 100644
index 00000000..102fa33e
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m15.xml
@@ -0,0 +1,30 @@
+
+
+
+
+ Porterhouse Brewing Co. Oyster Stout,
+
+
+ Guinness Extra Stout,
+
+
+ Magners Original Irish Cider.
+
+
+ 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 $A$ be the event
+ [defs]
+ A = "exactly 50 students get Magners Original Irish Cider".
+ [/defs]
+ What is $\Pr(A)$?
+ ]]>
+
+ $\frac{{ 75 \choose 50 } \cdot 2^{25}}{3^{75}}$
+ $\frac{3^{75}}{{75 \choose 50} \cdot 2^{25}}$
+ $\frac{75 \choose 50}{3^{75}}$
+ $\frac{{75 \choose 50} \cdot 3^{25}}{3^{75}}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m16.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m16.xml
new file mode 100644
index 00000000..7c7245cf
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m16.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ $1 - {\frac{8 \cdot 5^{7}}{6^{8}}}$
+ $1 - {\frac{6^{8}}{5^{8} + 8 \cdot 5^{7}}}$
+ $1 - {\frac{5^{8} + 8 \cdot 5^{7}}{6^{8}}}$
+ $1 - {\frac{8^{5} + 8 \cdot 7^{5}}{8^{6}}}$
+
diff --git a/app/src/data/questions/comp2804/midterm-winter-2019/w19m17.xml b/app/src/data/questions/comp2804/midterm-winter-2019/w19m17.xml
new file mode 100644
index 00000000..b284aaa0
--- /dev/null
+++ b/app/src/data/questions/comp2804/midterm-winter-2019/w19m17.xml
@@ -0,0 +1,17 @@
+
+
+
+ Let A be the event
+ [defs]
+ A = "you answer at least 16 questions correctly".
+ [/defs]
+ What is $\Pr(A)$?
+ ]]>
+
+ $\frac{4^{17}}{52}$
+ $\frac{51}{4^{17}}$
+ $\frac{49}{4^{17}}$
+ $\frac{52}{4^{17}}$
+