This question can be split up into two parts, and uses two key equations:
It's always a good idea to look at what information we have been given already, and work out what we can do with it!
In this question we've been given the mass of MgCO3 and the molar mass. The question that should come to mind is "What can I work out using both of those bits of information?".
Part I
Calculate the number of moles of MgCO3 in 5 grams.
We're going to use the equation: mass / molar mass = number of moles
5 g / 84.3 g/mol = 0.059 mol
Part II
Now we have the number of moles in 5 grams of MgCO3, we need to work out the volume of CO2 that is produced.
From the balanced equation we can see that the ratio of MgCO3 to CO2 is 1:1, meaning that the number of moles of MgCO3 before the reaction is the same as the number of moles of CO2 at the end of the reaction.
We have just worked out the number of moles of MgCO3 (0.059 moles), so we can use that in our next equation:
volume of gas = moles x 24,000
We need to recall that 1 mole of gas takes up 24,000 cm3 in volume.
Therefore:
volume of CO2 = 0.059 mol x 24,000 cm3/mol = 1416 cm3