An application uses encapsulation to achieve ________

  1. Information hiding

  2. Minimizing interdependencies among modules

  3. Make implementation independent

  4. All of these options


Correct Option: A

AI Explanation

To answer this question, you need to understand the concept of encapsulation. Encapsulation is one of the four fundamental principles of object-oriented programming (OOP), which aims to bundle data and methods within a single unit called a class.

Let's go through each option to understand why it is correct or incorrect:

Option A) Information hiding - This option is correct because encapsulation allows the hiding of the internal implementation details of a class. By encapsulating data and methods within a class, the internal workings are hidden from other classes or modules, promoting better security and maintainability.

Option B) Minimizing interdependencies among modules - This option is not directly related to encapsulation. While encapsulation can help to minimize interdependencies by providing a clear interface to interact with a class, it is not the primary purpose of encapsulation.

Option C) Make implementation independent - This option is not directly related to encapsulation. Encapsulation focuses on bundling data and methods together within a class, but it does not ensure implementation independence. Implementation independence can be achieved through other principles, such as abstraction and polymorphism.

Option D) All of these options - This option is incorrect because option B and option C are not directly related to encapsulation. Therefore, not all of the options are achieved through encapsulation.

The correct answer is option A) Information hiding. This option is correct because encapsulation allows the hiding of the internal implementation details of a class, promoting better security and maintainability.

Find more quizzes: