Which best describes how magnesium (Mg) and oxygen (O) bond?

They form a covalent bond by sharing four electrons.
They form an ionic bond by exchanging three electrons.
They form an onic bond by exchanging two electrons.
They form a covalent bond by sharing one electron.

They form an ionic bond by exchanging two electrons.