The reduction in speed is directly proportional to the square root of number of compartment attached.

When there is no compartment attached, then speed would be $42$km/h.

Now suppose $x$ compartment attached and speed reduction will be $24$km/h

$24=42-k\sqrt(x)$

when $x=9,$

$k=6$

Then when speed is $0$, maximum compartment attached

$0=42-6\sqrt(x)$

So, $x=49$

but when speed $0,$ engine cannot move forward.

So, to move forward with minimum speed, we have to attach $49-1=48$ compartments

Ans B)