In FAANG (Facebook, Apple, Amazon, Netflix, Google) companies, Object-Oriented Design (OOD) interviews typically focus on testing your ability to break down a system into objects, understand their relationships, and design a scalable and maintainable architecture. Here are some common OOD questions asked at FAANG companies:
1. Design a URL Shortener (like Bitly)
-
Prompt: Design a URL shortening service where users can input a long URL and receive a shorter version. Consider scalability, database design, and handling collisions.
-
Skills tested: Class design, hashing, scalability, database design, and edge cases.
2. Design a Parking Lot System
-
Prompt: Design a parking lot system where vehicles of different types (compact, electric, etc.) park in available spaces. The system should also handle payment and time tracking.
-
Skills tested: Class hierarchy, inheritance, polymorphism, system scalability, and resource management.
3. Design a Twitter-like System
-
Prompt: Design a system similar to Twitter where users can post tweets, follow other users, and get a stream of tweets from the users they follow.
-
Skills tested: Data structures (e.g., hash maps, queues), class design, and database scalability for handling large volumes of data.
4. Design a Book Reader System
-
Prompt: Design a book reading system where users can read books, bookmark pages, and have a history of the books they’ve read. It should support features like adding/removing books, and managing user preferences.
-
Skills tested: OOP principles, state management, and managing user preferences.
5. Design an Elevator System
-
Prompt: Design a system for controlling a set of elevators in a building with multiple floors. The system should allow users to call elevators and move them efficiently.
-
Skills tested: Class design, state machines, and algorithms for scheduling elevator movement efficiently.
6. Design a Social Media Platform
-
Prompt: Design a system where users can post content, like or comment on posts, follow other users, and manage privacy settings.
-
Skills tested: Class design, data consistency, privacy concerns, and performance (handling large datasets).
7. Design a Movie Rental System
-
Prompt: Design a system where users can rent movies, view their rental history, and receive recommendations. The system should support multiple categories of movies (e.g., new releases, classics).
-
Skills tested: OOP principles, relational databases, and user experience design.
8. Design a File System
-
Prompt: Design a file system with support for creating, reading, writing, and deleting files. Consider permissions, directories, and file attributes (e.g., read-only, hidden).
-
Skills tested: Hierarchical structure, file handling, access control, and concurrency.
9. Design a Shopping Cart System
-
Prompt: Design a system for an e-commerce shopping cart where users can add or remove items, view the total price, and check out.
-
Skills tested: Class design, state management, and handling of business rules (e.g., discounts, coupons).
10. Design an Online Voting System
-
Prompt: Design a secure online voting system where users can vote once, the system ensures the integrity of votes, and results can be tallied efficiently.
-
Skills tested: Security (e.g., preventing duplicate votes), system scalability, and ensuring data integrity.
11. Design a Chess Game
-
Prompt: Design a system for a chess game where players can move pieces, check for valid moves, and check/checkmate conditions.
-
Skills tested: Inheritance (e.g., different piece types), rules enforcement, state management, and event handling.
12. Design a Notification System
-
Prompt: Design a system to send notifications to users across different channels (e.g., SMS, email, app notifications) based on various events.
-
Skills tested: Event-driven architecture, observer pattern, and scalability in handling large volumes of notifications.
13. Design a Cache System
-
Prompt: Design a distributed caching system where data is stored temporarily to reduce load on the database. Implement cache eviction strategies like LRU (Least Recently Used).
-
Skills tested: Data structures (e.g., hash maps, linked lists), eviction strategies, and distributed systems.
14. Design an Inventory Management System
-
Prompt: Design a system to manage inventory in a warehouse, track stock levels, and handle orders.
-
Skills tested: Class design, state management, and algorithms for tracking inventory levels.
15. Design a Library Management System
-
Prompt: Design a system for managing a library’s books, allowing users to check out books, return them, and track overdue books.
-
Skills tested: Class design, database design, and handling user actions like borrowing and returning books.
16. Design a Payment System
-
Prompt: Design a payment gateway that processes transactions, stores user details securely, and handles payments through different methods (e.g., credit cards, PayPal).
-
Skills tested: Security (e.g., encryption, tokenization), transaction management, and multi-method integration.
17. Design a Notification Queue
-
Prompt: Design a system that manages a queue of notifications, ensuring that messages are sent to users in the correct order and delivered reliably.
-
Skills tested: Queues, reliability, message processing, and fault tolerance.
18. Design a URL Crawler
-
Prompt: Design a system that crawls websites, extracts links, and indexes the pages for search engines.
-
Skills tested: Web scraping, multithreading, and handling large amounts of data efficiently.
19. Design a Friend Recommendation System
-
Prompt: Design a system that recommends friends based on mutual connections, shared interests, or activity patterns.
-
Skills tested: Graph algorithms, data structures, and recommendation systems.
20. Design a Content Delivery Network (CDN)
-
Prompt: Design a CDN that caches content at edge locations to reduce latency for users requesting data.
-
Skills tested: Distributed systems, caching, and load balancing.
These questions require not just knowledge of object-oriented design principles but also the ability to consider scalability, maintainability, and performance. Practice breaking down systems into core components, identifying the responsibilities of each component, and thinking through potential edge cases.