Write down the data you know:
v = 40mL = 0.040L
c = 0.10mol.L-1
M = 121.34g.mol-1
the equations that link this data are:
n = c x v
m = n x M
First, the number of moles of MgSO4 in 40mL of 0.10M solution is:
n = 0.10 x 0.040 = 0.004moles
How many grams of MgSO4 is 0.004 moles?:
m = n x M = 0.004 x 121.34 = 0.485g