0% found this document useful (0 votes)
3 views2 pages

SOLID Principles Practice Questions

Uploaded by

Alia Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

SOLID Principles Practice Questions

Uploaded by

Alia Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Practice Coding Questions for SOLID Principles

1. Library Management System


Create a program for managing books in a library. The program should allow users to:
- Add a book with details like title, author, and genre.
- Remove a book by its ID.
- Search for books by title or author.
- Generate reports about the library, such as the number of books in each genre.

Ensure that the program is easy to extend if new features are added, such as tracking book
borrowing.

2. Payment Gateway
Design a system for processing payments. The program should:
- Support Credit Card and PayPal payment methods.
- Allow new payment methods (e.g., Google Pay) to be added without modifying existing
code.

Implement a class hierarchy to achieve this.

3. Shape Drawing
Create a program for a drawing tool. The tool should support drawing shapes like circles,
rectangles, and triangles.
- Each shape should have methods to calculate its area and perimeter.
- Add support for new shapes without changing the existing classes.

4. Vehicle Management
Implement a class hierarchy for vehicles.
- The base class should represent a generic vehicle with attributes like speed and fuel.
- Derived classes should include `Car`, `Bicycle`, and `ElectricCar`.
- Extend the system to add new vehicle types like `Truck` or `Motorcycle` without breaking
the existing code.

5. Printer System
Create an interface for a printer that supports the following operations:
- Printing documents.
- Scanning documents.
- Sending faxes.

Implement different classes for:


- A multi-functional printer that supports all operations.
- A basic printer that only supports printing.
6. Notification System
Design a notification system that can send messages via different channels like Email and
SMS.
- Implement the system in such a way that adding new notification channels (e.g., Push
Notification) doesn’t require modifying existing code.

7. E-Commerce System
Build a program for an e-commerce platform to manage products and orders. The program
should:
- Allow customers to browse products and add them to a cart.
- Handle discounts for different product categories.
- Process payments through multiple payment gateways.

8. Employee Management
Design a system for managing employees in an organization.
- Employees can be full-time, part-time, or freelancers.
- Each type of employee has different ways of calculating salaries.
- Ensure that the program is easy to extend when new employee types are added.

9. Restaurant Ordering System


Develop a system for a restaurant.
- The system should allow customers to place orders.
- Different menu items have different preparation times and prices.
- Extend the system to add features like table reservations without changing existing code.

10. Content Management System


Create a program to manage content for a blog platform.
- Users can create, edit, and delete posts.
- Posts can be of different types, such as text, image, or video posts.
- Ensure new post types can be added without modifying the existing system.

You might also like