Coupling & Cohesion Questions with Answers

15 practice questions on Coupling & Cohesion (OOP Concepts) with answers and step-by-step solutions. Try 10 samples below, then practise all 15 free in the AptiNest app.

Sample questions

Question 1Easy

Which kind of coupling is considered the best (loosest) in classic structured design?

  1. Content coupling
  2. Data coupling
  3. Common coupling
  4. Control coupling

Answer: B. Data coupling

Explanation

In data coupling modules share only the elementary data they need through parameters.

Step-by-step solution

  1. Data coupling shares only basic data through parameters.
  2. This minimizes direct dependency between modules.
  3. Other couplings involve more complex interactions.
  4. Thus, data coupling is the loosest type.
  5. Final answer: B (Data coupling).

Why the other options are wrong

  • A. Content coupling is the tightest form, where one module uses another's internal data, so it is the worst, not the best.
  • C. Common coupling shares global data between modules, which is tight coupling and not the loosest form.
  • D. Control coupling passes flags that steer another module's logic, which is tighter than data coupling.

Tip: Remember: Data coupling is the weakest form of coupling in structured design.

Question 2Easy

A 'utility' class that holds unrelated methods for dates, emails and file sizes shows:

  1. Low cohesion
  2. Strong encapsulation
  3. High cohesion
  4. Low coupling

Answer: A. Low cohesion

Explanation

Its members share no common purpose, which is coincidental (low) cohesion.

Step-by-step solution

  1. Dates, emails and file sizes have no conceptual relationship to each other.
  2. They are bundled only for convenience (a place to dump 'misc' helper methods), not because they form one coherent responsibility.
  3. A class whose members share no common purpose has low (coincidental) cohesion.

Why the other options are wrong

  • B. Encapsulation is about hiding internals and controlling access, unrelated to whether a class's own methods belong together.
  • C. High cohesion is the opposite situation - a focused class with one clear purpose, not a grab-bag of unrelated utilities.
  • D. Coupling describes a relationship between separate classes; it says nothing about the relatedness of one class's own members.

Tip: If you can't name the class's ONE job in a sentence, it probably has low cohesion.

Question 3Easy

Coupling refers to:

  1. The number of classes in a program
  2. How well the elements inside one module belong together
  3. The degree of interdependence between modules
  4. How often a module is reused

Answer: C. The degree of interdependence between modules

Explanation

Coupling measures dependence between modules; cohesion measures relatedness within a module.

Step-by-step solution

  1. Coupling measures how much one module depends on others.
  2. Low coupling is good because a change in one module does not spread to the others.
  3. So index 2, the degree of interdependence between modules, is correct.

Why the other options are wrong

  • A. Counting classes measures size, not coupling.
  • B. How well elements inside a module belong together is cohesion, not coupling.
  • D. How often a module is reused is not coupling.

Tip: Coupling is between modules (lower is better); cohesion is inside one module (higher is better).

Question 4Easy

Cohesion measures:

  1. How fast a module executes
  2. How many lines of code a module has
  3. How closely the responsibilities inside one module are related
  4. How many other modules call or import a given module across the whole system

Answer: C. How closely the responsibilities inside one module are related

Explanation

High cohesion means a module's elements work together for a single, well-defined purpose.

Step-by-step solution

  1. Cohesion is about how well parts of a module fit together.
  2. High cohesion means responsibilities inside one module are closely related.
  3. This ensures the module has a single, clear purpose.
  4. Option C describes this relationship within a module.
  5. Final answer: How closely the responsibilities inside one module are related.

Why the other options are wrong

  • A. Execution speed is performance, not how well a module's parts belong together.
  • B. Line count is size, which says nothing about how related the responsibilities are.
  • D. How many callers a module has is fan-in, which is a different measure from cohesion.

Tip: Remember, cohesion is about internal relationships, not external dependencies.

Question 5Medium

One module directly modifies the private internal data of another module. This is the worst kind of coupling, called:

  1. Control coupling
  2. Content coupling
  3. Stamp coupling
  4. Data coupling

Answer: B. Content coupling

Explanation

Content coupling occurs when a module relies on or alters another's internals; data coupling (passing only needed values) is the best.

Step-by-step solution

  1. Content coupling happens when one module changes another's internal data directly.
  2. Other couplings like data coupling pass only required information, not internals.
  3. Direct modification of private data is the strongest form of coupling.
  4. Content coupling is the worst type of coupling as it creates tight dependencies.
  5. Correct answer is Content coupling.

Why the other options are wrong

  • A. Control coupling passes a flag that steers the other module's logic, which is not direct data tampering.
  • C. Stamp coupling passes a whole data structure, which is milder than touching private data.
  • D. Data coupling passes only the plain values needed, the mildest form, not private data edits.

Tip: Remember: Direct modification of private data = Content coupling.

Question 6Medium

