Question 1
Fan-in is defined as which of the following?
Correct Answer:
Incoming dependencies from outside to inside
Explanation:
Fan-in describes how many external components rely on a given module; it counts incoming dependencies from outside to inside. This matches the idea that many other parts of the system depend on this module, so its change impact spans those dependents. If a module is used by many others, it has high fan-in, which can make changes riskier because breaking it could affect many callers. In contrast, fan-out refers to how many external components a module itself depends on (outgoing dependencies), not how many depend on it. The total number of interfaces measures how many entry points the module exposes, and the number of public methods reflects API size, not dependency direction. For example, if a module is used by three other modules, its fan-in is three; if it calls two other modules, that’s its fan-out.
Question 2
Template Method pattern with a concrete scenario.
Correct Answer:
Base class defines the algorithm skeleton; subclasses override specific steps.
Explanation:
The Template Method pattern centers on defining the overall algorithm in a base class as a fixed sequence (the template), while letting subclasses supply the concrete steps. The base class provides the skeleton of the algorithm—a template method that calls several steps in a specific order—and some of those steps are abstract (or have default behavior) so subclasses can customize them. This arrangement lets the common workflow stay consistent across different implementations, while the varying parts are encapsulated in the subclass overrides. That’s why the best description is: the base class defines the algorithm skeleton and subclasses override specific steps. It preserves the overall structure while enabling customization where needed. The idea isn’t to let subclasses dictate the entire sequence, nor to override every behavior, nor to rely on object creation to implement the steps—that would point to different patterns like Strategy, Factory, or Builder, not Template Method.
Question 3
What should you do with 'fat' interfaces?
Correct Answer:
Expose them through adapters
Explanation:
A fat interface packs many methods into one contract, which makes every client depend on more functionality than it actually needs. Exposing that interface through adapters is a practical way to give each client a lean, tailored surface while keeping the heavy interface intact behind the scenes. The adapter translates the smaller, client-focused calls into the appropriate calls on the fat interface, so clients don’t have to learn or depend on all those methods. This approach preserves backward compatibility with existing code, localizes changes to the adapter, and makes it easier to evolve the underlying API over time. In contexts where you can’t or don’t want to refactor the interface itself, using adapters provides a clean separation between what a client uses and how the system implements the fat interface. Splitting into smaller interfaces is another valid strategy in many cases, but adapters specifically address the need to present a usable surface without forcing a broad redesign.
Question 4
Generics allow a single class or method to operate on different types, avoiding what?
Correct Answer:
Rigid, hard-coded type definitions — one class/method works for many types
Explanation:
Generics let you write a single class or method that can work with many different types without tying the code to one specific type. The main win is avoiding rigid, hard-coded type definitions so one class or method can operate over many types. Without generics, you’d end up duplicating code for each type or resorting to using a general Object type with casts, which undermines type safety and makes maintenance harder. With generics, you declare a type parameter and apply it to different types, preserving type safety while keeping the implementation reusable. Some runtime checks or null handling may still occur in certain situations, but the essential benefit is the flexibility to support many types with a single, type-safe implementation.
Question 5
Encapsulation is defined as what?
Correct Answer:
Wrapping data and methods together as a single unit + data hiding
Explanation:
Encapsulation means bundling the object’s data with the methods that operate on that data into a single unit, and restricting direct access to the internal state. In practice, you hide the internal fields (make them private) and expose a controlled interface (methods) to interact with the object. This protects invariants, reduces coupling, and lets you change the implementation later without breaking external code. That’s why the description of wrapping data and methods together as a single unit plus data hiding is the best match. The other ideas describe different concepts: the first is inheritance, exposing all fields publicly breaks encapsulation, and interfaces alone don’t define encapsulation.
Question 1
Exam overview

About this Exam

Prepare with the Object‐Oriented Programming (OOP) Practice Test practice quiz. This question bank includes 10 questions covering defined, method, pattern, interfaces, and object. Use it to review important concepts, identify knowledge gaps, and build confidence for the related exam, course, or assessment.

More details

Additional Information

Object‐Oriented Programming (OOP) Practice Test

This practice set contains 10 questions from the matching question bank and focuses on defined, method, pattern, interfaces, and object. Work through each question carefully, review the provided solutions, and revisit topics that need more study before your next attempt.

This is an independent study resource intended for practice and review; it is not an official examination or an endorsement by any organization named in the title.

Quiz information

Frequently Asked Questions

The complete question count is available after full access is unlocked.
No fixed duration is currently configured for this quiz.
Question explanations are included where they are available in the quiz content, helping you review the reasoning after answering.
Yes. You can retake the practice test again as you continue studying during your available access period.
After your access is confirmed, you can continue into the complete practice exam from this quiz flow.
Unless explicitly stated otherwise, this page provides independent practice material for study and exam preparation and is not the official examination itself.
Keep studying

Related Questions