Sharecodepoint

We are proud to announce the launch of the new brand of sharecodepoint.




Thursday, 10 August 2017

SAP MCQ Questions | Introduction to Object-Oriented Programming in SAP


1) Which of the following describes how instances of different classes respond differently to the same messages?
a) Inheritance
b) Polymorphism
c) Encapsulation
d) Event control

Ans) b)
Polymorphism is when instances of different classes respond differently to the same messages.


2) The __________ diagram pays particular attention to the sequence in which the objects relate to each other.
a) Class
b) Behavior
c) Component
d) Object

Ans) b)
The behavior diagram pays particular attention to the sequence in which the objects relate to each other.


3) You can group all characteristics and behaviors of similar objects into one central class.
a) True
b) False

Ans) a)
You can group all characteristics and behavior of similar objects into one central class.


Fundamental Object-Oriented Syntax

4) The CLASS statement can be nested, that is, you can define a class within a class.
a) True
b) False

Ans) b)
The CLASS statement cannot be nested, that is, you can define a class within a class.


5)Which one of the following syntax elements is used to define static attributes?
a) CLASS-DATA
b) DATA
c) LIKE

Ans) a)
You define static attributes with the syntax element CLASS-DATA.


6) Which of the following options is used to create an object?
a) CREATE OBJECT ref_name
b) APPEND ref_name
c) CLASS ref_name

Ans) a)
CREATE OBJECT ref_name is used to create a object.


7) You cannot create and address objects using reference variables.
a) True
b) False

Ans) b)
You can only create and address objects using reference variables.


8) During program runtime, you use the class to create discrete objects (instances) in the memory. This process is called instantiation.
a) True
b) False

Ans) a)
During program runtime, you use the class to create discrete objects (instances) in the memory. This process is called instantiation.


9) The Garbage Collector is a system routine that starts automatically if the runtime system does not have important tasks to carry out.
a) True
b) False

Ans) a)
The Garbage Collector is a system routine that starts automatically if the runtime system does not have important tasks to carry out.


10) Independent references are references that have been defined within a class.
a) True
b) False

Ans) b)
Independent references are references that have been defined within a class.


11) Which of the following options is used to administer objects in the internal tables?
a) LOOP
b) APPEND
c) CLASS
d) READ

Ans) a) b) d)
LOOP, APPEND, and READ are used to administer objects in the internal table.


12) When calling a static method from within the class, you can omit the class name.
a) True
b) False

Ans) a)
When calling a static method from within the class, you can omit the class name.


13) In which of the following expressions can functional methods be called directly?
a) IF
b) COMPUTE
c) MOVE
d) WHILE

Ans) all
The expressions that are used to call functional methods directly are ELSEIF, COMPUTE, MOVE and WHILE.


14) You can describe methods that have a _______ parameter as functional methods.
a) EXPORTING
b) CHANGING
c) RETURNING

Ans) c)
You can describe methods that have a RETURNING parameter as functional methods.


15) You have to pass the RETURNING parameter using the VALUE addition, that is they must be pass by value.
a) True
b) False

Ans) a)
You have to pass the RETURNING parameter using the VALUE addition, that is, pass by value.


16) The __________ is a special instance method in a class.
a) Constructor
b) Function
c) Attributes

Ans) a)
The constructor is a special instance method in a class.



17) The constructor is automatically called at runtime with the CREATE OBJECT statement.
a) True
b) False

Ans) a)
The constructor is automatically called at runtime with the CREATE OBJECT statement.


18) Which of the following points do you consider when defining static constructors?
a) Each class has not more than one static constructor.
b) The static constructor must be defined in the private area.
c) The constructor’s signature can have importing parameters or exceptions.
d) The static constructor can be called explicitly.

Ans) a)
When defining static constructors, each class should not have more than one static constructor.


19) The constructor’s signature can have importing parameters or exceptions.
a) True
b) False

Ans) b)
The constructor’s signature cannot have importing parameters or exceptions.


Inheritance and Casting

