CS FundamentalsHardGATE CS · TCS NQT Prime · Product Company SDE
A graphics application needs to create a new shape by copying an existing, fully-configured one (rather than re-specifying every property from scratch), including cases where the exact concrete class isn't known at compile time. Which pattern fits?
- A. Composite pattern
- B. Prototype pattern
- C. Builder pattern
- D. Factory Method pattern
Correct answer: B. Prototype pattern
Prototype clones an existing, already-configured object to produce a new one, which is useful exactly when creating a fresh instance from scratch would be expensive or when the concrete type is only known at run time.
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 rolling deployment updates instances of a service:
- A long-lived feature branch has fallen far behind main, and its author wants a clean, linear history without the clutter of many…
- Two components with availability 99.0% and 98.0% are connected in series (the system works only if both are up). What is the system's…
- A control-flow graph has 14 edges, 8 nodes and 1 connected component. Using V(G) = E − N + 2P, what is its cyclomatic complexity?
- A PERT activity has optimistic time 2 days, most likely time 6 days and pessimistic time 9 days. What is its expected duration, Te = (O +…
- A developer deploys application code to a managed platform (e.g. a managed app-hosting service) that automatically handles the underlying…