A student has to attend a test containing 7 questions of in each of which he can either get $0, 1, 2, 3, 4$ or $5$ marks. In how many ways he can get a total of $10$ marks?
For example, he can get $1,5,4,0,0,0,0$ or $3,2,1,4,0,0,0$ or $0,3,1,4,0,2,0$ which are all three different ways.
My attempt:
I related this question to the case when you have $16$ spaces and $6$ identical coins and you have to distribute these coins in these spaces. The problem here is also that there can be no more than $5$ spaces between two consecutive coins. So it seems useless to relate them.
Your attempt can lead to the correct solution.
The question is how many tuples $x_1, \ldots, x_7$ of non-negative integers $\le 5$ such that $x_1 + \ldots + x_7 = 10$. Without the upper bound that $x_i \le 5$ this is, as you correctly noticed $\binom{10+7-1}{7-1} = \binom{16}{6}$. What we need to do now is calculate "bad" possibilities, i.e. tuples $x_1, \ldots, x_7$ such that $x_1 + \ldots + x_7 = 10$ but there is $i$ such that $x_i > 5$. Notice that it's not possible that for $i \neq j$ both $x_i$ and $x_j$ are greater than $5$.
All options for $i$ are symmetrical, so the number of bad tuples with $i=1$ is equal to the number of bad tuples with any other $i$. $x_1 \ge 6$, $0 \le x_2, \ldots, x_7 \le 5$ and $x_1 + \ldots + x_7 = 10$.
Notice that $\underbrace{(x_1 - 6)}_{=x_1'\ge 0} + x_2 + \ldots + x_7 = 4$. Then $x_2, \ldots, x_7 \le 5$ automatically. Thus we need to calculate the number of tuples $x_1', x_2, \ldots, x_7$ such that all $x_1'$ and $x_2, \ldots, x_7$ are non-negative integers. As we know it is $\binom{4+7-1}{7-1} = \binom{10}{6}$. Therefore the answer is $\binom{16}{6} - 7 \binom{10}{6}$.