20) Which of the following is a relationship in which the subclass inherits all the main characteristics of the superclass?
a) Specialization
b) Generalization
c) Polymorphism
d) Casting

Ans) a)
Specialization is a relationship in which the subclass inherits all the main characteristics of the superclass.


21) Which of the following are the characteristics of generalization and specialization?
a) Common components only exist once in the superclass
b) Components in the subclasses are available in all superclasses
c) Subclasses contain extensions or changes
d) Subclasses are not dependent on superclasses

Ans) a) b)
Common components of generalization or specialization only exit once in the superclass. Generalization or specialization also have subclasses that contain extensions or changes.


22) Which of the following can be called automatically in the superclass?
a) Method
b) Instance constructor
c) Static constructor
d) Object

Ans) c)
Static constructor can be called automatically in the superclass.


23) A superclass is a generalization of its subclasses.
a) True
b) False

Ans) a)
A superclass is a generalization of its subclasses.


24) Which of the following section is used to change superclasses without the need to know  the subclasses?
a) PROTECTED
b) PRIVATE
c) PUBLIC

Ans) b)
PRIVATE section is used to change superclasses without the need to know the subclasses.


25) Which of the following is determined by the assignment?
a) Superclass
b) Static type
c) Dynamic type
d) Subclass

Ans) c)
Dynamic type is determined by the assignment.


26) When objects from different classes react differently to the same method calls, this is known as _________.
a) Objects
b) Events
c) Polymorphism
d) Inheritance

Ans) c)
When objects from different classes react differently to the same method calls, this is known as polymorphism.


27) A typical use for __________ assignments is to prepare for generic access.
a) Events
b) Up-cast
c) Methods
d) Down-cast

Ans) b)
A typical use for up-cast assignments is to prepare for generic access.


28) Which of the following is used to assign a superclass reference to a subclass reference?
a) Widening Cast
b) Narrowing Cast
c) Redefinition

Ans) b)
Narrowing cast is used to assign a superclass reference to a subclass reference.


29) Which of the following is the down-cast assignment operator?
a) APPEND
b) CATCH
c) MOVE … ?TO …
d) TRY-ENDTRY

Ans) c)
MOVE … ?TO … is the down-cast assignment operator.


30) What are the advantages of correctly using class hierarchies?
a) Centralized maintenance
b) Safe and generic method of access
c) Semantics preserved
d) Intended use o inherited components

Ans) a) b)
The advantages of correctly using class hierarchies are centralized maintenance and safe and generic method of access.


                                                Interfaces and Casting
31) Which of the following statements is used to implement an interface in a class?
a) ALIASES
b) METHODS
c) INTERFACES

Ans) c)
INTERFACES is used to implement an interface in a class.


32) You can access interface components only by using an object reference.
a) True
b) False

Ans) b)
You cannot access interface components only by using an object reference.


33) Which of the following is the main strength of interfaces?
a) Events
b) Inheritance
c) Polymorphism

Ans) c)


34) ?= is the down-cast assignment operator.
a) True
b) False

Ans) a)
?= is the down-cast assignment operator.


35) Interface reference variables can contain references to instances of the class that is not implemented at runtime.
a) True
b) False

Ans) b)
Interface reference variables can contain references to instances of the implementing class at runtime.


36) Which of the following strongly resembles inheritance?
a) Interface
b) Class
c) Method

Ans) a)
Interface implementation strongly resembles inheritance.


37) Interfaces like regular superclasses can include other interfaces.
a) True
b) False

Ans) a)
Interfaces like regular superclasses can include other interfaces.


Object-Oriented Events

38) Which of the following statements is used to define events within a class?
a) CLASS-EVENTS
b) RAISE EVENTS
c) EVENTS
d) FOR EVENTS

Ans) c)
The EVENTS statement is used to define events within a class.


39) Which of the following statements is used to trigger events?
a) CLASS-EVENTS
b) RAISE EVENTS
c) EVENTS
d) FOR EVENTS

Ans) b)
The RAISE EVENT statement is used to trigger events.


