Concept:
The photoelectric effect occurs only when the energy of the incident photon is greater than or equal to the work function of the metal.
The photon energy is calculated using:
\[
E = \frac{hc}{\lambda}
\]
A useful shortcut formula is:
\[
E(\text{eV}) = \frac{1240}{\lambda(\text{nm})}
\]
If:
\[
E \geq \phi
\]
then photoelectric emission occurs.
Otherwise, electrons are not emitted.
Step 1: Calculate energy of incident radiation.
Given:
\[
\lambda = 300\,\text{nm}
\]
Using:
\[
E = \frac{1240}{300}
\]
\[
E = 4.13\,\text{eV}
\]
Thus, incident photon energy is:
\[
E = 4.13\,\text{eV}
\]
Step 2: Compare photon energy with work function of each metal.
For Mg:
\[
\phi = 3.7\,\text{eV}
\]
Since,
\[
4.13 > 3.7
\]
Therefore, Mg shows photoelectric effect.
For Cu:
\[
\phi = 4.8\,\text{eV}
\]
Since,
\[
4.13 < 4.8
\]
Therefore, Cu does not show photoelectric effect.
For Ag:
\[
\phi = 4.3\,\text{eV}
\]
Since,
\[
4.13 < 4.3
\]
Therefore, Ag does not show photoelectric effect.
For Li:
\[
\phi = 2.5\,\text{eV}
\]
Since,
\[
4.13 > 2.5
\]
Therefore, Li shows photoelectric effect.
Step 3: Identify the correct metals.
The metals which undergo photoelectric effect are:
\[
\boxed{\text{Mg and Li}}
\]
Hence, the correct option is:
\[
\boxed{(D)}
\]