Let car A's starting position be the origin, so that its position at time t is
A: x = (40 m/s) t
and car B has position at time t of
B: x = 100 m - (60 m/s) t
They meet when their positions are equal:
(40 m/s) t = 100 m - (60 m/s) t
(100 m/s) t = 100 m
t = (100 m) / (100 m/s) = 1 s
so the cars meet 1 second after they start moving.
They are 100 m apart when the difference in their positions is equal to 100 m:
(40 m/s) t - (100 m - (60 m/s) t) = 100 m
(subtract car B's position from car A's position because we take car A's direction to be positive)
(100 m/s) t = 200 m
t = (200 m) / (100 m/s) = 2 s
so the cars are 100 m apart after 2 seconds.