31) D
The lift is currently on floor 7. Floor 4 and 10 are equal distance from the lift. However, there are more stops requested on floor 10 side. So the lift moves in the direction of floor 10. As soon as the lift moves, a request for floor 7 comes.
However, the lift will carry on moving towards floor 10. When it stops on floor 10, the closest stop will be floor 7. So it moves towards 7.
After 7, 4, then 0 then towards 14 and then 16. So 16 will be last stop.
All floors visited before 16 = 10, 7 (again), 4, 0, 14
It will visit 5 stops before 16. So the answer is D.