(a) The variables and methods are put together in a Class.
(b) A man withdrawing money from ATM.
(a) Encapsulation is illustrated in the given picture. Wrapping of data and functions of an object as a unit (class) that can be used together in a specific operation is known as Encapsulation. In the picture, the variables and methods are being encapsulated in a class.
(b) The principle of Data abstraction is illustrated here as the man withdraws money from the ATM using the withdraw option. He knows the essential features of the ATM machine such as withdrawing money, without knowing the complex background details of how the ATM machine is operating to provide money to him.
First read the answer fully, then try to explain it in your own words. After that, open a few related questions and compare the concepts. This method helps you remember the topic for a longer time and improves exam preparation.