The acceleration of the body will be due to the earth’s gravitational force, therefore the acceleration will be –g (the negative sign indicates that the gravitational acceleration will be in the opposite direction of the ball’s initial velocity).
v = u + at
Here, v= The final velocity of the ball
u = 40m/s = The initial velocity of the ball
a = −g=−10m/s2
t = 2sec= Time
v = 40 + (−10)2
v = 20m/s
So, the final velocity of the ball after 2 seconds will be 20m/s will be in the upwards direction.