Answer: The valency of oxygen is 2, because it needs two atoms of hydrogen to form water.
Explanation: The nearest noble gas to magnesium is neon with electronic configuration of [2,8], to achieve this stable electronic configuration Mg can lose 2 valence electrons, hence its valency is 2 + ^+ +