Free Practice Quiz Question List

9 Designing Object-Oriented Systems Online Quiz Questions

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

20 questions
01
Choose one
1 point

Which statement best describes encapsulation in object-oriented design?

  1. A

    It requires every field to have a public getter and setter.

  2. B

    It combines state and behavior while controlling access to implementation details.

  3. C

    It means that all objects in a system must inherit from one base class.

  4. D

    It replaces all collaborations between objects with one central controller.

02
Choose one
1 point

A library system defines a LibraryMember class and then creates a member for ID M-104. Which statement correctly distinguishes the class from the created member?

  1. A

    A class is a blueprint, while an object is a particular runtime instance.

  2. B

    A class is always a runtime instance, while an object is a source-code template.

  3. C

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

  4. D

    A class can have no operations, while every object must have public fields.

03
Choose one
1 point

A checkout component should work with either an email notifier or an SMS notifier without changing its own code. What is the main design benefit of depending on a NotificationService interface?

  1. A

    It stores all notification messages inside the checkout component.

  2. B

    It forces every notification provider to use identical internal data structures.

  3. C

    It lets the checkout component depend on a capability without depending on a concrete provider.

  4. D

    It makes notification failures impossible.

04
Choose all
1 point

Which two practices support a sound use of inheritance? Select all correct choices.

  1. A

    Use inheritance when the derived type genuinely is a kind of the base type.

  2. B

    Use inheritance whenever it avoids duplicating even a few lines of code.

  3. C

    Check whether every proposed subtype can honor the base type's expectations.

  4. D

    Use inheritance to make replaceable notification services easier to swap at runtime.

05
Choose all
1 point

Which two benefits are directly associated with using composition and dependency injection in a library system? Select all correct choices.

  1. A

    It guarantees that no interfaces are needed.

  2. B

    It allows components to be replaced independently.

  3. C

    It requires every collaborator to be a subclass of the containing object.

  4. D

    It supports testing with substitutes such as a fake notification service.

06
True or false
1 point

True or false: In an encapsulated object-oriented design, every private field should have both a public getter and a public setter.

  1. A

    True

  2. B

    False

07
True or false
1 point

True or false: Polymorphism is always preferable to a conditional, even when there are only two stable cases and the behavior is simple.

  1. A

    True

  2. B

    False

08
Written response
1 point

What design concept allows code to call feePolicy.calculate(loan, today) through one abstraction while different policy objects provide different implementations?

09
Written response
1 point

A member already has the maximum number of active loans allowed by the system. How many additional books should the member's canBorrow() decision permit under that rule? Enter a whole number.

10
Fill in the blank
1 point

combines state and behavior while controlling access to implementation details, helping an object protect its internal .

11
Fill in the blank
1 point

A Library contains a catalog and uses checkout and notification services. This is an example of .

12
Open ended
1 point

A checkout workflow must prevent a member from exceeding the borrowing limit. Explain which object should own that rule, what a checkout coordinator should do, and why this division improves the design.

13
Choose one
1 point

A library initially sends due-date reminders by email, but configuration may later select SMS and tests need a fake notifier. Which design is most appropriate?

  1. A

    Define a focused notification contract and inject an implementation into the checkout component.

  2. B

    Make CheckoutService inherit from both the email and SMS notification classes.

  3. C

    Expose the checkout component's notification fields publicly so callers can replace them.

  4. D

    Put email and SMS conditionals in every class that needs to send a reminder.

14
Choose one
1 point

A library system needs a checkout workflow involving a member, a book, a loan, and a notification provider. Which design best follows the material's guidance about coordinating use cases and protecting domain rules?

  1. A

    Put every checkout rule in CheckoutService so domain objects remain passive.

  2. B

    Let CheckoutService coordinate the workflow while Member and Loan enforce their own rules.

  3. C

    Put all checkout behavior in Catalog because it knows which books are available.

  4. D

    Let NotificationService create the loan and enforce the member's borrowing limit.

15
True or false
1 point

True or false: Composition is often preferable to inheritance when a class needs replaceable policies or services that can be supplied independently.

  1. A

    True

  2. B

    False

16
Choose one
1 point

Which option best describes the role of an interface in an object-oriented design?

  1. A

    A contract of operations that implementing classes promise to provide

  2. B

    A storage structure that records every concrete class in the system

  3. C

    A superclass that automatically supplies all implementation code

  4. D

    A controller that coordinates every use case in the application

17
Choose one
1 point

A system has email, SMS, and audit components with overlapping but not identical capabilities. Which interface design best follows the material's guidance?

  1. A

    Create one very broad interface so every service shares the same complete API.

  2. B

    Avoid interfaces because concrete classes are always easier to test.

  3. C

    Use several small interfaces when clients or implementers need different coherent capabilities.

  4. D

    Require every implementing class to provide all operations used anywhere in the system.

18
Written response
1 point

A checkout component calls feePolicy.calculate(loan, today) through a common contract, while different policy objects calculate different fees. What design term names this technique?

19
Choose one
1 point

Which example best demonstrates dependency injection in a checkout service?

  1. A

    CheckoutService always constructs a concrete email provider inside its checkout method.

  2. B

    CheckoutService stores every possible notification implementation and selects one with a large conditional.

  3. C

    CheckoutService inherits from both FeePolicy and NotificationService to reuse their code.

  4. D

    CheckoutService receives a fee policy and notification service as dependencies when it is created.

20
Written response
1 point

A library design places overdue-fee calculation, rather than unrelated checkout coordination, in a focused fee-policy component. What design quality describes keeping closely related responsibilities together?