All mock tests are FREE till 31 December — register to save your progress

Module design is used to maximize cohesion and minimize coupling. Which of the following is the key to implement this rule?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: C. Encapsulation

Explanation

Encapsulation packages the data and the operations that act on that data inside one module and hides the internal representation behind a narrow interface. Keeping everything that belongs together inside the module raises cohesion, while restricting other modules to the published interface removes shared data and internal dependencies, which lowers coupling — so encapsulation delivers both halves of the rule at once. Inheritance actually increases coupling between a subclass and its superclass, polymorphism is about interchangeable behaviour at run time, and abstraction is the broader idea of ignoring detail rather than the mechanism that enforces the boundary. Hence encapsulation is the key.

More Programming Languages and Computer Graphics questions