Browse all practice questions for the Object‑Oriented Programming (OOP) Practice Test. Search by topic, open any question and review its full explanation, then test yourself in the practice quiz.

Object‑Oriented Programming (OOP) Practice Test course image
More practice questions

These questions are part of the practice quiz. Start practicing

  • What problem can arise from multiple inheritance in object-oriented design?
  • What is upcasting?
  • Which of the following best describes the Decorator pattern?
  • In UML class diagrams, what is the correct representation for aggregation vs composition?
  • Which SOLID principle encourages splitting large interfaces into smaller, specific ones?
  • I = 1 means a component is?
  • Which form of dependency injection passes dependencies via the constructor?
  • Which of the following is an example of runtime polymorphism in practice?
  • If two modules A and B depend on each other, what does that indicate in ADP terms?
  • Which statement correctly describes typical elements in a class diagram and how visibility is shown?
  • Which of the following is true about a class that implements an interface but does not implement all interface methods?
  • What is a Design Pattern?
  • What is a common strategy to break existing cyclic dependencies?
  • What is the core requirement of the Acyclic Dependencies Principle?
  • CCP is the component-level equivalent of which SOLID principle?
  • In Box<T>, what is T called?
  • Which pattern helps create immutable objects by assembling state at construction time?
  • If a class defines no constructor, what happens?
  • Which collection is used to map keys to values, ensuring key uniqueness?
  • Which operation helps determine if a dependency graph has a cycle?
  • When many other components depend on a given component, what design quality does that imply?
  • Java is primarily described as what type of programming language?
  • Which statement best describes encapsulation in object-oriented design?
  • Which statement is true about a class and interfaces in Java?
  • Which statement describes aggregation?
  • Which statement about an abstract class is true?
  • When using a Factory, what is a key way clients interact with produced objects?
  • Data Abstraction provides what to the outside world?
  • How many primitive data types are there in Java?
  • Three categories of Design Patterns?
  • Which SOLID principle does the Singleton pattern technically violate?
  • Why is it important to distinguish overloading and overriding when designing APIs?
  • Which statement best describes dependency injection?
  • What is downcasting?
  • What are generics and why are they important for type safety in OO languages?
  • Which operator checks class membership at runtime?
  • DIP: you should depend on what?
  • Formula for Instability (I)?
  • If a method declares throws IOException, what must a caller do?
  • In Java, reflection provides what capability at runtime?
  • Which scenario best illustrates the Observer pattern?
  • In terms of ADP, which statement is true about dependencies among modules?
  • What does the 'final' keyword do to a class field?
  • According to SRP, how many reasons to change should a class have?
  • CCP (Common Closure Principle) states?
  • Which statement about the nature of objects in Java is true according to the material?
  • What is encapsulation in object-oriented programming?
  • The 'enhanced for' loop is also known as?
  • Which statement about abstract classes and interfaces is true?
  • Which statement is true about the finally block?
  • How should equality and hashing be implemented in OO languages, and why must they be consistent?
  • The 'D' in SOLID stands for?
  • What is another name for Encapsulation?
  • CRP is the component-level equivalent of which SOLID principle?
  • REP (Reuse/Release Equivalence Principle) states?
  • Which coding approach helps maintain ADP in evolving codebases?
  • What is a primary benefit of programming to interfaces rather than concrete classes?
  • Which is a direct consequence of cycles in a dependency graph?
  • What should you do with 'fat' interfaces?
  • Which statement describes the Proxy pattern?
  • What is a constructor, and how do default and parameterized constructors differ?
  • Which block always executes after try-catch?
  • Which class is at the top of the Java exception hierarchy?
  • Which principle is associated with grouping changes that happen for the same reasons?
  • Which statement best describes the Diamond Problem?
  • Which practice aligns with ADP for module interfaces?
  • REP relationship statement?
  • Which tool technique helps verify acyclic dependencies in a codebase?
  • What is a typical sequence for refactoring a large class while preserving observable behavior?
  • In object-oriented design, which statement best describes composition?
  • How do you manually throw an exception?
  • What does Fan-in measure in component design?
  • Which exception is thrown on incorrect downcasting?
  • Which statement best describes the Liskov Substitution Principle in object-oriented design?
  • What is static binding?
  • Arrow token in a lambda expression?
  • Which approach supports swapping implementations at runtime to ease testing?
  • 'this' operator refers to?
  • What does immobility refer to in bad software design?
  • In class diagrams, how are relationships such as inheritance, association, aggregation, and composition typically represented?
  • Why should you place close() calls in a finally block when working with JDBC resources?
  • Compare composition and inheritance as design strategies and when to prefer composition?
  • In Aggregation, do the part and the whole survive independently?
  • How would you design an object oriented solution to compute areas for multiple shapes in a polymorphic way?
  • Which statement about dynamic dispatch is true?
  • Which technique best facilitates code reuse without rigid inheritance?
  • Fan-out is defined as which of the following?
  • What is the Diamond Problem?
  • Engine is a part of Car (Car owns Engine) — what relationship is this?
  • What are getters and setters?
  • What are common pitfalls of the Singleton pattern?
  • How do abstraction and encapsulation differ, and how do they complement each other?
  • Why must main() always be static?
  • Which loop is guaranteed to execute at least once?
  • Which statement about upcasting is true?
  • Encapsulation is defined as what?
  • In SOLID, which principle ensures substitutability of derived classes for base classes without altering correctness?
  • How many direct superclasses can a Java class have?
  • How does garbage collection work in managed languages and what are typical performance considerations?
  • In the SOLID design principles, what does the S stand for?
  • I = 0 means a component is?
  • What happens if a method in a subclass is annotated with @Override but its signature does not match any method in the base class?
  • What is the primary purpose of mocks and stubs in unit testing?
  • Which JDBC object represents a set of rows returned by a query?
  • What does JDBC stand for?
  • In Java, what is the blueprint from which objects are created?
  • What does the 'I' in SOLID stand for?
  • Which statement best describes a lambda expression?
  • What does the term polymorphism literally mean?
  • Which access modifier restricts access to the same class only?
  • What is a direct superclass?
  • What is a benefit of using the Composite pattern in client code?
  • The 'final' keyword on a method prevents what?
  • Generics allow a single class or method to operate on different types, avoiding what?
  • In SOLID, what does the L stand for?
  • How many interfaces can a class implement?
  • Data Abstraction is described as?
  • Method Overloading — what type of polymorphism?
  • If ADP is violated, what is a common consequence?
  • Which of the following best describes where a static member belongs?
  • Which statement describes the Command pattern?
  • How should you design custom exception types in OO languages?
  • What is an indirect superclass?
  • Template Method pattern with a concrete scenario.
  • Which statement correctly describes method overloading?
  • Which JDBC class is used to execute parameterized SQL queries securely?
  • What is the Builder pattern for?
  • In Java, reflection enables what capability at runtime?
  • Serialization is used to convert objects into a byte stream. Which concerns are commonly considered when making a class serializable?
  • Which keyword establishes inheritance (is-a relationship)?
  • In a generic class, what happens to type parameter when instantiated?
  • Which practice helps prevent cycles in a dependency graph?
  • To whom does a static field or method belong?
  • Which Statement method is used to execute a SELECT query?
  • What does Fan-out measure in component design?
  • In Box<T>, what is T?
  • Factory pattern advantage regarding coupling?
  • Which statement best captures the Liskov Substitution Principle?
  • What cannot be declared abstract in Java?
  • Which access modifier allows access in the same package and subclasses?
  • Why are unit tests and test doubles important in object-oriented development?
  • Which statement best describes design patterns?
  • Which construct creates a new object by copying state from an existing object using a constructor?
  • Which statement best describes the Factory Method pattern?
  • What is a key benefit of the Composite pattern?
  • Which method returns the Class object for an instance?
  • Fan-in is defined as which of the following?
  • Interface methods (pre-Java 8) are implicitly?
  • In the context of the Singleton pattern, what kind of access point is typically provided?
  • Which method finalizes the object in the Builder pattern?
  • In Java, default methods were added to interfaces in which version?
  • Which statement correctly describes Iterable?
  • What is encapsulation primarily protecting?
  • If a class has at least one abstract method, the class must be?
  • How do interfaces enable polymorphism and support dependency injection?
  • Which package contains the JDBC API?
  • Can you instantiate an abstract class?
  • What is an abstract method?
  • What is typically overridden by subclasses in the Template Method pattern?
  • What is the relationship between ADP and Dependency Inversion Principle (DIP)?
  • What do Generics allow programmers to avoid?
  • Interface fields are implicitly what?
  • When making a class serializable, which concern is commonly addressed?
  • Which SOLID principle is about depending on abstractions rather than concretions?
  • Explain the Single Responsibility Principle with a concrete example.
  • Which option represents a form of data hiding related to encapsulation?
  • What does executeQuery() return when called on a Statement?
  • Which statement about abstract methods is true?
  • Method Overriding — what type of polymorphism?
  • What is a common purpose of the Proxy design pattern?
  • Which class is considered the cosmic superclass in Java?
  • Which statement correctly demonstrates throwing a new exception in Java?
  • How does the Decorator pattern differ from inheritance?
  • Which statement best describes the Strategy pattern?
  • Which keyword is used to declare that a method may throw a checked exception?
  • Which statement about the relationship between classes and objects is correct?
  • Which of the following describes checked vs unchecked exceptions?
  • What are common OO code smells, and how can refactoring address them?
  • What is a key advantage of using PreparedStatement over Statement?
  • The 'Zone of Uselessness' refers to which combination?
  • Which statement best describes the Composite design pattern?
  • Which statement describes the Adapter pattern?
  • What is the difference between an abstract class and an interface, and when would you use each?
  • What is the distinction between static members and instance members?
  • What is covariance and contravariance in generics, and how do they affect type safety?
  • Which JDBC object is responsible for managing database drivers?
  • What is the purpose of the Adapter pattern?
  • The 'Zone of Pain' refers to which combination of abstraction and instability?
  • Which interface enables traversal without exposing the underlying structure of a collection?
  • What is an exception in Java?
  • Which SOLID principle is violated when a subclass inherits a method it cannot use?
  • Which of the following is a primitive data type in Java?
  • If a class has only a parameterized constructor and you attempt to instantiate with no arguments, what happens?
  • In JDBC, how do you advance to the next row in a ResultSet?
  • What is the access modifier of the Singleton's constructor?
  • In Composition, does the part survive without the whole?
  • Where must super() be placed in a subclass constructor?
  • Which description best matches the Builder's goal?
  • Under ADP, is it possible for a module to depend on many services as long as there are no cycles?
  • Which collection guarantees unique elements with no duplicates?
  • What are software 'components'?
  • Which statement best captures the Liskov Substitution Principle?
  • What must a method declare if it can throw a checked exception it doesn't catch?
  • What does immutability mean in object design, and what are its benefits?
  • What is the Open/Closed Principle and how can you implement it in OO design?
  • Which statement describes the Object class in Java?
  • Which collection type is ordered and allows duplicates?
  • How do the four access levels public, protected, private, and package-private differ in common OO languages?
  • A component with high fan-in is typically characterized by which property?
  • According to the Open-Closed Principle, how should a class be designed?
  • In object-oriented design, what outcome is achieved by high cohesion and low coupling?
  • Which of the following is a reference type?
  • What is method overriding and how does the @Override annotation assist?
  • Objects from Factory are accessed through?
  • Which statement describes the Zone of Uselessness?
  • What is a lambda expression?
  • Is String a primitive type in Java?
  • CRP (Common Reuse Principle) states?
  • What happens if you don't define a constructor?
  • Distinguish static (compile-time) polymorphism from dynamic (runtime) polymorphism with examples.
  • Which statement best describes the primary advantage of using composition over inheritance?
  • What is method overloading, and how does the compiler choose which method to call?
  • What is a destructor/finalizer, and how is resource cleanup typically handled in managed languages?
  • In (int x, int y) -> x + y, what is 'x + y'?
  • Car has a Driver — what type of OOP relationship is this?
  • What are the key components of the Command pattern?
  • What is the Liskov Substitution Principle and how does it guide subclassing?
  • Explain the difference between inheritance and composition and when to prefer each.
  • If you declare any constructor, what happens to the default no-argument constructor?
  • What does statically-typed mean in Java?
  • What does the Singleton pattern guarantee?
  • What is a common benefit of enforcing ADP?
  • Which principle focuses on dependency inversion by relying on abstractions rather than concrete implementations?
  • Which architectural approach can help prevent cyclic dependencies by decoupling components?
  • Differentiate shallow copy from deep copy, and give examples of when each is appropriate.
  • Which statement best characterizes fragility in bad software design?
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy