As it has been noted above, the conditions imply that
\begin{equation*} \tag{$*$}
\int_1^2 (1+\cos^8 x)(ax^2+bx+c)\,dx=0.
\end{equation*}
Since $1+\cos^8 x \ge 1$ in $[1,2],$ there must be a root of the quadratic function $ax^2+bx+c$ in $(1,2).$ On the other hand, $(*)$ implies that
$$
Aa+Bb+Cc=0
$$
where $A,B,C$ are real numbers with $C \ne 0.$ Hence
$$
c=\alpha a+\beta b
$$
for some $\alpha,\beta \in \mathbf R.$ In effect, given any $a,b$ such that $a \ne 0,$ the function $ax^2+bx+c$ satisfies $(*)$ for a suitable $c.$ Now take positive $a,b,$ and define $c$ accordingly. As we now know, the corresponding function $q(x)=ax^2+bx+c$ has a root in $(1,2),$ hence its discriminant $\Delta$ is positive. But then $q(x)$ has also a negative root, namely
$$
\frac{-b-\sqrt\Delta}{2a} < 0.
$$
Thus it is impossible in general to have both roots in $(0,2),$ whence 2 is the correct answer.