<span>The force of gravity = GMm / r^2, where G is gravitational constant, M is mass of one object, m is mass of another object, r is distance between them.
So, mass of objects affect gravity as well as the distance between the two objects.</span>
Distance and mass affect gravity. If an object has a greater mass, it's gravitational pull will be stronger. And if an object is further away from the one that is exhorting the gravitational pull, then the gravitational pull on the object will be weaker than on closer objects.
when the water is heated with immersion heater, the water becomes less dense due to which the warm water rises up and the cooler water fills it's space.
When light passes from a rarer medium into a denser medium, it bends in the medium away from the normal. This creates the phenomenon of "apparent depth" as given in the question.