Answer
The length of the pendulum is $0.994~m$
We can assume that the oscillations move only a small angle from the vertical.
Work Step by Step
In general: $x(t) = A~cos(\omega~t+\phi)$
In this case: $x(t) = (4.00~cm)~cos~[~(3.14~rad/s)~t~]$
We can see that $\omega = 3.14~rad/s$
We can find the length of the pendulum:
$\omega = \sqrt{\frac{g}{L}}$
$L = \frac{g}{\omega^2}$
$L = \frac{9.80~m/s^2}{(3.14~rad/s)^2}$
$L = 0.994~m$
The length of the pendulum is $0.994~m$
We can assume that the oscillations move only a small angle from the vertical.