The time taken by the freely falling stone to reach the ground is given by
In both the cases, the stone will all through the same height as it is falling when the railway carriage is stationary. Hence, the stone will reach the ground after 2 seconds.