1/77
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Encapsulation
One of the 4 pillars of OOP; wrapping data and methods inside a class; used to protect data and control access; advantages: improved security, easier maintenance; disadvantages: too much hiding can make debugging harder; recognized when classes expose public methods but hide fields.
Abstraction
Pillar of OOP; simplifying complexity by exposing only essential features; used to model complex systems; advantages: cleaner interfaces; disadvantages: may over-abstract; recognized when abstract classes/interfaces define behavior.
Inheritance
Pillar; allows a class to acquire properties of another; used to reuse code; advantages: reduces duplication; disadvantages: can create tight coupling; recognized when classes extend base classes.
Polymorphism
Pillar; ability of different objects to respond to same method differently; used to write flexible code; advantages: extensibility; disadvantages: harder to trace behavior; recognized in method overriding/interfaces.
Single Responsibility Principle (SRP)
Each class should have one reason to change; used to avoid bloated classes; advantages: maintainability; disadvantages: too many small classes; recognized when a class focuses on one task.
Open/Closed Principle (OCP)
Classes should be open for extension but closed for modification; used to add features without editing core code; advantages: safe extensions; disadvantages: risk of overuse; recognized via interfaces/abstract classes enabling extensions.
Liskov Substitution Principle (LSP)
Subclasses must be substitutable for base classes; used to ensure correct inheritance; advantages: safer hierarchy; disadvantages: rigid inheritance constraints; recognized when subclasses honor parent behavior.
Interface Segregation Principle (ISP)
Clients shouldn't depend on interfaces they don't use; used to create focused interfaces; advantages: clean contracts; disadvantages: more interfaces; recognized in small, purpose-specific interfaces.
Dependency Inversion Principle (DIP)
Depend on abstractions, not concretions; used to remove tight coupling; advantages: testability; disadvantages: more abstractions; recognized when high-level modules use interfaces.
Strategy Pattern
A behavioral pattern; defines a family of algorithms and lets them vary; used when behavior changes at runtime; advantages: flexible; disadvantages: more classes; recognized via interchangeable strategy objects.
Observer Pattern
Behavioral; observers subscribe to subject updates; used for event systems; advantages: loose coupling; disadvantages: cascade updates; recognized via notify/subscribe patterns.
Decorator Pattern
Structural; dynamically adds behavior to objects; used to avoid subclass explosion; advantages: flexible; disadvantages: many small objects; recognized when wrapping objects.
Adapter Pattern
Structural; converts one interface to another; used for integration; advantages: compatibility; disadvantages: extra layer; recognized when adapting incompatible interfaces.
Factory Pattern
Creational; centralizes object creation; used when creation logic is complex; advantages: flexibility; disadvantages: more code; recognized via factory classes/methods.
Singleton Pattern
Creational; ensures one instance; used for shared resources; advantages: global access; disadvantages: hidden dependencies; recognized via getInstance() and private constructors.
What OOP pillar is being used when a class hides its internal fields and exposes only getter/setter methods?
Encapsulation
What OOP pillar is this when a program simplifies a complex subsystem by exposing only essential operations?
Abstraction
What OOP pillar is shown when a subclass extends a base class and inherits its methods?
Inheritance
What OOP pillar is this when different objects implement the same interface and respond differently to the same method call?
Polymorphism
Which SOLID principle is violated when you find a class that handles logging, validation, and database access all at once?
Single Responsibility Principle (SRP)
Which SOLID principle is this when a new behavior must be added to a class, but instead of modifying the class, a new extension class is created?
Open/Closed Principle (OCP)
Which SOLID principle is broken when a subclass overrides a method but changes the expected behavior so the parent class can't be safely substituted?
Liskov Substitution Principle (LSP)
Which SOLID principle is violated when a class depends on an interface with 12 methods, even though it uses only 2 of them?
Interface Segregation Principle (ISP)
Which SOLID principle is violated when a high-level module depends directly on a low-level concrete class rather than an abstraction?
Dependency Inversion Principle (DIP)
Which design pattern should be used when you need to switch between different discount algorithms at runtime?
Strategy Pattern
Which pattern applies when multiple objects must be notified automatically when the state of another object changes?
Observer Pattern
Which pattern should you use when you need to add logging behavior to an object without modifying its original class?
Decorator Pattern
What pattern is this when a new library is incompatible with your application's interface, so you create a wrapper class?
Adapter Pattern
What pattern is this when object creation logic becomes complex and varied, so you centralize it in a dedicated creator class?
Factory Pattern
Which pattern is required when a particular configuration class must only ever have one instance used across an application?
Singleton Pattern
What OOP principle bundles data and methods into a single unit to protect data from outside interference?
Encapsulation
In Java, what keyword is used for fields to demonstrate encapsulation?
private
What OOP mechanism allows a subclass to derive properties and behavior from a superclass?
Inheritance
What is the term for the relationship between a Car class and a Vehicle class when Car inherits from Vehicle?
Is-A Relationship (or Inheritance)
What OOP principle allows objects of different classes to be treated as objects of a common type?
Polymorphism
What is method overloading a form of in OOP?
Polymorphism (Specifically Ad-Hoc/Static Polymorphism)
What OOP principle focuses on showing only essential information to the user?
Abstraction
What defines a contract for methods in OOP but provides no implementation?
Interface
What SOLID principle states that a class should have only one reason to change?
Single Responsibility Principle (SRP)
What SOLID principle is violated when a User class handles multiple responsibilities?
Single Responsibility Principle (SRP)
What SOLID principle states that software entities should be open for extension but closed for modification?
Open/Closed Principle (OCP)
To add a new payment processing method without modifying existing classes, which SOLID principle is followed?
Open/Closed Principle (OCP)
What SOLID principle states that objects should be replaceable with instances of their subtypes?
Liskov Substitution Principle (LSP)
What SOLID principle is violated if a Square class overrides a method from Rectangle class incorrectly?
Liskov Substitution Principle (LSP)
What SOLID principle is violated when a Robot class inherits from a Worker interface but does not need all methods?
Interface Segregation Principle (ISP)
What SOLID principle is adhered to by breaking down large interfaces into smaller, focused ones?
Interface Segregation Principle (ISP)
What SOLID principle suggests that high-level modules should not depend on low-level modules?
Dependency Inversion Principle (DIP)
What SOLID principle is followed when a class receives its dependencies from an external source?
Dependency Inversion Principle (DIP)
What two SOLID principles are implicated when a module is modified frequently?
Single Responsibility Principle (SRP) and Open/Closed Principle (OCP)
What is the core idea of the Dependency Inversion Principle?
High-level policy classes should interact with abstractions, not concretions.
What behavioral design pattern allows an object to change its behavior dynamically?
Strategy Pattern
What pattern should you use to select a shipping calculation method dynamically?
Strategy Pattern
What behavioral design pattern defines a one-to-many dependency between objects?
Observer Pattern
What pattern is ideal for notifying multiple user dashboards of price updates?
Observer Pattern
What structural design pattern allows behavior to be added to an individual object?
Decorator Pattern
What pattern allows flexible, runtime wrapping of attributes like 'Armor' and 'Power Boost'?
Decorator Pattern
What structural design pattern acts as a translator for incompatible classes?
Adapter Pattern
What pattern would bridge the gap between 'OldLogger' and 'ILogger' interface?
Adapter Pattern
What creational design pattern ensures a class has only one instance?
Singleton Pattern
What method is used in the Singleton pattern to prevent additional instances?
Making the constructor private
What must be addressed in multi-threaded environments when implementing the Singleton Pattern?
Thread Safety
What creational design pattern allows subclasses to alter the type of objects instantiated?
Factory Method Pattern (or just Factory Pattern)
What pattern would you use to defer the decision of which specific type to create?
Factory Method Pattern
Implementing the Strategy Pattern often helps enforce which SOLID principle?
Open/Closed Principle (OCP)
True or False: The Adapter Pattern changes the interface of an object.
True
True or False: The Decorator Pattern changes the responsibilities or behavior of an object.
True
What term is used to describe a larger architectural solution that combines two or more smaller, interacting design patterns to solve a recurring general design problem?
Compound Pattern (or Composite Pattern)
What compound pattern would you use to manage separation and synchronization of concerns in a GUI with frequently changing data?
Model-View-Controller (MVC)
What compound pattern should you choose to decouple presentation logic from business logic in a web application with multiple data formats?
Model-View-Controller (MVC)
What common architectural structure involves the View observing the Model for changes and the Controller using a Strategy for user input?
Model-View-Controller (MVC)
What compound architectural pattern separates an application into Model, View, and Controller?
Model-View-Controller (MVC)
What part of the MVC pattern manages the application's data and business logic?
Model
Which component in MVC acts as the intermediary for user input?
Controller
What component of MVC contains core domain objects and data access logic?
Model
What component in the MVC pattern handles user actions and modifies the Model?
Controller
What part of the MVC pattern is responsible for rendering the user interface?
View
Which MVC component acts only as the presentation layer without business logic?
View
In MVC, what component displays the user interface and sends actions to the Controller?
View