Magnesium atom contains 12 electrons and its electronic configuration is 2, 8, 2.
Oxygen atom contains 8 electrons and hence, the electronic configuration is 2, 6.
Calcium atom contains 20 electrons and its electronic configuration is 2, 8, 8, 2.
Chlorine atom contains 17 electrons and hence the electronic configuration is 2, 8, 7