So the ration is 2:4 If there are 14 girls that means you multiplied 2 by 7. Since you did that to 2 then you do the same thing to 4 ( to keep the ration constant) that would mean there are 28 boys.
Then it asks how many kids were there in total which you add 14 and 28 to get 42 kids in total.