Answer
$$f(x)= \frac{1}{6}x^3-\cos x+2x+1$$
Work Step by Step
Given $$ f''(x) = x + \cos x,\ \ \ f(0)=1,\ \ f'(0)=2$$
Since
\begin{align*}
f'(x)&=\int f''(x)dx\\
&=\int (x+\cos x)dx\\
&=\frac{1}{2}x^2+\sin x+c
\end{align*}
Since $f'(0)=2$ , then $c=2$ and
\begin{align*}
f(x)&=\int f'(x)dx\\
&=\int (\frac{1}{2}x^2+\sin x+2)dx\\
&= \frac{1}{6}x^3-\cos x+2x+c_1
\end{align*}
Since $f'(0)=0$ , then $c_1=1$ and
$$f(x)= \frac{1}{6}x^3-\cos x+2x+1$$