12x2=24. 2x2=4. This infers that there is a multiple of 2. If the total number of girls is thus twice the number of boys, then indeed for every two boys, there are (twice as many) 4 girls.
33+9=42. 42-40=2. These simple calculations show that two people must have raised there hands for both because the sum of the two groups who raised hands is two more than the amount of people in the actual class