Rocks can form in a variety of ways. Igneous rocks form from magma (molten rock) that has either cooled slowly underground (e.g., to produce granite) or cooled quickly at the surface after a volcanic eruption (e.g., basalt). ... Examples of rocks are granite, basalt, sandstone, limestone, and schist.