Q:

Polynomial function of degree $n$ with exactly $k$ roots

If $n-k$ is even, and $\geq 0$, find a polynomial function of degree $n$ with exactly $k$ roots.
I cannot understand this question. Is this not trivial?
I can take $f(x)=x^3$ as the required polynomial function on $\Bbb{R}$ having only one root $0$ and degree is $3$ so in this case $$n-k=3-1=2=\text{ even}.$$ Is this fine or the question is supposed to tell something else?

A:

That solves the problem in a particular case, namely when $n=3$ and $k=1$. It doesn't solve it in the general case.
In the general case, you can take the polynomial$$x(x-1)(x-2)\ldots\bigl(x-(k-1)\bigr)(x^2+1)^{(n-k)/2}.$$

