Question

The following figure represents access graphs of two modules M1 and M2. The filled circles represent methods and the unfilled circles represent attributes. If method m is moved to module M2 keeping the attributes where they are, what can we say about the average cohesion and coupling between modules in the system of two modules?

Access graphs of modules M1 and M2 (filled circles are methods, unfilled circles attributes). M1: method 1 accesses attributes 1 and 3; method 2 accesses 1 and 2; method 3 accesses 3 and 4; method m accesses attributes 2 and 4 of M1 and attributes 1 and 2 of M2. M2: method 1 accesses attributes 3 and 4; method 2 accesses 1 and 4; method 3 accesses 2 and 3.
Choose one option
Official answer and solution
Official answer
A
From
Official GATE 2013 answer key

Solution

Analyze internal module accesses (cohesion) and inter-module accesses (coupling) before and after moving method m to module M2.

In modular design:

  • Cohesion measures the degree of internal binding within a module, characterized here by the number of access edges between methods and attributes belonging to the same module.
  • Coupling measures inter-module dependencies, characterized by access edges crossing between a method in one module and an attribute in another module.

From the given access graph:

  • Method mm is initially in module M1M_1. It accesses 2 attributes in M1M_1 and 2 attributes in M2M_2.
    • The 2 edges to attributes in M1M_1 are internal to M1M_1 (cohesion of M1M_1).
    • The 2 edges to attributes in M2M_2 are cross-module edges (coupling between M1M_1 and M2M_2).

Now suppose method mm is moved to module M2M_2 while leaving all attributes where they are:

  • The 2 edges from mm to attributes in M2M_2 are now internal to M2M_2 (cohesion of M2M_2).
  • The 2 edges from mm to attributes in M1M_1 are now cross-module edges (coupling between M2M_2 and M1M_1).

Comparing the totals:

  1. Total internal edges across both modules:
    • Before: Eint(M1)+Eint(M2)E_{\text{int}}(M_1) + E_{\text{int}}(M_2), which includes 2 edges from mm inside M1M_1.
    • After: (Eint(M1)−2)+(Eint(M2)+2)=Eint(M1)+Eint(M2)(E_{\text{int}}(M_1) - 2) + (E_{\text{int}}(M_2) + 2) = E_{\text{int}}(M_1) + E_{\text{int}}(M_2). The total number of internal edges across the system is unchanged, so the average cohesion remains the same.
  2. Total cross-module edges:
    • Before: 2 edges from mm crossed from M1M_1 to M2M_2.
    • After: 2 edges from mm cross from M2M_2 to M1M_1.
    • The total number of cross-module edges is unchanged, so coupling between modules remains the same.

Therefore, there is no change in either average cohesion or coupling.

Final answer

A

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2013 Computer Science and Information Technology (CS)
Question
38 of 65, printed as CS Q.38
Section
Computer Science and Information Technology

This question is from a part of the syllabus that is no longer in GATE CS. It is kept because it was in the paper.

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.