CS FundamentalsVery hardProduct company interview · GATE level
In a class hierarchy, B, C and D extend A; E and F extend B; G extends E; H extends C. Using the Chidamber-Kemerer metrics with DIT(A) = 0, what is the largest depth of inheritance tree, what is NOC (number of children) of B, and how many classes are leaves?
- A. Max DIT 3; NOC(B) = 3; 4 leaves
- B. Max DIT 4; NOC(B) = 2; 4 leaves
- C. Max DIT 3; NOC(B) = 2; 4 leaves
- D. Max DIT 3; NOC(B) = 2; 3 leaves
Correct answer: C. Max DIT 3; NOC(B) = 2; 4 leaves
G's chain is G -> E -> B -> A, three edges, so DIT(G) = 3 is the maximum (counting classes instead of edges gives 4). NOC counts only immediate subclasses: B has E and F, so 2 - G is a grandchild and does not count. Leaves are classes with no subclasses: D, F, G and H.
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 risk has probability 0.4 and would cost ₹50 lakh. Three mitigations are proposed: M1 costs ₹6 lakh and cuts the probability to 0.1; M2…
- A Kanban team has on average 24 work items in progress and completes 8 items per week. By Little's law, what is the average lead time? If…
- A triple modular redundancy (TMR) design runs three identical modules and a voter that outputs the majority. Each module has reliability…
- A project's unadjusted function point count is 250. After the 14 general system characteristics are rated (0-5 each), the adjusted count…
- A system has 200 unadjusted function points. Using the IFPUG value adjustment factor (14 characteristics, each rated 0 to 5), what is the…
- Basic COCOMO for an embedded-mode project uses Effort = 3.6 x KLOC^1.20 person-months and Time = 2.5 x Effort^0.32 months. For a 50 KLOC…