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?
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 is initially in module . It accesses 2 attributes in and 2 attributes in .
- The 2 edges to attributes in are internal to (cohesion of ).
- The 2 edges to attributes in are cross-module edges (coupling between and ).
Now suppose method is moved to module while leaving all attributes where they are:
- The 2 edges from to attributes in are now internal to (cohesion of ).
- The 2 edges from to attributes in are now cross-module edges (coupling between and ).
Comparing the totals:
- Total internal edges across both modules:
- Before: , which includes 2 edges from inside .
- After: . The total number of internal edges across the system is unchanged, so the average cohesion remains the same.
- Total cross-module edges:
- Before: 2 edges from crossed from to .
- After: 2 edges from cross from to .
- 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.
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.