Java OCA OCP Practice Question 1326

Question

Suppose class Home has methods doA() and doB().

It also has a method called doAAnddoB(), which just calls the other two methods.

Which statements are true?

Choose all that apply.

  • A. doAAnddoB() is an example of appropriate cohesion.
  • B. doAAnddoB() is an example of inappropriate cohesion.
  • C. doAAnddoB() is an example of appropriate coupling.
  • D. doAAnddoB() is an example of inappropriate coupling.


B.

Note

Cohesion is the degree to which a class or method resists being broken down into smaller pieces.

It is a desirable quality.

doAAnddoB() can obviously be broken down into its two constituent parts, so it has inappropriate cohesion.

This question does not concern coupling, which is an object's reliance on knowledge of the internals of another entity's implementation.




PreviousNext

Related