Distance =speed *time=s*t
Distance covered in half an hour at 30km/hr = s×t = 30×1/2=15km.
Distance coveted in 1hr at 25km/hr= s×t= 25×1 =25km.
Distance covered in 2 hrs at 40km/hr=s×t= 40×2=80km
Therefore, total distance covered= 15+25+80=120km
Total time taken= 3hrs and 30 mins=7/2 hrs.
Therefore,
average speed=total distance covered/total time taken
= 120/(7/2)
= 34.28km/hr