CS FundamentalsHardProduct-company MCQ pattern

A text editor needs to support thousands of on-screen Character objects efficiently. Most of a Character's data (font, size, color) is shared across many characters with the same formatting, while only position differs per character. Which pattern reduces memory by sharing the common, immutable formatting data across instances?

  1. A. Flyweight
  2. B. Prototype
  3. C. Singleton
  4. D. Proxy

Correct answer: A. Flyweight

Flyweight separates intrinsic (shared, immutable) state like font/size/color from extrinsic (per-instance) state like position, storing shared state once and referencing it from many lightweight objects — exactly the massive-character-count memory optimisation described.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic