Which of the following are ionic compounds?
Magnesium oxide
Sodium fluoride
Ionic bond is the bond formed by the transfer of electrons between the atoms. While covalent bond is formed by sharing the electrons between the atoms.
In the formation of magnesium oxide, two electrons are transferred from magnesium to oxygen. In the formation of sodium fluoride one electron is trasferred from sodium to fluorine. So, these are ionic compounds.
Hydrogen fluoride and water are covalent compounds as they are formed by sharing electrons among their corresponding elements.