Concept: The question tests on the area of Modern Math(Basic Stats)

Solution:

The median of an odd number of observations is the n+1/2 th value.

In class A, 40kg is the weight of the 13th student and in class B, 50 kgs is the weight of the 33rd student.

So in Class A, there are 12 students greater than 40 kg, and since we want to maximize the number who are greater than 40 and less than 50kg, let us assume that all 12 fall in this category.

Now when 20 people leave class B, leaving its median unchanged, then 10 students ≤ 50 kg and 10 students ≥ 50 kg, would have left the class.

When these 20 joined class A, leaving it's median unchanged it means that 10 would have been ≥ 40 kg and 10 have to be ≤ 40 kg.

So, the 10 who are ≥ 50 kg go onto the right of the student weighing 40 kgs, and 10 students would go to the left of the student weigh who weighs 40 kg.

Therefore the maximum number of students > 40kg and < 50 kg does not change as the new students are all greater than or equal to 50 kgs which is 12.
 (Option A)