Basic Requirements For Polymorphism Quiz

20 Questions | Total Attempts: 91

SettingsSettingsSettings
Please wait...
Basic Requirements For Polymorphism Quiz

In computer programming, polymorphism is the provision of a single interface to entities of different types. Trust me, only tech nerds can get this language. If you are one, test your knowledge of the basic requirements for polymorphism below.


Questions and Answers
  • 1. 
    What is allowed within class definition? (T/F)
    • A. 

      Typing with LIKE to ABAP Dictionary types.

    • B. 

      The definition of Internal Tables with header lines.

    • C. 

      The TABLES statement.

    • D. 

      The definition of Internal Tables without header lines.

    • E. 

      Typing with TYPE to ABAP Dictionary types.

  • 2. 
    Which techniques are basic requirements for polymorphism? (T/F)
    • A. 

      Narrowing Cast.

    • B. 

      Redefinition of methods (for polymorphism through inheritance).

    • C. 

      Widening Cast.

    • D. 

      Implementation of methods of an insterface in the respective classes (for polymorphism through inheritance).

  • 3. 
    Which of the following statements about interfaces are correct? (T/F)
    • A. 

      Interfaces actually stand for an interface (protocol) between a client (interface user) and a server (implementing class).

    • B. 

      Interfaces are used to call static components of a class.

    • C. 

      Using interface references you can reference all the public components of an object that have been defined in the corresponding interface-implementing class.

    • D. 

      A client (caller) can use inteface reference to access all methods of the Interfaces and thus archive polymorphism behavior.

    • E. 

      Using interfaces you can simulate multiples inheritance.

  • 4. 
    Using the statement CREATE OBJECT  you can instantiate objects of a class. What situations can arise here?
    • A. 

      All objects of the same class contain the same number of attributes and methods after being created.

    • B. 

      You can preset different objects of a class with different values inmediately when they are being created.

    • C. 

      The contents of the attributes of different objects in a class always contain the same content or value inmediately after being created.

    • D. 

      You define the type and number of attributes of an object through the correspoding class.

  • 5. 
    REF_CL is a reference to the class CL_DOCUMENT. REF_IF is a reference to the Interface IF_DISPLAY. The interface IF_DISPLAY is implemented by the class CL_DOCUMENT. What option do you have to create an object of the class CL_DOCUMENT?
    • A. 

      CREATE OBJECT ref_cl.

    • B. 

      CREATE OBJECT ref_if TYPE cl_document.

    • C. 

      DATA class_name TYPE string. class_name = "CL_DOCUMENT". CREATE OBJECT ref_if TYPE (class_name).

    • D. 

      CREATE OBJECT ref_if.

  • 6. 
    In the case of classes, we distinguish between two types of components (attributes and methods): Instance components and static components. Which of the following statements apply in this context?
    • A. 

      In a static method, Instance attributes can also be used, provided they area declared as READ ONLY.

    • B. 

      Instance methods can use both static as well as instance components in their implementation part.

    • C. 

      Both static as well as Instance attributes are declared using the DATA statement.

    • D. 

      Static methods can be called through the class: =>.

    • E. 

      Static attributes exist only once for each class.

  • 7. 
    Which access authorizations apply to friend relationships?
    • A. 

      A friend of a class access to the public attributes of the class allowing the friendship.

    • B. 

      A subclass of a friend class has automatic access to the private attributes of the class allowing the friendship.

    • C. 

      A friend of a class has access to the private attributes of the class allowing the friendship.

    • D. 

      The allowing of a friendships is not inherited.

  • 8. 
    Which statements in connection with methods are correct?
    • A. 

      You can call methods in ABAP objects in the same way as function modules.

    • B. 

      You can call methods only within ABAP Objects classes.

    • C. 

      Like form routines or function modules, methods are a means to modularize software.

    • D. 

      Similar to the case with function modules, you hace the option with methods of marking parameters as "optional".

  • 9. 
    SE24. If you have a "Singleton Pattern", you must ensure that only one object can be created from a CL_SINGLETON class. What mechanisms must you avail of here?
    • A. 

      The singleton class must have a class method implemented in which the CREATE OBJECT call is programmed for this one object.

    • B. 

      The singleton class must hace the addition CREATE PRIVATE in the definition part.

    • C. 

      In the singleton class, there must be an even defined that is triggered when the first and only object is created and also prevents further objects of this class from being created.

    • D. 

      The singleton class must have an instance method implemented in which the CREATE OBJECT call is programmed for this one object.

    • E. 

      The CREATE OBJECT call for this one object can take place in the class constructor of the singleton class.

  • 10. 
    The reference ME is defined by the system and has the folowing function (Single selection)
    • A. 

      You use the reference ME within a class solely to reference the private methods of the class itself.

    • B. 

      You use the reference ME within a class to call attributes and methods of the class itself.

    • C. 

      You use the reference ME within a class solely to reference the private attributes of the class itself.

  • 11. 
    Which of the following statements about inheritance are correct?
    • A. 

      Through inheritance, the public attributes of the super class are inherited to the subclass.

    • B. 

      Through inheritance, the private attributes of the super class are inherited to the subclass and they can be addressed in the subclass directly using "ME->".

    • C. 

      Through inheritance, the protected attributes of the super class are inherited to the subclass.

    • D. 

      Through inheritance, the private attributes of the super class are inherited to the subclass and they can be addressed in the subclass directly using "THIS->"

  • 12. 
    What is a (Instance) constructor? (Single Selection)
    • A. 

      An instance attribute that is automatically given a unique identification by the system when an object is created.

    • B. 

      An instance method for initializing the attributes of an object; it is automatically called by the system during CREATE OBJECT.

    • C. 

      An instance method for controlling how much main memory is to be reserved for an object.

  • 13. 
    Suppose you are copying a subclass reference to a reference variable that is typed to the superclass (narrowing cast). What components can you access with this reference variable?
    • A. 

      Redefined components of the superclass

    • B. 

      Newly defined components of the subclass

    • C. 

      Inherited components of the superclass

    • D. 

      Redefined components of the subclass

  • 14. 
    Assume that a reference variable typed on a superclass contains a subclass reference and you copy this to a reference variable that is typed on the class (widening cast). Which of the following components can you access with this reference variable?
    • A. 

      Redefined components of the superclass

    • B. 

      Newly defined components of the subclass

    • C. 

      Inherited components of the superclass

    • D. 

      Redefined components of the subclass

  • 15. 
    Can events be defined in interfaces?
    • A. 

      YES

    • B. 

      NO

  • 16. 
    Can events be triggered in interfaces?
    • A. 

      YES

    • B. 

      NO

  • 17. 
    For a user to be able to execute an object-oriented program, you always need to supply a module pool program or a function group program. Otherwise, there is nowhere for the CREATE OBJECT statement to create the instance.
    • A. 

      TRUE

    • B. 

      FALSE

  • 18. 
    Which of the following statements are correct? Choose the correct answer(s).
    • A. 

      You can create function modules using the Class Builder.

    • B. 

      A global class can contain a local class.

    • C. 

      A global interface can contain a local interface.

    • D. 

      A global class can contain a local interface.

    • E. 

      A nested definition of classes is when a local class is within a global class.

  • 19. 
    In ABAP Object there is a Garbage Collector?
    • A. 

      TRUE

    • B. 

      FALSE

  • 20. 
    An abstract class cannot be instantiated. It specifies one or more abstract methods that must be implemented in a subclass. It is used as a means to enforce a uniform interface in subclasses, It is true?
    • A. 

      TRUE

    • B. 

      FALSE