SAP OOPS ABAP Interview Questions and Answers
by Nithyanandham, on Sep 11, 2022 1:07:42 PM
Q1. What is OOPS ABAP ?
Ans: Object orientation (OO), or to be more precise, object-oriented programming, is a problem-solving method in which the software solution reflects objects in the real world.
A comprehensive introduction to object orientation as a whole would go far beyond the limits of this introduction to ABAP Objects. This documentation introduces a selection of terms that are used universally in object orientation and also occur in ABAP Objects. In subsequent sections, it goes on to discuss in more detail how these terms are used in ABAP Objects. The end of this section contains a list of further reading, with a selection of titles about object orientation.
Q2. Is It Mandatory To Implement All Methods Of Interface In The Class Which Includes Interface?
Ans: No it is not mandatory to implement all normal interface methods but it is mandatory to implement all Abstract methods.
Q3. What Is An Interface In Ooabap?
Ans: Interface is class which contains methods without implementations.
Q4. Can We Instantiate The Interface?
Ans: No, we can not instantiate interface using create object keyword.
Q5. Can We Achieve Multiple Inheritance Using Interfaces?
Ans: Yes, by using interface concept in SAP ABAp, we can achieve multiple inheritance
Q6. Does Polymorphism Achieved Through Interfaces?
Ans: Yes, by using interface concept in SAP ABAP, we can polymorphism
Q7. What Is The Difference Between Abstract Class And Interface?
Ans: Abstract class is a class which contains at least one abstract method( Method without implementation), Abstract class contains methods with implementation and without implementation and we cannot create instance for the abstract class .
- Abstract class is mainly for inheritance .
- Interface contains methods without implementation
Q8. What Is Alias Name In Ooabap?
Ans: Alias is an alias name for the interface method implemented in the class .
Q9. Can We Raise Events In Interface?
Ans: No, you can not raise events in interface, Because there is no Implementation for the methods. We can create events in interfaces .
Q10. What Is A Single-ton Class?
Ans: Single-ton class is a class which allows to instantiate once only .
Q11. What Is The Difference In Attributes Defined In The Public Versus Private Section Of A Class?
Ans: Public attributes can be accessed by class, subclasses and other classes where as Private attributes can be accessed by class itself only.
Q12. What is the Difference between Class and Object ?
Ans: 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 Employee ia a class, while John is a real employee which is an Object of Employee Class.
Q13. How polymorphism can be implemented ?
Ans: Some examples to implement polymorphism:
- Method Overriding
- Method Overloading
- Operator Overloading
Q14. What is Inheritance ?
Ans: 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.
Q15. 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.
Q16. What is Method Overloading ?
Ans: Method overloading is in a class have many methods having same name but different parameter called overloading or static polymorphism
Q17. What is Aggregation ?
Ans: Aggregation is a special form of association. Aggregation is the composition of an object out of a set of parts. For example, a car is an aggregation of engine, tyres, brakes, etc.
Aggregation represents a “Has” relationship like a car has a engine.
Q18. What is object oriented programming language ?
Ans: Object oriented programming language allows concepts such as abstraction, modularity, encapsulation, polymorphism and inheritance. Simula is the first object oriented language. Objects are said to be the most important part of object oriented language. Concept revolves around making simulation programs around an object.
Q19. What are the core ABAP oops concepts ?
- Inheritance: Inheritance is the ability of an object to inherit the properties and methods of another object. This characteristic leads to the creation of families of objects (just like families exist for humans) with parent objects and child objects.
- Polymorphism: Polymorphism is about an objects ability to provide context when methods or operators are called on the object.
Q20. Definition: Polymorphism
Ans: 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. The simple example is two classes that inherit from a common parent and implement the same virtual method.