Taw10 -week 2

59 Questions

Settings
SAP Quizzes & Trivia

For preparation for SAP ABAP certification. This was taken from another website ( http://www. Esnips. Com/doc/69f7a006-bef6-474e-97b7-35e9dae6af72/TAW10-2- 2-Objetos or http://www. Scribd. Com/doc/6912147/TAW10-22-Objetos ) where the answers were already provided.


Questions and Answers
  • 1. 
    • A. 

      Course_name = name

    • B. 

      Name can not be accessed unless course1 is instantiated

    • C. 

      Course_name = course1=>name

    • D. 

      Course_name = course1->name

    • E. 

      Course_price = lcl_course=>price

  • 2. 
    The concept of restricting direct access to data via hidden internal processes is best represented by which term?
    • A. 

      Instantiation

    • B. 

      Encapsulation

    • C. 

      Inheritance

    • D. 

      Polymorphism

  • 3. 
    A syntax for instance method specification is
    • A. 

      Call method Objref=>method

    • B. 

      Call Method->Objref

    • C. 

      Call Method (from within another instance method)

    • D. 

      Call method Objref->method

  • 4. 
    What syntax provides access to individual components of a class within the class
    • A. 

      CALL METHOD object instance->ME->

    • B. 

      ME->

    • C. 

      CALL METHOD ME->

    • D. 

      Object instance->ME

  • 5. 
    Identify the ABAP OO Event signature protocols
    • A. 

      Events can only have exporting Parameters

    • B. 

      Exporting paramets can only be passed by reference

    • C. 

      Exporting parameters can only be passed by value

    • D. 

      Events can only have importing Parameters

  • 6. 
    • A. 

      Event handler methods are called in the sequence that they were registered in the handler table

    • B. 

      There is a separate handler table for every object that has defined events

    • C. 

      Registered Methods in the handler table can only be triggered by RAISE EVENT i.e. not by CALL METHOD

    • D. 

      A single SET Handler command can be used to register multiple handler methods in the handler table

  • 7. 
    In the following method, what other parameters are allowed CLASS lcl_course DEFINITION.  PUBLIC SECTION.    METHODS: get_course_name                IMPORTING im_name type string                Returning value(student_count) type I .ENDCLASS.
    • A. 

      Exceptions

    • B. 

      Exporting

    • C. 

      Changing

    • D. 

      Receiving

  • 8. 
    What implications exists when private components of a class are changed
    • A. 

      Users of the private components must change their interface

    • B. 

      Any programs accessing the class must also change

    • C. 

      Programs are insulated from change

    • D. 

      None of the answers are correct

  • 9. 
    Finish the following sentence so that it is TRUE.Static Components in an inheritance relationship....
    • A. 

      Does not allow for methods to be redefined in subclasses

    • B. 

      Cannot be shared

    • C. 

      Exist once per roll area

    • D. 

      Receive their own copy of the static attribute for each subclass

  • 10. 
    In the context of Triggering and Handling of Events, mark those which apply
    • A. 

      Events can be triggered with the "Trigger Event" command

    • B. 

      Methods must be registered to an event in order to be called when the event is triggered

    • C. 

      An event is defined in the Implementation of a Class

    • D. 

      Event Triggering using "Raise Event" can be issued in a method

  • 11. 
    An inherited class:
    • A. 

      Can remove superclass components

    • B. 

      Can add components over and above the superclass

    • C. 

      Can access the inherited private components

    • D. 

      Can redefine the public methods of the superclass

    • E. 

      Cannot access the protected components

  • 12. 
    What is contained in a class that does not exist in an interface
    • A. 

      Implementation

    • B. 

      Attributes

    • C. 

      Method

    • D. 

      Definition

  • 13. 
    How can a program access private attributes of an object
    • A. 

      By methods of a different object within the same program

    • B. 

      Only by methods of the specific object itself

    • C. 

      By methods of a different instance of the same object

    • D. 

      From outside the class

  • 14. 
    A public attribute 'color' is added to a superclass.  A subclass already has the same attribute 'color'  What is the outcome?
    • A. 

      The sublass is invalidated.

    • B. 

      A syntax message will occur

    • C. 

      The superclass is invalidated

    • D. 

      A runtime error will occur

  • 15. 
    Select the term used for Classes that can implement the same method differently
    • A. 

      Polymorphism

    • B. 

      Inheritance

    • C. 

      Encapsulation

    • D. 

      Casting

    • E. 

      Instantiation

  • 16. 
    • A. 

      EXPORTING Parameters for events can only be passed by value

    • B. 

      EXPORTING Parameters for events can only be passed by reference

    • C. 

      Events can only have EXPORTING parameters

    • D. 

      Events also allow RETURNING parameters

  • 17. 
    When redefining methods in a subclass, what is allowed ?
    • A. 

      Code can be changed

    • B. 

      Only Instance methods

    • C. 

      Signature can be changed

    • D. 

      Private Static methods

  • 18. 
    Define Polymorphism
    • A. 

      It’s a characteristic when methods of the same class react differently to the same method call

    • B. 

      It’s one of the main strengths of inheritance

    • C. 

      It’s a characteristic when methods from different classes react differently to the same interface

    • D. 

      The same method is implemented in different ways by redefining the method in subclasses

    • E. 

      It’s a characteristic when objects from different classes react differently to the same method call

  • 19. 
    Where are the methods of a class implemented
    • A. 

      Object instantiation part of a program

    • B. 

      Implementation part of a class

    • C. 

      Definition part of Class

    • D. 

      Call method of the Class

  • 20. 
    Your program has registered several handler methods.  How does the program know what methods are available for execution when an event is triggered.
    • A. 

      The system looks for registered handler methods In the registry table and processes those that are registered for the event

    • B. 

      The system looks for registered handler methods In the event handler internal table and processes those that are registered for the event

    • C. 

      The methods defined in the Class Definition listen for raised events and respond when an event is triggered

    • D. 

      It is determined by the RAISE Event command

  • 21. 
    • A. 

      Course_price = lcl_course=>price

    • B. 

      Course_name = course1->name

    • C. 

      Course_name = course1=>name.

    • D. 

      Course_name = name

    • E. 

      Course_price = lcl_course->price

  • 22. 
    Class A provides friendship to Class B.  Class B provides friendship to Class C.  Identify the valid friend relationship.
    • A. 

      C is a friend of A

    • B. 

      C is friend of B

    • C. 

      A is friend of B and C

    • D. 

      B and C are friends of A

    • E. 

      B is friend of A

  • 23. 
    Pick the syntax for a funtional method with only 1 parameter
    • A. 

      Refvar->method returning()

    • B. 

      Refvar->method(p1)

    • C. 

      Refvar->method(im = p1)

    • D. 

      Refvar->method receiving()

  • 24. 
    In object orientation, the term USER includes
    • A. 

      Events

    • B. 

      Methods

    • C. 

      Attributes

    • D. 

      All of the answers are correct

    • E. 

      None of the answers are correct

  • 25. 
    Initializing an object in a subclass requires that the constructor of the superclass is first called.  Identify the correct syntax.
    • A. 

      Call Method Super Constructor

    • B. 

      Call Method Super->Constructor

    • C. 

      Call Method Constructor

    • D. 

      Call Method Constructor->Super

  • 26. 
    Identify the valid statements that will write out the Static Attributes in the following code: class lcl_course definition.   public section.    data: name(15) type c value 'ABAPObjects101'.    class-data price type p value 100.   private section.    data: category(10) type C value 'Objects'. endclass. data: course1 type ref to lcl_course,      course_name type string,      course_price type p,      course_category type string.
    • A. 

      Course_price = lcl_course=>price. Write course_price.

    • B. 

      Write: price.

    • C. 

      Write lcl_course=>price.

    • D. 

      Write lcl_course->price

  • 27. 
    The syntax for static method specification
    • A. 

      Call method class name->method

    • B. 

      Call method class name=>method

    • C. 

      Call class-method

    • D. 

      Call Method->class name

  • 28. 
    What triggers an event
    • A. 

      Raise Event inside the Method

    • B. 

      Call Method

    • C. 

      None of the answers are correct

    • D. 

      Raise Event

    • E. 

      All answers are correct

  • 29. 
    • A. 

      Price is protected from outside access

    • B. 

      Price is available to methods inside the class

    • C. 

      Name is available to methods only inside the class

    • D. 

      Name is protected from outside access

  • 30. 
    Mark the operator used to widen cast of a class
    • A. 

      =>

    • B. 

      =?

    • C. 

      ->

    • D. 

      ?=

    • E. 

      =

  • 31. 
    Identify the statements that best describe the visibility of classes
    • A. 

      Local Classes are available only to the program where the class is defined

    • B. 

      Global classes are centrally available to all ABAP programs

    • C. 

      Local Classes are available only to programs in the same development class

    • D. 

      Global Classes are available only from programs belonging to the same development class

  • 32. 
    Changing the view of an instance of a class with more details is referred to as
    • A. 

      Narrowing cast

    • B. 

      Up cast

    • C. 

      Widening cast

    • D. 

      Dynamic referencing

  • 33. 
    What happens when the Set handler command is executed
    • A. 

      An instance of the event is created

    • B. 

      The Event Handler Method is registered

    • C. 

      The Event is triggered

    • D. 

      The Event is handled

  • 34. 
    Mark the items that characterize the Methods of a Class
    • A. 

      Can change the state of an object

    • B. 

      Can access only public attributres in their class

    • C. 

      Can access all atributes in their class

    • D. 

      Can be defined with a parameter interface

    • E. 

      Only pass return codes to the calling program

  • 35. 
    Refer to the following code and indicate which statements are true: Data: cl_container type ref to cl_gui_custom_container,      cl_grid type ref to cl_gui_alv_grid.
    • A. 

      Cl_grid points to the object that communicates with the ALV grid control

    • B. 

      Cl_grid points to the object that communicates with the container control

    • C. 

      Cl_container points to the object that communicates with the ALV grid control

    • D. 

      Cl_container points to the object that communicates with the container control

  • 36. 
    Local Class lcl_course has been defined in program belonging to development class ZCL.  What is the key entry in the repository table TADIR
    • A. 

      R3TR CLASS

    • B. 

      R3TR LOCAL CLASS

    • C. 

      None of the answers are correct

    • D. 

      R3TR ZCL CLASS

    • E. 

      R3TR lcl_class

  • 37. 
    A MOVE_CAST_ERROR runtime error just occurred.  Identify the cause
    • A. 

      Super class and subclass both point to an instance of the same class type

    • B. 

      Casting a super class to a subclass when superclass does not point to an instance of the subclass type

    • C. 

      Subclass reference variable corresponds to the superclass reference variable

    • D. 

      Super class method is called from the subclass

  • 38. 
    Refer to the following code and select the VALID method call: Class lcl_course definition.   Public section.    data: course_name(12) type c.    methods: display_price              importing im_course_name type string.   Private section.    Data: price type P value 100.    constants: c_objects101(10) type c value 'OBJECTS101'. endclass. class lcl_course implementation.   method display_price.    course_name = im_course_name.    If course_name = c_objects101.      Write: price.    Endif.  endmethod. endclass. Data obj_course type ref to lcl_course. start-of-selection. create object obj_course.
    • A. 

      Call method obj_course->display_price exporting im_course_name = 'OBJECTS101'.

    • B. 

      Call method obj_course->display_price importing im_course_name = 'OBJECTS101'.

    • C. 

      Call method obj_course->display_price exporting course_name = 'OBJECTS101'.

    • D. 

      Call method obj_course->display_price exporting im_course_name = c_objects101.

  • 39. 
    Using example code below, choose the correct syntax for the redefined method: Class lcl_car definition.   Public Section.    method calc_speed importing im_distance type ty_dist. End Class.
    • A. 

      Method calc_speed importing im_distance.

    • B. 

      Method calc_speed Redefinition.

    • C. 

      Method calc_speed importing im_distance Redefinition

    • D. 

      Method calc_speed Redefinition importing im_distance type ty_dist.

  • 40. 
    What can be said about the lifetime of an object
    • A. 

      All answers are correct

    • B. 

      An object exists for as long as it is being used in the program

    • C. 

      An object exists for as long as at least one reference points to it

    • D. 

      An object exists as long as at least one method of the object is registered as an event handler.

  • 41. 
    Global Class cl_course has been defined using the class builder.  The development class is ZCL.  What is the key entry in the repository table TADIR.
    • A. 

      R3TR ZCL CLASS

    • B. 

      None of the answers are correct

    • C. 

      R3TR CLAS cl_course

    • D. 

      R3TR cl_course

    • E. 

      R3TR GLOB CLASS

  • 42. 
    What statement will request memory to be allocated to an object
    • A. 

      Call Constructor

    • B. 

      Create Object

    • C. 

      Call Method

    • D. 

      Create Constructor

  • 43. 
    Refer to the following code and identify the statements that are TRUE. CLASS lcl_course DEFINITION.  PUBLIC SECTION.    METHODS: get_course_name IMPORTING im_name type string.    CLASS-METHODS: list_prices_and_discounts.ENDCLASS. CLASS lcl_course IMPLEMENTATION.  METHOD get_course_name.  ENDMETHOD.   METHOD list_prices_and_discounts.  ENDMETHOD.ENDCLASS. Data: course1 type ref to lcl_course,      course2 type ref to lcl_course. Start-of-selection. Create object course1.Course2 = course1.
    • A. 

      Method list_prices_and_discounts is a static method

    • B. 

      Method list_prices_and_discounts can only be called once

    • C. 

      List_prices_and_discounts is a instance method

    • D. 

      Only one instance of method get_course_name exists

    • E. 

      Only one instance of method list_prices_and_discounts exists

  • 44. 
    Identify the Characteristics of a Final Class
    • A. 

      No answers are correct

    • B. 

      All answers are correct

    • C. 

      Methods cannot be explicitly designated as FINAL

    • D. 

      Contains final methods implicitly

    • E. 

      Cannot have subclasses

  • 45. 
    Using the UML modeling language for ABAP OO design, refer to the following and indicate the visibility of the components -------------------| cl_myclass      |-------------------| +city           || #address        ||-----------------|| + get_city()    || - display_addr()||                 ||-----------------|
    • A. 

      Get_city is a public attribute

    • B. 

      Address is protected attribute

    • C. 

      Display_address is a public method

    • D. 

      Display_address is a static public method

    • E. 

      Display_address is a private method

  • 46. 
    What is possible with a subclass in an inheritance relationship to the superclass
    • A. 

      The subclass can remove components of the superclass

    • B. 

      Can add new components to the subclass

    • C. 

      Can provide inherited methods with new implementations (redefinition)

    • D. 

      Inherits all the characteristics of the superclass

    • E. 

      Components defined in the superclass are not present in the subclass unless they are explicitly defined in the definition of the subclass

  • 47. 
    In the context of polymorphism and interfaces, mark the item that is NOT true
    • A. 

      The user is protected from the actual implementations

    • B. 

      Interfaces describe the point of contact of a class

    • C. 

      Interfaces contain their own implementation part

    • D. 

      A class can implement any number of interfaces

  • 48. 
    Select the answers that apply to static methods and instance methods
    • A. 

      Instance methods MUST be addressed by object ref after instantiation

    • B. 

      Static methods MUST be addressed by object reference after instantiation

    • C. 

      Instance methods MUST be addressed class name

    • D. 

      Static methods MUST be addressed by class_name even when object in instantiated

  • 49. 
    Identify the valid rule when calling public methods from within the class
    • A. 

      When calling a static method, the class name is required

    • B. 

      When calling an instance method, the => operator is required

    • C. 

      When calling a static method, the class name can be omitted

    • D. 

      Private methods can not call public methods

  • 50. 
    Where is the visibility of class components defined
    • A. 

      Object Instance

    • B. 

      Class Methods

    • C. 

      Class Implementation

    • D. 

      Class Definition

  • 51. 
    Identify the one addition that is not part of the interface of a method
    • A. 

      Result

    • B. 

      Exception

    • C. 

      Importing

    • D. 

      Returning

  • 52. 
    Identify the line that contains the valid use of the READ-ONLY addition. class lcl_course definition. 10 public section.20   Data: Price(3) type p decimals 2                    value 100 READ-ONLY. 30   Types: type_category(15) type C READ-ONLY.40   Constants: write_position type I value 10 READONLY. 50 private section.60   data: category(15) type C READ-ONLY,70   class-data: course_count type I READ-ONLY. endclass.
    • A. 

      30

    • B. 

      60

    • C. 

      50

    • D. 

      20

    • E. 

      40

  • 53. 
    What mechanism is used to define common components of different classes in one place
    • A. 

      Create Object

    • B. 

      Class Definition

    • C. 

      Interface

    • D. 

      Raise Event

  • 54. 
    What is the only component that is implemented in the implementation part of a class
    • A. 

      Method

    • B. 

      Attribute

    • C. 

      Object

    • D. 

      Interface

    • E. 

      Event

  • 55. 
    Indentify the requirements that determine when an object gets deleted by garbage collection
    • A. 

      When all active objects are marked

    • B. 

      When none of its methods are registered as event handlers

    • C. 

      When objects can no longer be addressed from main memory

    • D. 

      When there are no more references pointing to an object

  • 56. 
    How do you call the method in a superclass that has the same name as a redefined method in the subclass ?
    • A. 

      Call Method Superclass->mymethod.

    • B. 

      Call Method Super->mymethod

    • C. 

      Call Method mymethod

    • D. 

      You can't. Only the redefined method can be recalled

  • 57. 
    • A. 

      30, 120

    • B. 

      30, 80

    • C. 

      40, 70

    • D. 

      70, 80

    • E. 

      40, 120

  • 58. 
    What is true about classes and objects in Object oriented ABAP
    • A. 

      Classes are an instance of an object

    • B. 

      Objects can change their class

    • C. 

      Class is a template for an object

    • D. 

      Objects are an instance of a class

  • 59. 
    Identify the statement about Global Classes that is NOT true
    • A. 

      Class Builder can be used to test global classes

    • B. 

      A method to be transported is identified in transport organiser as LIMU METH

    • C. 

      Programs that are available to Global Classes must be associated in Class Builder

    • D. 

      Global classes are stored in TADIR with key R3TR CLAS

    • E. 

      Access to a global class is done as a reference variable using TYPE REF TO