Evaluations

Evaluation: 2017 Winter Final

Author: Michiel Smid

1 . Consider permutations $a_1,a_2,\dots,a_{10}$ of the set $\{1,2,\dots,10\}$ for which
  • $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?
(a)
$10!$
(b)
$(5!)^2$
(c)
$5^5 \cdot 5^5$
(d)
$2 \cdot (5!)^2$

2 . Let $n \geq 2$ be an integer. Consider permutations $a_1,a_2,\dots,a_n$ of the set $\{1,2,\dots,n\}$ for which $a_1 < a_2$. How many such permutations are there?
(a)
None of the above.
(b)
$n!$
(c)
$2{n \choose 2} \cdot (n-2)!$
(d)
$\frac{n!}{2}$

3 . Let $B$ be a set consisting of 45 bottles. Out of these, 17 are beer bottles, and the remaining 28 are cider bottles. Consider subsets of $B$ that contain
  • 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?
(a)
$ 2^{45} - {17 \choose 5} - {28 \choose 5} $
(b)
$ {17 \choose 5} \cdot 2^{28} + 2^{17} \cdot {28 \choose 5} - {17 \choose 5} \cdot {28 \choose 5} $
(c)
$ 2^{45} - {17 \choose 5} \cdot {28 \choose 5} $
(d)
$ {17 \choose 5} \cdot 2^{28} + 2^{17} \cdot {28 \choose 5} $

4 . A bitstring $b_1b_2 \dots b_n$ is called a palindrome if $b_1b_2 \dots b_n = b_nb_{n-1} \dots b_1$, i.e., reading the string from left to right gives the same result as reading it from right to left. Let $n \geq 3$ be an odd integer. How many palindromes of length $n$ are there?
(a)
$2^{n-1}$
(b)
$2^{n-2}$
(c)
$2^{(n+1)/2}$
(d)
$2^{(n-1)/2}$

5 . Let $n \geq 2$ be an integer. What does $2^{n} - 2^{n-2}$ count?
(a)
The number of bitstrings of length $n$ in which the first bit is equal to the last bit.
(b)
The number of bitstrings of length $n$ in which the first bit is 0 or the last bit is 1.
(c)
The number of bitstrings of length $n$ in which the first bit is not equal to the last bit.
(d)
The number of bitstrings of length $n$ in which the first bit is 0 and the last bit is 1.

6 . Consider a group of 100 students. In this group,
  • 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?
(a)
58
(b)
60
(c)
59
(d)
57

7 . In this question, we consider bitstrings of length $n$, where $n$ is an even integer, and in which the positions are numbered $1,2,\dots,n$.
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$?
(a)
$S_n = S_{n-2} + S_{n-3}$
(b)
$S_n = S_{n-1} + S_{n-3}$
(c)
$S_n = S_{n-2} + S_{n-4}$
(d)
$S_n = S_{n/2} + S_{(n/2)-3}$

8 . Consider bitstrings that contain at least one occurrence of 000. Let $S_n$ be the number of such strings having length $n$. Which of the following is true for $n \geq 4$?
(a)
$S_n = S_{n-1} + S_{n-2} + 2^{n-2}$
(b)
$S_n = S_{n-1} + S_{n-2} + S_{n-3}$
(c)
$S_n = S_{n-1} + S_{n-2} + S_{n-3} + 2^{n-4}$
(d)
$S_n = S_{n-1} + S_{n-2} + S_{n-3} + 2^{n-3}$

9 . Consider the recursive algorithm $\Hello$, which takes as input an integer $n \geq 0$: (see file for missing code) If we run algorithm $\Hello(7)$, how many times is the word "hello" printed?
(a)
10
(b)
11
(c)
12
(d)
9

10 . We choose, uniformly at random, a string consisting of 14 characters, where each character is a lowercase letter. Let $A$ be the event
  • A = "the string contains at least one vowel".
(A vowel is one of the letters $a$, $e$, $i$, $o$, and $u$.) What is $\Pr(A)$?
(a)
$5 \cdot (5/26) \cdot (21/26)^{13}$
(b)
$1 - (21/26)^{14}$
(c)
$1 - (26/21)^{14}$
(d)
$14 \cdot (5/26) \cdot (21/26)^{13}$

11 . Consider a group consisting of 7 girls and 6 boys. Elisa is one of the girls. How many ways are there to arrange these 13 people on a horizontal line such that Elisa has 2 neighbors, both of whom are girls? (The order on the line matters.)
(a)
$12 \cdot 6 \cdot 5 \cdot 10!$
(b)
$11 \cdot {6 \choose 2} \cdot 10!$
(c)
$13 \cdot 6 \cdot 5 \cdot 10!$
(d)
$11 \cdot 6 \cdot 5 \cdot 10!$

12 . Let $X = \{1,2,3,\dots,10\}$. We choose, uniformly at random, a subset $Y$ of $X$, where $Y$ has size 5. Define the events
  • A = "1 is an element of $Y$",
  • B = "7 is an element of $Y$".
What is $\Pr(A|B)$?
(a)
5/9
(b)
5/8
(c)
4/9
(d)
4/8

