Magnesium has 12 protons. How many electrons are in its first energy level?
This is a great example of how a problem can provide you with information you don't actually need in order to provide an answer.
In this case, all you really have to know here is that the atom in question is not hydrogen.
With the exception of hydrogen, every other atom in the periodic table will have two electrons in its first energy level.
Hydrogen, on the other hand, will only have one electron in its first energy level, and that's simply because it only has one electron in total.
So the answer to this question is
The electron configuration of magnesium
Now, the first energy level can only hold a maximum of two electrons because it only contains one orbital, the 1s-orbital.
So when asked about how many electrons can be found in an atom's first energy level, think
#color(blue)("1 electron") ->#if the atom is hydrogen
#color(green)("2 electrons") ->#if the atom is not hydrogen