There are two ways to do this problem.
First way.
DISTANCE = RATE × TIME
After 2 hours, it has gone half-way.
DISTANCE = 40 km/hr × 2 hr
DISTANCE = 80 km
Since half-way is 80 km, the whole way is 2 times that.
Answer = 2 × 80 km = 160 km
----------------------------------
Second way.
DISTANCE = RATE × TIME
Since after 2 hours, it has gone half-way,
then after 4 hours (which is 2 times 2 hours),
it will go the whole way:
DISTANCE = 40 km/hr × 4 hr
DISTANCE = 160 km
----------------------------------
Edwin