40) Which of the following are not defined as interface components?
a) Attributes
b) Methods
c) Events
d) Classes

Ans) d)
Classes are not defined as interface components.


41) Events are registered using the SET HANDLER statement. Registration is only active at program runtime.
a) True
b) False

Ans) a)
Events are registered using the SET HANDLER statement. Registration is only active at program runtime.


42) Which visibility of the event ensures that it can only be handled in the class itself and its subclasses?
a) Public
b) Protected
c) Private

Ans) b)
Protected is used to handle the visibility of the event within the class or its subclasses.


Object-Oriented Repository Objects

43) You can only use local classes or interfaces within the same program in which they are defined and implemented.
a) True
b) False

Ans) a)
You should use local classes or interfaces only within the same program in which they are defined and implemented.


44) Which of the following are used to test the triggering of events in a class?
a) Select an event
b) Choose Handler
c) Call a class

Ans) a) b)
The steps select an event and choose handler are used to test the triggering of events in a class.


45) You cannot convert to functional modern writing style when generating method calls as of SAP NW AS 7.0.
a) True
b) False

Ans) b)
You can convert to functional modern writing style when generating method calls.


46) The naming convention for SAP interfaces is “ZIF_ or YIF_”.
a) True
b) False

Ans) b)
The naming convention for SAP interfaces is “IF_”.


47) Which of the following is used to generate UML diagrams for existing coding?
a) Class Builder
b) Superclass
c) Methods
d) Interfaces

Ans) a)
Class Builder is used to generate UML diagrams for existing coding.


48) Which of the following pushbutton is used to override an inherited method?
a) CONSTRUCTOR
b) Redefine
c) Implementation

Ans) b)
The redefine pushbutton is used to redefine an inherited method.


49) Local type of the global class are encapsulated and cannot be acceded from outside.
a) True
b) False

Ans) a)
Local type of the global class are not encapsulated and cannot be accessed from outside.


50) You cannot use the Refactoring Assistant to move the components of a class within the inheritance hierarchy.
a) True
b) False

Ans) b)
You can use the Refactoring Assistant to move the components of a class within the inheritance hierarchy.


ABAP Object-Oriented Examples

51) The ABAP List viewer (ALV) Grid Control is a tool that you can use to display non-hierarchical lists in a standardized form.
a) True
b) False

Ans) a)
The ABAP List viewer (ALV) Grid Control is a tool that you can use to display non-hierarchical lists in a standardized form.


52) Container controls do not provide the technical connection between the screen and application control.
a) True
b) False

Ans) b)
Container controls provide the technical connection between the screen and application control.


53) To create a handler object for an event, we must first define a _________.
a) Class
b) Structure
c) Screen
d) Attribute

Ans) a)
To create a handler object for an event, we must first define a class.


54) A handler method can be either a class method (static method) or an instance method of an object.
a) True
b) Flase

Ans) a)
A handler method can be either a class method (static method) or an instance method of an object.


55) With a Business Add-In (BAdl), an SAP application program provides the enhancement option through an interface method.
a) True
b) False

Ans) a)
With a Business Add-In (BAdl), an SAP application program provides the enhancement option through an interface method.


56) An object of the BAdl adapter class is instantiated by the call of the static method GET_INSTANCE of the class CL_EXITHANDLER.
a) True
b) False

Ans) a)
An object of the BAdl adapter class is instantiated by the call of the static method GET_INSTANCE of the class CL_EXITHANDLER.


57) To implement a Business Add-In (BAdl), the BADI definition name must be investigated.
a) True
b) False

Ans) a)
To implement a Business Add-In (BAdl), the BADI definition name must be investigated.


58) The code of BAdl implementation is stored in a __________ of an automatically generated customer class.
a) Method
b) Structure
c) Object

Ans) a)
The code of BAdl implementation is stored in a method of an automatically generated customer class.



0 comments:

Post a Comment

 

ShareCodePoint : Version 17.1.2 - 2016 - 2018 - © Sachin Yadav Production Made in India.