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