When asked the quantum numbers of an element, the question is really asking about only the valence or outermost electron.

The four quantum numbers determine the state of the electron, and are

#n# is the distance of the orbital from the nucleus (#1, 2, 3, 4# etc),

#l# is the shape of the orbital (#0 -> n-1#)

#m_l# is the orientation of the orbital in space (#-l -> +l#), and

#m_s# is the spin of the electrons inside the orbital (#-1/2# or #+1/2#).

The electronic configuration for magnesium is #1s^2 2s^2 2p^6 3s^2#. The outermost electron is one in the #3s# orbital, which means that #n = 3#.

It also means that #l = 0#, since #s# is basically shorthand for the orbital shape of #l = 0#.

#m_l# can range from #-l# to #+l#, but since #l = 0#, then #m_l# must also be #0#.

Finally, #m_s# can be either one since there are two electrons in the #3s# orbital and it doesn't really matter which spin you choose.

Putting all of these together, the final quantum numbers of a magnesium atom are

#3, 0, 0, +-1/2#