Since both $\text{Ca}^{2+}$ and $\text{Mg}^{2+}$ share the exact same charge valency ($z=2$), the number of moles of each metal produced by a given quantity of electricity will be identical. $4.8\text{ g}$ of $\text{Mg}$ corresponds to $\frac{4.8}{24} = 0.2\text{ moles}$. Therefore, you will get exactly $0.2\text{ moles}$ of calcium: $0.2 \times 40 = 8.0\text{ g}$ immediately!