Object-Oriented Programming Principles Flashcards
6 cards from real IKM practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 Object-Oriented Programming Principles flashcards as text
What is polymorphism in OOP?
Answer: Different objects respond to the same method call differently
Polymorphism allows different classes to provide their own implementation of shared methods.
What is the Single Responsibility Principle?
Answer: A class should have only one reason to change
SRP means each class should have only one job or responsibility.
What is a design pattern?
Answer: Reusable solution template for common design problems
Design patterns are general, reusable solutions to commonly occurring problems.
What is the Observer design pattern?
Answer: Subject notifies dependents of state changes
Observer defines a one-to-many dependency where state changes trigger notifications.
What is the difference between shallow and deep copy?
Answer: Shallow copies references; deep copy recursively duplicates all nested objects
Shallow copy shares references to nested objects; deep copy creates independent copies at every level.
What is the Dependency Inversion Principle?
Answer: High-level modules should depend on abstractions, not low-level modules
DIP states both high and low-level modules should depend on abstractions.