Gravity plays a critical role in the formation of our Sun and planets primarily by pulling gas and dust together. Here's how each of the options you mentioned relates to gravity's role:
-
Gravity pulls gas and dust together to form the sun and planets - This is true. In the early solar system, a cloud of gas and dust (a solar nebula) collapsed under its own gravitational attraction. As this material came together, it formed clumps that eventually became planetesimals and protoplanets. The central mass accumulated to form the Sun.
-
Gravity creates heat and light in the sun - This is somewhat misleading. While gravity itself does not create heat and light, the gravitational collapse of gas and dust in the Sun leads to nuclear fusion in its core. The immense pressure and temperature from this gravitational contraction trigger the fusion of hydrogen into helium, releasing energy in the form of heat and light.
-
Gravity repels gas and dust away from the sun - This is incorrect. Gravity actually attracts, rather than repels, gas and dust towards the Sun.
-
Gravity causes the sun and planets to rotate - This is partially true. The rotation of the Sun and the planets is a consequence of the angular momentum of the original solar nebula from which they formed. Gravity helps keep the objects in orbit, but it is the conservation of angular momentum that primarily determines their rotational motion.
In summary, the most accurate statement regarding gravity's role in the formation of our Sun and planets is that gravity pulls gas and dust together to form them.