How many answers to memorize for a test? Recently one of my friends asked me this deceivingly simple question:

I have a midterm with a predetermined list of 15 possible questions. Out of the 15 questions only 7 will actually appear on the test. Out of the 7 that appear on the test I will only have to answer 5. How many answers should I memorize to make sure I get 100% on the test?

I think I have convinced myself that it is pretty easy to show that he needs to memorize exactly 13 questions - 15-(7-5) - in order to guarantee he will know at least 5 of the questions on the midterm and thus get 100%.
However I am having trouble generalizing the math to answer some more interesting questions. Specifically:

How many answers should I memorize such that 75% of the time I will get 100% on the test?

Or:

How many answers should I memorize such that on average I will get at least an 80% on the test?

 A: Let $N = 15$ be the total population of questions, $n = 7$ the number that will appear on the test, and $m = 5$ the number of questions you need to answer. There are $\binom{N}{n}$ possible tests; I'll assume the test is selected uniformly at random without replacement.
Say you memorize $K$ of the questions.
Then, the number of questions on the test that you know the answer to, call it $k$, is hypergeometric, with population size $N$, "success" population size $K$, and number of draws $n$ (like the names in the Wikipedia article).

How many answers should I memorize such that 75% of the time I will get 100% on the test?

You get 100% on the test if $k \ge m$, so the probability of doing so is the complement of the CDF at $m-1$. Unfortunately, the expression for this is not pretty:
$$
{{{n \choose {m}}{{N-n} \choose {K-m}}}\over {N \choose K}} \,_3F_2\!\!\left[\begin{array}{c}1,\ m-K,\ m-n \\ m+1,\ N+m+1-K-n\end{array};1\right]
\ge .75
$$
where $_3F_2$ is the generalized hypergeometric function.
This probably needs to be solved numerically.

How many answers should I memorize such that on average I will get at least an 80% on the exam?

Your score on the exam can be written as $S := \max\left(1, \frac{k}{m}\right)$.
To get rid of the max, you can do:
$$
\begin{align*}
\mathbb{E}[S]
&= \Pr[k \le m] \, \mathbb{E}[S \mid k \le m]
   + \Pr[k > m] \, \mathbb{E}[S \mid k > m]
\\ &= \Pr[k \le m] \, \mathbb{E}[k \mid k \le m] + \Pr[k > m]
\end{align*}
$$
where the two probability terms are again gross hypergeometric cdfs,
and I don't know if there's a nice form for $\mathbb{E}[k \mid k \le m]$.
Maybe if you derive it the way you derive $\mathbb{E}[S]$ it'll mostly cancel out with $\Pr[T \le k]$ or something; not sure.
For smallish numbers like the ones given, you could compute $\mathbb{E} S$ exactly based on the hypergeometric pmf, but you'd probably have to do a binary search or something to find the exact cutoff.
A: The objective of a test is to encourage you to learn and understand the material.  If you do that you shouldn't have to memorize anything
