(4) It is given that :
Mass of ball A, 
Mass of ball B, 
Initial velocity of ball A, 
Initial velocity of ball B, 
Final velocity of ball A, 
We have to find the final velocity of ball B after collision.
Since, it is a elastic collision. So the momentum remains conserved.
i.e.





So, after collision the ball B moves from right to left with a speed of 7 m/s.
(5) In this part, the mass of each ball is same and velocity of ball A is twice of that of ball B such that


If the collision of two balls is elastic, then using the conservation of momentum as

This implies that the final velocities would be different.
If the collision is inelastic,


So, if there is inelastic collision the balls will move with a common velocities.