Concentration of the solution is measured as the number of moles of solvent over the volume of the solution.
Concentration = moles HCl/Volume of solution
The key in solving this problem is to make the units of the volume the same.
either you convert cm^3 to dm^3 or vice versa.
**in this case it is easier to convert cm^3 to dm^3
1cm^3 = 0.001 dm^3
50cm^3 x (0.001dm^3 /1cm^3) = 0.05 dm^3 = volume
now we go to our original formula:
Concentration = moles HCl/ volume solution
now we are looking for the moles of solute so we transform the equation to this:
moles HCl = concentraction x volume
= 0.4 moles/dm^3 x 0.05 dm^3
= 0.02 moles HCl
Hope this helps:)