CS FundamentalsModerateWipro · Accenture pattern
A class diagram shows Vehicle as a superclass with a generalization (hollow triangle arrow) pointing from Car and Truck up to Vehicle. If Vehicle declares an abstract method `startEngine()`, what must Car and Truck each do?
- A. Only one of Car or Truck needs to implement it; the other can remain abstract
- B. The hollow triangle means Car and Truck must implement every method with a completely different signature
- C. Each must provide its own concrete implementation of startEngine(), since Vehicle's version is abstract and cannot be used directly
- D. They inherit a working startEngine() and never need to override it
Correct answer: C. Each must provide its own concrete implementation of startEngine(), since Vehicle's version is abstract and cannot be used directly
A hollow-triangle generalization models inheritance (is-a). An abstract method has no body in the superclass, so every concrete subclass (Car, Truck) must supply its own implementation before it can be instantiated.
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
- Using basic COCOMO for a semi-detached project (E = 3 × KLOC^1.12 person-months), what is the estimated effort for a 45 KLOC project?
- A control flow graph has 28 edges and 20 nodes. What is its cyclomatic complexity?
- A control flow graph has 30 edges and 21 nodes, forming 2 disconnected components. What is its cyclomatic complexity?
- A control flow graph has 7 edges and 6 nodes. What is its cyclomatic complexity?
- A control flow graph has 31 edges and 22 nodes. What is its cyclomatic complexity?
- A control flow graph has 13 edges and 11 nodes. What is its cyclomatic complexity?