Evaluations

Evaluation: 2014 Fall Midterm

Author: Michiel Smid

1 . Let $n \geq 2$ be an integer. How many bitstrings of length $n$ are there that contain at least two 1s?
(a)
$2^{n} - n$
(b)
$n \cdot 2^{n-1}$
(c)
${n \choose 2} \cdot 2^{n-2}$
(d)
$2^{n} - 1 - n$

2 . How many bitstrings of length 99 are there that start with 1010 or end with 1010?
(a)
$2^{99} - 2^{96}$
(b)
$2^{91}$
(c)
$2^{96} - 2^{91}$
(d)
$2^{95} + 2^{95}$

3 . Consider 17 boys and 17 girls. How many ways are there to arrange them on a line if all boys are standing next to each other and all girls are standing next to each other?
(a)
$17! + 17!$
(b)
$2(17!)^2$
(c)
$2(17! + 17!)$
(d)
$(17!)^2$

4 . Consider 12 boys, 17 girls, and 25 dogs. How many ways are there to arrange them on a line if
  • 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.
(a)
$2(12! + 17! + 25!)$
(b)
$12! + 17! + 25!$
(c)
$(12!)(17!)(25!)$
(d)
$2(12!)(17!)(25!)$

5 . Is the following true or false? In any group of 900 people, there must be at least three people that have the same birthday.
(a)
True
(b)
False

6 . Consider a square with sides of length 3. Assume this square contains 10 points. Which of the following is true?
(a)
At least two of these $n$ points are at distance at most $1$.
(b)
At least two of these $n$ points are at distance at most $\left. 1 \middle/ \sqrt{2} \right.$.
(c)
At least two of these $n$ points are at distance at most $\sqrt{2}$.
(d)
None of the above.

7 . What is the coefficient of $x^{20}y^{80}$ in the expansion of $(5x - 3y)^{100}$?
(a)
${100 \choose 80} 5^{20}3^{80}$
(b)
${80 \choose 100} 5^{20}3^{80}$
(c)
${100 \choose 80} 5^{80}3^{20}$
(d)
$-{100 \choose 80} 5^{20}3^{80}$

8 . How many solutions are there to the equation $x_1 + x_2 + x_3 + x_4 = 27$, where $x_1 \geq 0$, $x_2 \geq 0$, $x_3 \geq 0$, and $x_4 \geq 0$ are integers?
(a)
${30 \choose 4}$
(b)
${31 \choose 3}$
(c)
${31 \choose 4}$
(d)
${30 \choose 3}$

9 . Let $m \geq 1$ and $n \geq 1$ be integers. Consider a rectangle whose horizontal side has length $m$ and whose vertical side has length $n$. A path from the bottom-left corner to the top-right corner is called 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?
(a)
$2^{m + n}$
(b)
${m + n \choose n}$
(c)
$2^m + 2^n$
(d)
${m + n \choose n - 1}$

10 . The function $f : \mathbb{N} \rightarrow \mathbb{N}$ is defined by $$ \begin{align} f(0) &= 8 \\ f(n) &= f(n - 1) + 6n - 8\; \ \mathrm{for}\ n \geq 1 \end{align} $$ What is $f(n)$?
(a)
$f(n) = 2n^{2} - 5n + 7$
(b)
$f(n) = 3n^{2} - 5n + 8$
(c)
$f(n) = 4n^{2} - 5n + 8$
(d)
$f(n) = 2n^{2} - 5n + 8$

11 . Let $B_n$ be the number of bitstrings of length $n$ that do not contain 1111. Which of the following is true?
(a)
$B_n = B_{n-1} + B_{n-2} + B_{n-3} + B_{n-4}$
(b)
$B_n = 2^{n} - (n-3) \cdot 2^{n-4}$
(c)
$B_n = B_{n-1} + B_{n-2} + B_{n-3}$
(d)
$B_n = 2^{n} - 2^{n-4}$

12 . 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)$?
(a)
9
(b)
7
(c)
8
(d)
6

13 . 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)
(a)
$F(n) = 2 \log n\ \mathrm{for}\ n \geq 1.$
(b)
$F(n) = (2 \log n) - 1\ \mathrm{for}\ n \geq 2.$
(c)
$F(n) = (2 \log n) - 1\ \mathrm{for}\ n \geq 1.$
(d)
$F(n) = \log n\ \mathrm{for}\ n \geq 1.$

14 . You flip a fair coin 5 times. What is the probability that the first flip results in heads or the fifth flip results in heads?
(a)
1
(b)
3/4
(c)
1/4
(d)
1/2

15 . You flip a fair coin 5 times. Define the events
  • A = "the number of heads is odd"
and
  • B = "the number of tails is even".
Which of the following is true?
(a)
$\Pr(A) < \Pr(B)$
(b)
$\Pr(A) > \Pr(B)$
(c)
$\Pr(A) = \Pr(B)$

16 . Consider 10 boxes and 10 balls. We throw each ball, uniformly, in a random box. What is the probability that, after we have thrown all 10 balls, none of the 10 boxes is empty?
(a)
None of the above.
(b)
$\frac{10^{10}}{10!}$
(c)
$1 - \frac{10 \cdot (9/10)^{10}}{10^{10}}$
(d)
$\frac{10!}{10^{10}}$

17 . Assume you write a multiple-choice exam that consists of 100 questions. For each question, 4 options are given, one of which is the correct one. If you answer each of the 100 questions by choosing an answer uniformly at random, what is the probability that you have exactly one correct answer?
(a)
$\frac{100 + 3^{99}}{4^{100}}$
(b)
$\frac{100 \cdot 3^{99}}{4^{100}}$
(c)
$\frac{3^{99}}{4^{100}}$
(d)
$\frac{100}{4^{100}}$