Refraction occurs when light changes medium. Whenever light travels from one medium to another, refraction takes place at the interface of the two mediums. This happens because velocity of light is different in different medium.
Difference between the displacement produced by a glass slab and the deviation produced by a glass prism is:
A glass slab causes apparent shift in the position of the because of refraction. The incident and the emergent rays are parallel but are displaced due to refraction causing apparent displacement of an object seen through a glass slab.
Deviation produced by a prism is due to the geometrical construction of the prism. Since the refracting sides are not parallel the deviations produced are more noticeable and also causes dispersion of light.
The ray diagrams for all the cases are as follows:
I. When the object is at infinity.