Acceleration is the rate of change of velocity. In other words,

acceleration = (final velocity - initial velocity) / (final time - initial time)

Thus, for car B,

in first two hours: v = 40 km/h, u = 0 km/h and t = 2 h

thus, a = (40 - 0)/2 = 20 km/h^2

in next two hours: v = u = 40 km/h, thus, acceleration = 0 km/h^2

and in last 2 hours: v = 0, u = 40 km/h and t = 2 h

thus, acceleration = (0 - 40)/2 = -20 km/h^2.

Similarly, for car A,

in first two hours: acceleration = (30 - 0)/2 = 15 km/h^2

for next 2 hours, acceleration = (60 - 30)/2 = 15 km/h^2

and in the last 2 hours, acceleration = (0 - 30)/2 = -15 km/h^2

(ii) Total distance traveled by Car (B):

Average velocity in first 2 hours = (0 + 40)/2 = 20 km/h

average velocity for next 4 hours = 40 km/h

and average velocity for last 2 hours = (40 + 0)/2 = 20 km/h

thus distance traveled = 20 km/h x 2 h + 40 km/h x 4 h + 20 km/h x 2 h

= 40 km + 160 km + 40 km = 240 km.

Similarly for car (A):

distance traveled = average speed x time = (0 + 30)/2 km/h x 2 h + (30 + 60)/2 km/h x 2 h + (60 +30)/2 km/h x 2 h + (30 + 0)/2 km/h x 2 h = 240 km

The distance traveled by both cars is same.

The distance traveled can also be determined as the area under the curve. For example, for car A: distance = area under the curve = area of triangle with base 8 hr and height 60 km/h = 1/2 x 8 h x 60 km/h = **240 km**.

(iii) Average speed = distance traveled/time taken = 240 km/8 h = **30 km/h**

Since both the cars traveled the same distance in the same time, the average speed is the same and is equal to 30 km/h.

Hope this helps.