Module A passes a flag to module B that tells B which branch of logic to execute. This is:

  1. Common coupling
  2. Data coupling
  3. Content coupling
  4. Control coupling

Answer: D. Control coupling

Explanation

Passing a control flag means A knows and directs B's internal logic, which is control coupling.

Step-by-step solution

  1. A passes B a flag or code specifically so B can decide which of its own internal branches to run.
  2. For A to choose the right flag value, A must already know something about how B's internal logic branches.
  3. Needing to know and direct another module's internal decision-making is exactly what control coupling means.

Why the other options are wrong

  • A. Common coupling is about sharing global data, not about passing a single control flag.
  • B. Data coupling passes only the data actually needed for the task, not a flag that dictates internal logic.
  • C. Content coupling is reaching directly into another module's internals (e.g. its private data) - a worse, more invasive form than passing a flag.

Tip: If the passed value picks a branch inside the callee, that's control coupling.

Question 7Medium

Which practice most directly reduces coupling between a class and its collaborators?

  1. Making all fields public
  2. Depending on interfaces instead of concrete classes
  3. Using global variables for shared data
  4. Merging collaborators into one class

Answer: B. Depending on interfaces instead of concrete classes

Explanation

Programming to an interface lets implementations change without touching the client, so the client is loosely coupled to them.

Step-by-step solution

  1. Depending on interfaces hides implementation details from clients.
  2. Clients interact with abstractions, not concrete classes.
  3. This allows changes in implementation without altering clients.
  4. Interfaces reduce direct dependency between classes.
  5. Thus, coupling is minimized through abstraction.

Why the other options are wrong

  • A. Public fields expose internals and increase coupling, the opposite of what is wanted.
  • C. Global variables hide dependencies and tie unrelated code together.
  • D. Merging collaborators into one class makes the class bigger and less cohesive, not less coupled.

Tip: Use interfaces to minimize dependencies and improve system flexibility.

Question 8Medium

Several modules read and write the same global variable. This is:

  1. Stamp coupling
  2. Data coupling
  3. Common coupling
  4. Message coupling

Answer: C. Common coupling

Explanation

Sharing global data couples every module that touches it, so a change in one can break the others.

Step-by-step solution

  1. Several modules read and write one shared global variable.
  2. Any one of them can change that shared state in ways the others don't expect.
  3. Because the connection lives in the global data rather than in any function signature, it's invisible just from reading each module's interface.

Why the other options are wrong

  • A. Stamp coupling passes a composite/structured data item through a parameter, not through a shared global.
  • B. Data coupling passes only the specific data needed, directly as parameters - no shared global involved.
  • D. Message coupling refers to passing simple messages or identifiers between modules, not sharing a global variable.

Tip: If you can't tell two modules are connected just from their signatures, it's probably common coupling.

Question 9Hard

The Law of Demeter ('talk only to your immediate friends') is violated by which call?

  1. this.helper.compute(x)
  2. order.getCustomer().getAddress().getCity()
  3. param.validate()
  4. order.getTotal()

Answer: B. order.getCustomer().getAddress().getCity()

Explanation

Chaining through objects returned by other objects couples the caller to the structure of distant classes; Demeter allows calls on itself, its fields, parameters and objects it creates.

Step-by-step solution

  1. order.getCustomer() returns a customer object.
  2. customer.getAddress() returns an address object.
  3. address.getCity() accesses a distant property through multiple layers.
  4. This violates the Law of Demeter by chaining calls across unrelated objects.
  5. The correct answer is order.getCustomer().getAddress().getCity().

Why the other options are wrong

  • A. this.helper is a direct collaborator, so calling compute on it is allowed.
  • C. param is an argument the method was given, so calling validate on it is allowed.
  • D. A getter on the object itself is a direct call and does not reach through another object.

Tip: Avoid deep method chaining; keep interactions simple and local.

Question 10Hard

Order these cohesion types from best to worst: logical, functional, coincidental, sequential.

  1. Functional, sequential, logical, coincidental
  2. Functional, logical, sequential, coincidental
  3. Coincidental, logical, sequential, functional
  4. Sequential, functional, coincidental, logical

Answer: A. Functional, sequential, logical, coincidental

Explanation

The classic scale (best to worst) is functional, sequential, communicational, procedural, temporal, logical, coincidental.

Step-by-step solution

  1. Best to worst cohesion: functional, sequential, logical, coincidental.
  2. Functional does one task; sequential passes output along; logical groups by type; coincidental has no link.
  3. So the order in option A is correct; the correct answer is option A.

Why the other options are wrong

  • B. Sequential is better than logical, so it cannot come after logical.
  • C. Coincidental is the worst, not the best.
  • D. Functional is the best, not sequential.

Tip: Functional is best; coincidental is worst.

Practise all 15 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all OOP Concepts topics · All topics