M&IB Devx - Oo Design

28 Questions | Total Attempts: 74

SettingsSettingsSettings
Please wait...
M&IB Devx - Oo Design

This is part of the DevX course assessment that will be taken by delegates before and after the programme.


Questions and Answers
  • 1. 
    Attributes are generally not visible to other objects of different classes in an application.
    • A. 

      True

    • B. 

      False

  • 2. 
    Inheritance is another name for delegation
    • A. 

      True

    • B. 

      False

  • 3. 
    Which of the following best describes the interface of an object?
    • A. 

      The subset of its public methods available to other methods

    • B. 

      All the methods of an object

    • C. 

      Another name for the constructor

    • D. 

      None of the above

  • 4. 
    Which of the following best describes Encapsulation?
    • A. 

      Placing the methods and the data being used in the same class

    • B. 

      A key design pattern for ensuring consistent execution of code

    • C. 

      A way to ensure an interface is contained

    • D. 

      Grouping related data in a single class

  • 5. 
    Which of the following best defines Cohesion?
    • A. 

      How strongly-related the method is to its data

    • B. 

      How strongly-related two classes are

    • C. 

      How strongly-related a class attribute is to the database attribute

    • D. 

      How strongly-related and focused the various responsibilities of a class are

  • 6. 
     Inheritance is often described as a 'has-a' relationship
    • A. 

      True

    • B. 

      False

  • 7. 
    What is the term for when one class gets another class to do the work for it
    • A. 

      Segregation

    • B. 

      Delegation

    • C. 

      Inheritance

    • D. 

      Abdication

  • 8. 
    'A house that has rooms' is an example of what?
    • A. 

      Inheritance

    • B. 

      Composition

    • C. 

      Containment

    • D. 

      Aggregation

  • 9. 
    If Class B and C are parts of Class A this is called what?
    • A. 

      Inheritance

    • B. 

      Aggregation

    • C. 

      Polymorphism

    • D. 

      Ownership

  • 10. 
    Which of these best describes a Design Pattern?
    • A. 

      A design approach that should always be used in a particular situation

    • B. 

      A short-cut to creating code

    • C. 

      An accepted best solution to a particular design problem

    • D. 

      A way to structure your design to make it more easily readable

  • 11. 
     Every class has an interface
    • A. 

      True

    • B. 

      False

  • 12. 
    A well designed interface should have…
    • A. 

      A clear name and well-named, focused methods

    • B. 

      A master method that does everything in the class

    • C. 

      A short name and a long name

  • 13. 
    An abstract class must have at least one abstract method
    • A. 

      True

    • B. 

      False

  • 14. 
    A private method means only objects of this class and classes that inherit from this class can access the field or method
    • A. 

      True

    • B. 

      False

  • 15. 
     Ideally, all class attributes should be private
    • A. 

      True

    • B. 

      False

  • 16. 
    Select THREE of the following which are valid reasons for refactoring
    • A. 

      Making the code easier to read and understand

    • B. 

      Making it possible to write more localized tests

    • C. 

      Making extending the code easier

    • D. 

      Making it easier to repeat code

  • 17. 
    Select the TWO valid ways for reducing duplicate code (Select all that apply)
    • A. 

      Extracting method into a superclass

    • B. 

      Extracting method into a helper (utility) class

    • C. 

      Modifying the code in each section to be unique

    • D. 

      Modifying the code to be shorter

  • 18. 
    What should you do with 'Dead' code?
    • A. 

      Comment it out but leave it in

    • B. 

      Nothing needs to be done as it is not hurting anything

    • C. 

      Remove it

    • D. 

      None of the above

  • 19. 
    Which of the following best defines Legacy code?
    • A. 

      Written in Cobol

    • B. 

      Code without tests

    • C. 

      Written by somebody else

    • D. 

      Over 10 years old

  • 20. 
    Which object oriented principle implies that classes should have a narrow, focused set of behaviors?
    • A. 

      The Open-Closed Principle

    • B. 

      The Liskov Substitution Principle

    • C. 

      The Dependency Inversion Priciple

    • D. 

      The Single Responsibility Principle

  • 21. 
    Inheritance is a loose form of coupling.
    • A. 

      True

    • B. 

      False

  • 22. 
    When refactoring, it is best to have a comprehensive suite of unit tests
    • A. 

      True

    • B. 

      False

  • 23. 
    The components of an aggregation relationship always share the same lifecycle
    • A. 

      True

    • B. 

      False

  • 24. 
    Which pattern is often used to implement a pluggable algorithm
    • A. 

      State

    • B. 

      Factory

    • C. 

      Adapter

    • D. 

      Strategy

  • 25. 
    Which pattern is a formal way of archiving ease of use in an API?
    • A. 

      Command

    • B. 

      Strategy

    • C. 

      Fa├žade

    • D. 

      NullObject

Back to Top Back to top