The correct option is A Ionic compound
The compound formed is AB which is ionic in nature. As we know, an ionic compound is a chemical compound in which ions are held together by the ionic bonds.
The electronic configuration of two elements A and B are 2,8,2 and 2,6 respectively.
From their electronic configuration, we see that A (magnesium) is a metal and B (oxygen) is a non-metal, thereby A loses its valence electrons and forms a cation while B accepts those electrons and forms an anion. These oppositely charged ions are drawn closer due to electrostatic forces and an ionic compound (MgO) is formed.