I am not understanding this molarity stuff. Can someone please show me step by step on how to solve this question?

What is the molarity of 0.50 L of solution containing 40.0 g of CaCO3?

You just need to remember the definition of molarity. That's all there is to it.

M = moles solute/liter solution. The problem here is that this is not a simple molarity problem. CaCO3 is largely insoluble; therefore, one must determine the solubility using the Ksp (solubility product).
CaCO3 ==> Ca^+2 + CO3^=
Ksp = (Ca^+2)(CO3^=) = 4.8E-9 (in my tables).
If we let x = solubility of CaCO3, then x will be the solubility of Ca^+2 and it will be the solubility of CO3^=
Substitute into the Ksp expression to obtain (x)(x) = 4.8E-9 and solve for x. I find 6.94E-5 and the unit is M(molar).
A couple of comments. It may be that the 40.0 g listed in the problem was there to throw you off track (since most of it remains at the bottom of the container undissolved and nowhere near 40.0 grams will dissolve in 0.500 L water.) But it could be that the person making the problem meant for this to be a simple molarity problem and just forgot that CaCO3 is not very soluble. In that event the M = moles/L. mols = grams/molar mass = 40/100 = 0.40 mol CaCO3 and that in 0.50 L will make the molarity 0.40/0.50 = ??. However, the correct answer is the first solution above, not the latter.