There is an easy way to figure out these problems, but its pointless if you don't understand the reasoning behind it.
Take a metre, and square it to have a metre squared. Now realize that 1 metre = 100 centimetres by definition. This means you can fit 100 centimetres along the metre-squared's length, and 100 centimetres along the metre-squared's width. Now, you should know that the area = length * breadth. So area = 100cm * 100cm = 10,000cm2
Thus, 1m2=10,000cm2=1002cm2
As for the square kilometre. There are 1000 metres in 1km. So if we take 1km2, we can fit 1000m along the length, and 1000m along the width. Area=1000m*1000m=1,000,000m2
Thus, 1km2=10002m2=1010cm2
Similarly, you can do this for volumes.
e.g. 1m3 is how many cm3? Well, 100cm=1m, and volume = length * breadth * height = 100cm*100cm*100cm = 1,000,000cm3=106cm3
In summary ~ For area, to find the amount of m2 to km2 or cm2 to mm2 etc. Just realize how many of those units are equal to the other larger/smaller metric unit, and square it. For volumes, cube it.