CS FundamentalsVery hardGATE CS · TCS NQT Prime · Product Company SDE
A text editor needs to render a document containing a million characters without creating a million separate heavyweight glyph objects, by sharing the common, immutable parts of similar objects. Which pattern addresses this memory concern specifically?
- A. Flyweight pattern
- B. Observer pattern
- C. Prototype pattern
- D. Singleton pattern
Correct answer: A. Flyweight pattern
Flyweight shares as much intrinsic (context-independent) state as possible between many fine-grained objects, drastically cutting memory use when a huge number of similar objects would otherwise be needed.
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 does git log --graph --oneline --all help a developer see that a plain git log does not as clearly?
- Why are automated tests considered essential to a healthy CI/CD pipeline, rather than optional?
- A function has 2 independent input variables, each with its own valid range. Using standard (non-robust) BVA, varying one variable at a…
- A requirement states 'the system shall be user-friendly.' What is the main problem with this requirement as written?
- What does git cherry-pick <commit> do?
- A PERT activity has optimistic time 5 days and pessimistic time 15 days. What is its standard deviation, SD = (P − O) / 6?