Ads

ABAP OOPs Interview Questions Part Two

ABAP OOPs Interview Questions Part Two in SAP ABAP

 Friends ,yesterday we have learnt some of the Very import OOPs interview questions and more OOPs interview questions part one and also here i shared with different type of interview questions which are useful for real time and freshers ABAP consultants.

What are access specifiers in OO ABAP  ?

PUBLIC->For all classes
PRIVATE ->Only its won classes
PROTECTED ->parent and child classes

 What is the Difference between Class and Object ?

A Class is actually a blueprint or a template to create an Object. Whereas an Object is a an actual instance of a Class. For example Car a class, while Maruthi is a real Object which is an Object of Car Class.

How polymorphism can be implemented ?

Using below techniques ,we can implement polymorphism:
Method Overriding
Method Overloading
Operator Overloading

What is Method Overriding ?

Method overriding allows a subclass to override a specific implementation of a method that is already provided by one of its super classes.
A subclass can give its own definition of methods but need to have the same signature as the method in its super class. This means that when overriding a method the subclass's method has to have the same name and parameter list as the super class's overridden method.

What is Method Overloading ?

Method overloading is in a class have many methods having same name but different parameter called overloading or static polymorphism.

How can you achieve polymorphism in OOP ?

Polymorphism is achieved by Inheritance .

What is the ABAP syntax for Inheritance in OO ABAP ?

CLASS <subclass_name> DEFINITION INHERITING FROM <superclass_name>.

What is Aggregation ?

Aggregation is a special form of association. Aggregation is the composition of an object out of a set of parts. 

What are the core ABAP oops concepts ?

Inheritance: Inheritance is the ability of an object to inherit the properties and methods of another object. 
Polymorphism
In object-oriented programming, polymorphism (from the Greek meaning "having multiple forms") is the characteristic of being able to assign a different meaning to a particular symbol or "operator" in different contexts. 
 Encapsulation
Encapsulation: Encapsulation is the ability that an object has to contain and restrict the access to its members. 
Abstraction: A programmer hides all but the relevant data about an object in order to reduce complexity and increase efficiency. 

What is Inheritance ?

In OOPs terminology, inheritance is a way to form new classes using classes that have already been defined. Inheritance is intended to help reuse existing code with little or no modification. The new classes, known as derived classes, inherit attributes and behavior of the pre-existing classes, which are referred to as base classes.

  What is UML ?

UML (Unified Modeling Language) is a standardized modeling language. It is used for the specification, construction, visualization and documentation of models for software systems and enables uniform communication between various users.

SAP uses UML as the company-wide standard for object-oriented modeling.
UML describes a number of different diagram types in order to represent different views of a system.

What are the types of Objects and Classes ?

In general there are two types of Objects: Instance Object and Static Object and as such there are two types of Classes: Instance class and Static Class. 

What are the types of classes which can be created ?

We can create four types of classes under final and only modeled category(optional) with the private, protected, public and abstract instantiation.
Usual Abap Class.
Exception Class(With/Without messages).
Persistent Class.
Test Class(ABAP Unit).

What is a reference variable ?

Objects can only be created and addressed using reference variables. Reference variables allow you to create and address objects. Reference variables can be defined in classes, allowing you to access objects from within a class.

What is the difference between Abstract method and a Final method ?

Abstract method
Abstract instance methods are used to specify particular interfaces for subclasses, without having to immediately provide implementation for them. Abstract methods need to be redefined and thereby implemented in the subclass . Classes with at least one abstract method are themselves abstract. 
Static methods
Static methods and constructors cannot be abstract (they cannot be redefined).

What is a super class ? How can it be implemented ?

A super class is a root class of its sub classes. The subclass in turn is a inherited of its super classes.

What is a Narrowing Cast ? How can you implement it ?

The assignment of a subclass instance to a reference variable of the type "reference to superclass" is described as a narrowing cast.

 What is a Widening Cast ?

The widening cast is, as with inheritance, the opposite of the narrowing cast: Here it is used to retrieve a class reference from an interface reference.

What is a singleton ?

If it is to be impossible to instantiate a class more than once . The class is defined with the addition CREATE PRIVATE and FINAL and instantiated using its static constructor. A public static component could then make the reference to the class available to an external user.

What are the limitations of redefining a method ?

Inherited methods can be redefined in sub classes Redefined methods must be re-implemented in sub classes. 

  What are static components? What is a component selector ?

In inheritance, static components are "shared": A class shares its non-private static attributes with all its sub classes and are the component selectors used to refer.

   What are component instance ?

A component instance is a running component that can be run in parallel with other instances of the same component.

How is Encapsulation implemented in OOPs ?

Encapsulation means that the implementation of an object is hidden from other components in the system.

What are the types of Exception classes ?

Global 
Local Exceptions Class.

Where can a protected method be accessed ?

Protected components Only visible within the class and its sub classes.

What is a signature of a method ?

Methods have a parameter interface (called signature ) that enables them to receive values when they are called and pass values back to the calling program.

What is a functional Method ?

Methods that have a RETURNING parameter are described as functional methods. These methods cannot have EXPORTING or CHANGING parameters, but has  IMPORTING parameters and exceptions as required.

 What is a garbage collector ?

Deletes objects that are no longer referenced by object or data reference variables. The garbage collector is called periodically by the ABAP runtime environment. It follows reference variables of deleted objects.

 Can a class be defined without a constructor ?

Yes, class can be created without any constructor. Default constructor will be created when we define a class without constructor.

Read More

Comments

Popular posts from this blog

BADI Interview Questions in SAP ABAP

Sample SAP ABAP Programming Examples for Practice

Module Pool Programming Interview Questions and Answers in SAP ABAP

Step by Step tutorial on BDC Session Method Program in SAP ABAP

SAP ABAP Interview Questions and Answers for 10 Years Experienced