Cohesion & Coupling — Concept Check
Questions on Cohesion & Coupling. Understand why high cohesion and low coupling are the bedrock of maintainable OOP design, with Java examples showing each extreme.
Questions in this quiz
8 questions on Cohesion & Coupling — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A developer notices that changing the email template in a service requires recompiling unrelated parts of the code. What does this indicate about the service's cohesion?
- ASequential cohesion
- BCommunicational cohesion
- CFunctional cohesion
- DCoincidental cohesion
2.In a system, a class directly modifies fields of another class. What type of coupling does this represent?
- AContent coupling
- BMessage coupling
- CData coupling
- DStamp coupling
3.A service is designed to handle both user authentication and email sending. What type of cohesion does this service likely have?
- AFunctional cohesion
- BCoincidental cohesion
- CLogical cohesion
- DProcedural cohesion
4.An engineer refactors a tightly coupled class to use interfaces for dependencies. What is the likely impact on the system?
- AIncreased flexibility and easier maintenance
- BNo impact on the system's flexibility
- CIncreased complexity and harder debugging
- DDecreased performance due to interface overhead
5.A class's responsibility can be described in one sentence without using 'and' or 'or'. What does this suggest about the class?
- AIt has logical cohesion
- BIt has functional cohesion
- CIt has coincidental cohesion
- DIt has procedural cohesion
6.A developer argues that using concrete classes instead of interfaces makes the code faster. What is a potential flaw in this reasoning?
- AUsing interfaces makes the code harder to read
- BInterfaces lead to slower code due to dynamic dispatch
- CInterfaces enhance flexibility without significant performance loss
- DConcrete classes are always faster than interfaces
7.Which type of coupling is characterized by a class only interacting with another class through method calls on an interface?
- ACommon coupling
- BMessage coupling
- CControl coupling
- DData coupling
8.In a refactored system, changes to the database implementation do not affect the business logic. What does this indicate about the system's design?
- AHigh coupling due to tight integration
- BLow coupling due to dependency injection
- CCoincidental cohesion in business logic
- DLogical cohesion in database layer