Encapsulation - Object oriented programming (MCQ) questions

1)   Encapsulation helps
- Published on 19 Oct 15

a. information hiding
b. in providing low coupling
c. in providing high cohesion
d. All the above
Answer  Explanation 

ANSWER: All the above

Explanation:
Encapsulation works on providing interactions through function calling only. Using keyword private or protected stops the use of data members outside class. The data thus remains accessible to functions inside class. Encapsulation is also called information hiding as it restricts the use of data inside class. Coupling is the degree of interdependence between different blocks( modules) of program code. Low coupling helps in keeping data safe inside the class. Coupling contrasts cohesion as with high cohesion comes reliability and reusability in a code.


1