13 . We flip a fair coin, independently, five times. Define the events
  • A = "the coin comes up heads exactly four times",
  • B = "the fifth coin flip results in heads".
What is $\Pr(A|B)$?
(a)
2/3
(b)
2/5
(c)
1/3
(d)
1/4

14 . Let $n \geq 3$ be an integer. Consider a uniformly random permutation $a_1a_2 \dots a_n$ of the set $\{1,2,\dots,n\}$. Define the events
  • A = "$a_n = n$",
  • B = "$a_2 > a_1$".
Which of the following is true?
(a)
The events $A$ and $B$ are not independent.
(b)
The events $A$ and $B$ are independent.
(c)
None of the above.

15 . Let $n \geq 5$ be an integer. Consider a uniformly random permutation $a_1a_2 \dots a_n$ of the set $\{1,2,\dots,n\}$. Define the events
  • A = "$a_1 = 1$",
  • B = "$a_n = 5$".
What is $\Pr(A \cup B)$?
(a)
None of the above.
(b)
${\frac{2}{n}} - {\frac{1}{n^{2}}}$
(c)
${\frac{1}{n}} - {\frac{1}{n(n-1)}}$
(d)
${\frac{2}{n}} - {\frac{1}{n(n-1)}}$

16 . Let $A$ and $B$ be two events in some sample space. You are given that $$ \begin{align} \Pr(A|B) &= \Pr(B|A), \\ \Pr(A \cup B) &= 1, \\ \Pr(A \cap B) &> 0. \end{align} $$ Which of the following is true?
(a)
$\Pr(A) < 1$
(b)
$\Pr(A) > 1/2$
(c)
$\Pr(A) < 1/2$
(d)
$\Pr(A) > 0$

17 . Consider a uniformly random permutation of the set $\{1,2,\dots,50\}$. Define the event
  • A = "in the permutation, both 8 and 4 are to the left of both 1 and 2".
What is $\Pr(A)$?
(a)
1/5
(b)
1/6
(c)
2/3
(d)
1/3

18 . You roll a fair red die and a fair blue die, independently of each other. Define the random variables
  • X = "the result of the red die",
  • Y = "the result of the blue die",
  • Z = $\min(X,Y)$.
What is $\Pr(Z = 2)$?
(a)
1/3
(b)
1/6
(c)
1/4
(d)
5/18

19 . Let $n \geq 3$ be an integer and consider a group $P_1,P_2,\dots,P_n$ of $n$ people. Each of these people has a uniformly random birthday, which is independent of the birthdays of the other people. We ignore leap years; thus, the year has 365 days.
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.
(a)
${\frac{1}{365^2}} \cdot n^3$
(b)
${\frac{1}{365^3}} \cdot {n \choose 3}$
(c)
${\frac{1}{365^3}} \cdot n^3$
(d)
${\frac{1}{365^2}} \cdot {n \choose 3}$

20 . Consider a coin that comes up heads with probability 1/5 and comes up tails with probability 4/5. You flip this coin twice, independently of each other. For each heads, you win \$100. For each tails, you win \$50.
What is the expected value $\mathbb{E}(X)$ of $X$?
(a)
140
(b)
100
(c)
80
(d)
120

21 . You are given a fair red die and a fair blue die. You roll each die once, independently of each other. Let $(i,j)$ be the outcome, where $i$ is the result of the red die and $j$ is the result of the blue die. Define the random variables $$ X = |i - j| $$ and $$ Y = \max(i, j). $$ Which of the following is true?
(a)
The random variables $X$ and $Y$ are not independent.
(b)
The random variables $X$ and $Y$ are independent.
(c)
None of the above.

22 . 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)$?
(a)
$(1/4)^{m} \cdot 3/4$
(b)
$(3/4)^{m} \cdot 1/4$
(c)
$(1/4)^{m-1} \cdot 3/4$
(d)
$(3/4)^{m-1} \cdot 1/4$

23 . Is the following statement true or false?

For any two random variables $X$ and $Y$, $\mathbb{E}(X \cdot Y) = \mathbb{E}(X) \cdot \mathbb{E}(Y)$.

(a)
The statement is true.
(b)
The statement is false.
(c)
None of the above.

24 . Elisa Kazan has successfully completed her first term as President of the Carleton Computer Science Society. In order to celebrate this, Elisa decides to spend an evening in the Hyacintho Cactus Bar and Grill in downtown Ottawa. During this evening, Tan Tran is working as a server. Since Tan has been studying very hard for COMP 2804, he is a bit absent-minded: Every time a customer orders a drink, Tan serves the wrong drink with probability 1/12, independently of other orders.
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$:
  • X = the number of indices $i$ such that $D_i$ is a cider and $D_{i+1}$ is not a cider.
What is the expected value $\mathbb{E}(X)$ of $X$?
(a)
55/144
(b)
77/144
(c)
44/144
(d)
66/144

25 . How do you feel about writing an exam on Sunday afternoon?
(a)
I enjoy it!
(b)
I hate it!
(c)
Is it the afternoon? I've lost track of time.
(d)
Now, I can rest in peace.