CS FundamentalsVery hardProduct-company placement · GATE CS

A call hierarchy has 6 modules: M1 calls M2 and M3; M2 calls M4 and M5; M3 calls M6. Using the usual counts (top-down needs a stub for every module except the root; bottom-up needs a driver for every non-leaf module), how many stubs and drivers are needed?

  1. A. Top-down 3 stubs; bottom-up 5 drivers
  2. B. Top-down 5 stubs; bottom-up 3 drivers
  3. C. Top-down 5 stubs; bottom-up 5 drivers
  4. D. Top-down 3 stubs; bottom-up 3 drivers

Correct answer: B. Top-down 5 stubs; bottom-up 3 drivers

Top-down stubs replace callees not yet integrated: every module except M1, so 6 - 1 = 5. Bottom-up drivers replace callers: one each for M1, M2 and M3, i.e. nodes - leaves = 6 - 3 = 3. Swapping the two gives the trap option.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic