GATE / CS ARCHIVE

GATE CSE 2013 / QUESTION 38

Moving a method between modules

Engineering Mathematics & Other Topics · Software Engineering · Full GATE CSE 2013 paper

GATE 2013, Q38 2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Software Engineering

Question 38, GATE 2013: Two access-graph modules each have 4attribute nodes. M1 has 4 methods and M2 has 3; each method accesses 2 attributes of its own module. Method m in M1 additionally accesses 2 attributes in M2. Move m to M2, keeping attributes fixed. Under access-density cohesion and cross-module access coupling, what changes? A neither; B cohesion rises, coupling falls; C both fall; D both rise. Filled circles in the source are methods, unfilled circles attributes.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

The diagram shows m accessing two attributes in its own module and two in the other. Moving m exchanges two internal accesses for two external ones in each direction, so the number of cross-module accesses remains 2. Every method accesses two of the four attributes of its current module; internal access densities stay 8/16=.5 and 6/12=.5 before the move, then 6/12=.5 and 8/16=.5 after. Thus average cohesion and coupling are unchanged under this access-based measure, A.

Before moving m, internal accesses total 4×2=8in M1 and 3×2=6in M2; possible method-attribute pairs are 4×4=16and3×4=12. Both densities are 1/2. After moving m, the method counts exchange, so the two densities remain 6/12and8/16. The two accesses from m to M2 become internal, but its two accesses to its old M1 attributes become external. Thus cross-module accesses stay 2. The conclusion is tied to this access-graph measure, rather than every possible software cohesion metric.

Original paper, page 8 · Answer key