CS FundamentalsVery hardProduct-company placement
A class has fields a, b, c, d and methods m1 (uses a, b), m2 (uses b), m3 (uses c), m4 (uses c, d) and m5 (uses no field but calls m1). Using LCOM4 (methods are linked if they share a field or one calls the other; LCOM4 = number of connected groups), what is its value and what does it suggest?
- A. 1; the class is cohesive
- B. 3; split it into three classes
- C. 5; every method stands alone
- D. 2; the class could be split in two
Correct answer: D. 2; the class could be split in two
m1–m2 share b and m5 calls m1, giving {m1, m2, m5}; m3–m4 share c, giving {m3, m4}. Two components mean two unrelated responsibilities. Ignoring the call edge would wrongly make m5 a third group.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- A package has 10 classes, 2 of them abstract. 3 outside classes depend on it (Ca = 3) and it depends on 9 outside classes (Ce = 9). Using…
- What happens when this builder code runs? python class QB: def init(self): self.parts = [] def where(self, c): self.parts.append(c)…
- What does this plugin-registry code print? python class Plugin: registry = [] def init(self, name): self.registry.append(name) class…
- What does this Template Method code print? python class Base: def run(self): return self.a() + self.b() def a(self): return 'A' def…
- Why do many agile teams estimate story points on a Fibonacci-like scale (1, 2, 3, 5, 8, 13, …) instead of 1 to 10?
- Match each risk response with an example. P. Avoid Q. Transfer R. Mitigate S. Accept 1. Buy fixed-price insurance against data-centre…