The important thing to note here is the direction of motion of the test rocket. Since it mentions that the rocket travels vertically upwards, then this motion can be applied to rectilinear equations that are derived from Newton's Laws of Motions.These useful equations are:
y = v₁t + 1/2 at²
a = (v₂-v₁)/t
where
y is the vertical distance travelled
v₁ is the initial velocity
v₂ is the final velocity
t is the time
a is the acceleration
When a test rocket is launched, there is an initial velocity in order to launch it to the sky. However, it would gradually reach terminal velocity in the solar system. At this point, the final velocity is equal to 0. So, v₂ = 0. Let's solve the second equation first.
a = (v₂-v₁)/t
a = (0-30)/t
a = -30/t
Let's substitute a to the first equation:
y = v₁t + 1/2 at²
49 = 30t + 1/2 (-30/t)t²
49 = 30t -15t
49 = 15 t
t = 49/15
t = 3.27 seconds