All the question will be based on all the design pattern we have covered so far.

Question 1

You are building an application that supports multiple payment methods such as Credit Card, UPI, and PayPal. The payment algorithm should be selected at runtime based on the user’s choice.

Which design pattern is most appropriate here, and why?


Question 2

You are building a stock trading application. Whenever the stock price changes, all subscribed investors should automatically receive notifications.

Which design pattern is most appropriate here, and why?


Question 3

You are building a coffee ordering application. A customer can order a coffee and optionally add milk, sugar, whipped cream, or chocolate without modifying the base coffee class.

Which design pattern is most appropriate here, and why?


Question 4

You are building an expense dashboard application. The system requires a single shared configuration manager throughout the application. Creating multiple configuration manager instances could cause inconsistencies.

Which design pattern is most appropriate here, and why?


Question 5

You are building a custom collection framework.

Clients should be able to traverse elements without knowing whether the collection is backed by an array, linked list, or tree.

Which design pattern is most appropriate here, and why?


Question 6

Your application needs to integrate a legacy payment gateway. The gateway’s interface is incompatible with your application’s payment interface.

Which design pattern is most appropriate here, and why?


Question 7

You are building a computer startup module. Starting a computer requires interacting with CPU, RAM, Hard Drive, BIOS, and Operating System components. You want to provide a simple method called startComputer().

Which design pattern is most appropriate here, and why?


Question 8

You are developing a cross-platform UI framework. The application should support Windows and Mac components such as Buttons, Checkboxes, and TextBoxes. You must ensure that components from different families are not mixed.

Which design pattern is most appropriate here, and why?


Question 9

You are building a vehicle manufacturing system. Creating a car involves multiple optional configurations such as engine type, color, transmission, and sunroof. The construction process should remain flexible.

Which design pattern is most appropriate here, and why?


Question 10

You are building an approval workflow system. Purchase requests should pass through Manager, Director, and CEO approval levels. Each approver may approve the request or forward it to the next approver.

Which design pattern is most appropriate here, and why?


Question 11

You are building a file explorer application. A folder can contain files and other folders. The client should be able to perform operations such as display() on both files and folders in the same way.

Which design pattern is most appropriate here, and why?


Question 12

You are building a vending machine application. The machine behaves differently depending on whether it has no coin, has a coin, or is dispensing an item. The behavior should change automatically based on the current state.

Which design pattern is most appropriate here, and why?


Question 13

You are building an image viewer application. Loading large images is expensive, so images should only be loaded when the user actually opens them.

Which design pattern is most appropriate here, and why?


Question 14

You are building a game containing millions of trees. Most trees share the same texture, model, and color information, while only their positions differ. Memory usage must be minimized.

Which design pattern is most appropriate here, and why?


Question 15

You are building a mathematical expression evaluator. The application should be able to evaluate expressions such as:

5 + 10 - 3

using a defined grammar structure.

Which design pattern is most appropriate here, and why?


Question 16

You are building a chat application. Instead of users communicating directly with each other, all communication should pass through a central chat room object.

Which design pattern is most appropriate here, and why?


Question 17

You are building a text editor. Users should be able to save snapshots of the document and restore previous versions using Undo and Redo operations.

Which design pattern is most appropriate here, and why?


Question 18

You are building a game where creating a character requires loading expensive assets such as animations, textures, and weapons. Many similar characters need to be created quickly.

Which design pattern is most appropriate here, and why?


Question 19

You are building a document management system. The application contains PDF, Word, and Excel documents. New operations such as virus scanning, metadata extraction, and exporting should be added without modifying the document classes.

Which design pattern is most appropriate here, and why?


Question 20

You are building a remote control application. Every button click should be represented as an object so that commands can be logged, queued, and undone.

Which design pattern is most appropriate here, and why?


Question 21

You are building a document processing system containing:

PDFDocument
WordDocument
ExcelDocument

New operations such as printing, exporting, and virus scanning are frequently added. However, a new document type such as PowerPointDocument has been introduced.

Which design pattern will require modifications to all existing operation implementations when a new document type is added, and why?


Question 22

You are building an e-commerce application. Customers can choose different discount algorithms such as:

  • Festival Discount
  • Premium Customer Discount
  • Seasonal Discount The discount calculation should be selected by the client at runtime.

Which design pattern is most appropriate here, and why?


Question 23

You are designing an image loading framework. A wrapper object should control access to the real image and load it only when required. The wrapper implements the same interface as the real image.

Which design pattern is most appropriate here, and why?


Question 24

You are building a text editor. Users should be able to Undo and Redo document changes. The editor must store snapshots of previous states and restore them when required.

Which design pattern is primarily responsible for storing and restoring state, and why?


Question 25

You are building a stock market application. Whenever a stock price changes, thousands of investors should automatically receive updates. The system follows a publish-subscribe model.

Which design pattern is most appropriate here, and why?


Question 26

You are building a report generation framework. Every report follows the same workflow:

Load Data
   ↓
Process Data
   ↓
Generate Report

However, different report types implement the processing logic differently.

Which design pattern is most appropriate here, and why?


Question 27

You are building a graphics framework. Shapes such as Circle and Rectangle should support multiple rendering engines:

OpenGL
DirectX
Vulkan

Both hierarchies should evolve independently.

Which design pattern is most appropriate here, and why?


Question 28

You are building an ORM framework. Large related objects should not be loaded from the database until they are actually accessed.

Which design pattern is most appropriate here, and why?


Question 29

You are developing a cross-platform UI toolkit. The framework exposes methods such as:

createButton()
createCheckbox()
createTextBox()

Different factories produce Windows, Mac, and Linux components.

Which design pattern is most appropriate here, and why?


Question 30

You are building a file system explorer. The structure is represented as a tree:

Folder
 ├── File1
 ├── File2
 └── SubFolder

Operations such as calculating size, searching, and printing should be added without modifying the File and Folder classes.

Which combination of design patterns is most appropriate here, and why?