This question is misleading.
First, gravity always acts radially inward toward the centre of the earth.
These sign issues are a different issue and arise when you choose your co-ordinate system.
In the first case, if the ball is thrown upwards, and you choose up as your positive z-axis, in which case you must use
#-g#as your "acceleration".
In the second case, if the ball is dropped, and you choose down as your positive z-axis, then you must use
#g#as your "acceleration".
In projectile motion, it is most common to choose up as the positive z-axis, then clearly you must use
But you could also choose down as the positive z-axis, provided you were sure to keep all the signs in order. Then clearly you would use