Most volcanoes and earthquakes occur at the boundaries of tectonic plates. This means that they occur in the same places, many of which are under water.
The crust of the Earth is made up of large slabs of rock known as tectonic plates. In the ocean there are oceanic plates, and on land there are continental plates. Under these plates is a softer area which is very hot. Tectonic plates float on top of this layer, moving very slowly. Most earthquakes and volcanoes occur when these plates interact with each other, which happens at their boundaries.
The molten rock that becomes lava in a volcano is called magma when it is in the Earth's core. When the plates slide past each other, push against each other or move on top of each other, this magma rises to the surface and gets through because of weaknesses in the crust. Most volcanoes, however, occur under water.
Earthquakes usually occur when the plates bump into each other, but they can also occur when the plates slide past each other. They also occur when plates pull away from each other. This obviously has to happen at plate boundaries. Because of this, scientists are able to use the location of earthquakes to work out where the boundaries of tectonic plates exist.