CS FundamentalsHardGATE CS · TCS NQT Prime · Product Company SDE
A base class defers the decision of exactly which concrete subclass to instantiate to its subclasses, by exposing a creation method that subclasses override to return their own type. This is:
- A. Singleton pattern
- B. Builder pattern
- C. Abstract Factory pattern
- D. Factory Method pattern
Correct answer: D. Factory Method pattern
Factory Method defines a creation method in a base class that subclasses override to decide which concrete product to instantiate, letting the base class's algorithm stay independent of concrete types.
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
- What is the difference between 'verification' performed via a static code review (e.g. a peer reading the diff) and verification performed…
- Using Basic COCOMO for a embedded mode project (Effort = 3.6 × (KLOC)^1.2 person-months), what is the estimated effort for a 40 KLOC…
- A UI toolkit must produce whole FAMILIES of related objects (e.g. matching Button, Checkbox and Scrollbar for either a 'dark theme' or…
- A UML activity diagram is best suited for modelling:
- A system accepts a value from 18 to 98 inclusive. Using equivalence partitioning, what is the minimum number of test cases needed to cover…
- What distinguishes Continuous Delivery from Continuous Deployment?