Reaction of solid metals with a solution of metal ions
You can explain these experiments with the Standard Electrode Potential. With these experimental values you know which element/compound releases more energy upon receiving a comparable amount of electrons. As a rule of thumb, alkalimetals and alkaline earth metals release less energy than, for example, elements from the halogen-group.

With this table at hand, you can predict that $\ce{Mg}$ will be oxidized and the $\ce{Cu^2+}$ reduced, because of the potential for the two following reactions:
$$\ce{Mg^2+ + 2e^- -&gt; Mg(s)} \quad E^\circ=−2.372\,\text{V}$$
$$\ce{Cu^2+ + 2e^- -&gt; Cu(s)} \quad E^\circ=0.337\,\text{V}$$

Reducing copper-ions will release more energy, so the following chemical reaction will apply:
$$\ce{Mg +Cu^2+-&gt; Cu + Mg^2+}$$

In an analogous fashion, for the second question:
$$\ce{Ag^2+ + 2e^- -&gt; Ag(s)} \quad E^\circ=+1.98\,\text{V}$$
$$\ce{Ca^2+ + 2e^- -&gt; Ca(s)} \quad E^\circ=−2.868\,\text{V}$$

Reducing $\ce{Ag^2+}$ will release more energy - since silver is already in its solid state, the following reaction will not take place:

$$\ce{Ag +Ca^2+-&gt; Ag^2+ + Ca}$$

Note: To see how those potentials or potential difference relate to energy see, for example, the Nernst Equation / Gibbs free energy