In a class definition with 10 methods, to make the class maximally cohesive,…

2020

In a class definition with 10 methods, to make the class maximally cohesive, number of direct and indirect connections required among the methods are

Answer: B. 45, 0To achieve maximal cohesion, all methods must interact directly with each other, forming a complete graph. The number of direct connections for n items is…

  1. A.

    90, 0

  2. B.

    45, 0

  3. C.

    10, 10

  4. D.

    45, 45

Attempted by 131 students.

Show answer & explanation

Correct answer: B

To achieve maximal cohesion, all methods must interact directly with each other, forming a complete graph. The number of direct connections for n items is calculated as n(n-1)/2. With 10 methods, this equals 10 * 9 / 2 = 45 direct connections. Since every method is directly connected to every other, no indirect paths are needed for cohesion between any pair. Therefore, the required connections are 45 direct and 0 indirect.

Explore the full course: Isro

Loading lesson…