Rocks are mainly classified into three types:
\[
\text{Igneous rocks, Sedimentary rocks, and Metamorphic rocks}.
\]
Igneous rocks are formed by the cooling and solidification of molten material.
When molten material is present inside the earth, it is called:
\[
\text{Magma}.
\]
When magma comes out on the earth's surface through volcanic activity, it is called:
\[
\text{Lava}.
\]
When magma or lava cools, it solidifies and forms igneous rocks.
For example:
\[
\text{Granite and Basalt}
\]
are common igneous rocks.
Sedimentary rocks are formed by deposition and compaction of sediments.
Metamorphic rocks are formed when pre-existing rocks are changed due to heat and pressure.
Therefore, the rock formed by cooling of lava or magma is:
\[
\text{Igneous rock}.
\]