Free Practice Quiz Question List

8 Object-Oriented Design Online Quiz Questions

Use this free practice quiz with 20 questions to review 8 Object-Oriented Design, test your knowledge, and prepare for your next test or exam.

20 questions
01
Choose one
1 point

Which statement best distinguishes a class from an object?

  1. A

    An object is a reusable contract, while a class is one runtime instance.

  2. B

    A class defines shared structure and behavior, while an object is a particular instance.

  3. C

    A class can exist only after an object has been created.

  4. D

    A class is always a database record, while an object is always a method.

02
Choose all
1 point

Which two benefits are associated with composition rather than implementation inheritance? Select all that apply.

  1. A

    It guarantees that no additional objects or delegation will be needed.

  2. B

    It can allow a collaborator to be replaced at runtime.

  3. C

    It can simplify testing by using substitute collaborator objects.

  4. D

    It requires every collaborator to inherit from the containing class.

03
True or false
1 point

True or false: The controller guideline recommends placing all application-level coordination directly in low-level data objects.

  1. A

    True

  2. B

    False

04
Written response
1 point

What design principle places behavior that varies by type behind a common interface so clients can avoid scattered type checks?

05
Fill in the blank
1 point

Complete the statement: Assign behavior to the object that has the information needed to perform it; this is the guideline.

06
Choose one
1 point

Which design most clearly demonstrates high cohesion?

  1. A

    A PasswordHasher that only hashes passwords

  2. B

    A UserManager that hashes passwords, sends email, writes audit logs, and formats reports

  3. C

    A class that directly constructs a database driver and formats user messages

  4. D

    A service that combines unrelated reporting, payment, and configuration tasks

07
Choose all
1 point

Which two practices help limit coupling between modules? Select all that apply.

  1. A

    Depend on stable abstractions.

  2. B

    Make every module know the internal representation of its collaborators.

  3. C

    Pass only necessary information between modules.

  4. D

    Eliminate every collaboration between modules.

08
True or false
1 point

True or false: Introducing a ShippingStrategy interface so that new shipping strategies can be added without rewriting the existing checkout algorithm is an example of the Open–Closed Principle.

  1. A

    True

  2. B

    False

09
Written response
1 point

According to the Single Responsibility Principle as stated in the material, how many primary reasons to change should a class have?

10
Fill in the blank
1 point

Complete the statement: When CheckoutService depends on PaymentGateway rather than directly on a payment vendor, the design illustrates the .

11
Choose one
1 point

A device application has clients that print, scan, or fax, but most clients use only one capability. Which redesign best applies the Interface Segregation Principle?

  1. A

    Require every device to implement one comprehensive OfficeMachine interface.

  2. B

    Put all device behavior in a single base class.

  3. C

    Separate Printable, Scannable, and Faxable capabilities into focused interfaces.

  4. D

    Expose every possible operation through a universal service interface.

12
Choose one
1 point

Which situation most directly indicates a violation of the Liskov Substitution Principle?

  1. A

    A subtype adds a specialized operation that clients may optionally call.

  2. B

    A subtype throws an exception for an operation that clients validly expect from the supertype.

  3. C

    A subtype delegates an operation to a separate collaborator.

  4. D

    A subtype changes its internal data representation while preserving its contract.

13
Open ended
1 point

An InvoiceService currently calculates invoice totals, formats invoices as PDFs, sends email, and writes audit logs. Using the responsibility-assignment, cohesion, coupling, and SOLID guidance from the material, propose a redesign. Explain how all four responsibilities should be separated or coordinated, where focused collaborators or meaningful abstractions would be useful, and how you would test the result without coupling tests to private implementation details.

14
Choose one
1 point

A checkout system must support several shipping algorithms that may be replaced or tested independently. Which design choice best follows the material's guidance?

  1. A

    Use inheritance because any shared code automatically establishes a sound subtype relationship.

  2. B

    Use composition with an injected strategy because shipping behavior can vary independently.

  3. C

    Avoid all abstractions and place every shipping rule in the checkout method.

  4. D

    Create a deep inheritance hierarchy for each combination of destination and shipping speed.

15
Choose one
1 point

Which statement correctly distinguishes a class from an object?

  1. A

    A class is a particular runtime instance, while an object defines shared behavior.

  2. B

    A class defines shared structure and behavior, while an object is a particular instance.

  3. C

    A class is always an interface, while an object is always a subclass.

  4. D

    A class stores only data, while an object stores only operations.

16
Choose one
1 point

A bank account must never allow a withdrawal that exceeds its available balance. Which design best applies encapsulation?

  1. A

    Expose the balance as a public field so callers can update it directly.

  2. B

    Move all account behavior into the user-interface layer.

  3. C

    Expose a withdrawal operation that validates whether the balance can support it.

  4. D

    Replace the account object with a collection of unrelated utility functions.

17
Choose one
1 point

When is inheritance the most defensible design choice?

  1. A

    Use inheritance when the proposed subtype genuinely satisfies the behavioral contract of the supertype.

  2. B

    Use inheritance whenever two classes have at least one field with the same name.

  3. C

    Use inheritance whenever it avoids duplicating any small piece of code.

  4. D

    Use inheritance whenever the subclass needs to disable an operation supported by the superclass.

18
True or false
1 point

True or false: The Single Responsibility Principle requires every class to contain only one method.

  1. A

    True

  2. B

    False

19
Written response
1 point

What design term describes how closely the responsibilities of a module belong together?

20
Written response
1 point

Which SOLID principle says that a subtype should be usable wherever its supertype is expected without breaking valid client assumptions?