Are you planning to attend an interview for the SAP OOPS ABAP role but confused on how to crack that interview and also what would be the most probable SAP OOPS ABAP Interview Questions that the interviewer may ask? Well, you have reached the right place. Tekslate has collected the most frequently asked SAP OOPS ABAP Interview Questions and Answers which are often asked in multiple interviews.
Most frequently asked SAP OOPS ABAP Interview Questions |
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.
Ans: A-Class is actually a blueprint or a template to create an Object. Whereas an object is an actual instance of a Class.
Ans: Implement polymorphism:
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 behaviour of the pre-existing classes, which are referred to as base classes.
Ans: Method overriding allows a subclass to override a specific implementation of a method that is already provided by one of its superclasses.
A subclass can give its own definition of methods but need to have the same signature as the method in its superclass. This means that when overriding a method the subclass method has to have the same name and parameter list as the super class's overridden method.
Ans: Method overloading is in a class have many methods having the same name but different parameters called overloading or static polymorphism.
Ans: An 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 the engine, tires, brakes, etc.
Aggregation represents a "Has" relationship like a car has an engine.
Ans: An 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 an object-oriented language. The concept revolves around making simulation programs around an object.
Want to represent real-time objects of a class, enroll in our SAP OOPS ABAP Training |
Ans:
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 object's ability to provide context when methods or operators are called on the object. 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. A simple example is two classes that inherit from a common parent and implement the same virtual method.
Encapsulation:
Encapsulation is the ability that an object has to contain and restrict access to its members. Encapsulation is a key concept of object programming that ensures the autonomy and integrity of the objects. Abstraction: Another OOPS concept related to encapsulation that is less widely used but gaining ground is an abstraction.
Abstraction:
Through the process of abstraction, a programmer hides all but the relevant data about an object in order to reduce complexity and increase efficiency. In the same way that abstraction sometimes works in art, the object that remains is a representation of the original, with unwanted detail omitted. The resulting object itself can be referred to as an abstraction, meaning a named entity made up of selected attributes and behaviour specific to a particular usage of the originating entity.
Ans: UML (Unified Modeling Language) is a standardized modelling language. It is used for the specification, construction, visualization, and documentation of models for software systems and enables uniform communication between various users.
Ans:
There are two types of Objects:
Two types of Classes:
Ans: We can create four types of classes under the final and only modelled category(optional) with private, protected, public, and abstract instantiation.
Ans: Understanding static components are essential before going to static classes in Sap ABAP Static Components: Static Components such as static attributes, static methods, and static events exists globally, it’s not necessary to create an instance/object of the class to access them, simply we can access them using static component selector =>. Singleton Class: The class that does not allow creating multiple instances to access any object. Static Class: The class that contains only static components without instance components is referred to as a static class.
Ans: 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.
Checkout our blog on SAP ABAP Tutorial |
Ans: An object is an instance of a class. It has state, behaviour, and identity. It is also called an instance of a class.
Ans: Binding denotes the association of a name with a class.
Ans: Static binding is a binding in which the class association is made during compile time. This is also called Early binding.
Ans: Dynamic binding is a binding in which the class association is not made until the object is created at execution time. It is also called Late binding.
Ans: Modularity is the property of a system that has been decomposed into a set of cohesive and loosely coupled modules.
Ans: Persistence is the property of an object by which its existence transcends space and time.
Ans: Collaboration is a process whereby several objects cooperate to provide some higher-level behaviour.
Ans: If it is to be impossible to instantiate a class more than once (for example, because it serves as a data administrator or data container), you can use the singleton concept. 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.
Ans: Inherited methods can be redefined in subclasses Redefined methods must be re-implemented in subclasses. The signature of redefined methods cannot be changed Static methods cannot be redefined. In inheritance, static components are "shared": A class shares its non-private static attributes with all its subclasses. In ABAP Objects, you can not only add new components but also provide inherited methods with new implementations. This is known as redefinition. You can only redefine (public and protected) instance methods, other components (static methods, attributes and so on) cannot be redefined. Changes to method parameters (signature changes) are not possible.
Ans: In inheritance, static components are "shared": A class shares its non-private static attributes with all its subclasses. => and -> are the component selectors used to refer.
Ans: A component instance is a running component that can be run in parallel with other instances of the same component.
Ans: Encapsulation means that the implementation of an object is hidden from other components in the system so that they cannot make assumptions about the internal status of the object and therefore dependencies on specific implementations do not arise.
Ans: BADI - Business Add-Ins are enhancements to the standard version of the code of SAP.
Filter Badi- Business Add-Ins may be implemented on the basis of a filter value. If an enhancement for country-specific versions is provided for in the standard version, it is likely that different partners will want to implement this enhancement. Individual countries can create and activate their own implementation.
Ans: Methods that have a RETURNING parameter are described as functional methods. These methods cannot have EXPORTING or CHANGING parameters but have many (or as few) IMPORTING parameters and exceptions as required.
Ans: To go to an address before performing the operation a dereference variable is a pointer to the variable, not the variable itself. A pointer can be re-assigned any number of times while a reference cannot be reassigned after initialization. Field symbols are similar to dereference pointers. Thus, you can only access the content of the data object to which the field symbol points. (That is, field symbols use value semantics). If you want to access the content of the data object, you need to dereference the data reference first.
Read these latest SAP UI5 Interview Questions that help you grab high-paying jobs |
Ans: All the instance variables should be declared as private and public getter and setter methods should be provided for accessing the instance variables.
Ans: Inheritance, Overloading and Overriding are used to achieve Polymorphism in Java.
Ans: The major advantages of OOPs are:
Feature | Description |
Simplicity | Software objects model real-world objects, so the complexity is reduced and the program structure is very clear. |
Modularity | Each object forms a separate entity whose internal workings are decoupled from other parts of the system. |
Modifiability | It is easy to make minor changes in the data representation or the procedures in an OO program. Changes inside a class do not affect any other part of a program since the only public interface that the external world has to a class is through the use of methods. |
Extensibility | Adding new features or responding to changing operating environments can be solved by introducing a few new objects and modifying some existing ones. |
Maintainability | Objects can be maintained separately, making locating and fixing problems easier. |
Re-usability | Objects can be reused in different programs |
Ans: Following are the main concepts of OOPs:
Ans: An 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 the engine, tires, brakes, etc.
Aggregation represents a "Has" relationship like a car has an engine.
Ans: Association defines a relationship between different objects of different classes which allows one object instance to cause another to perform an action on its behalf.
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 an object-oriented language. The concept revolves around making simulation programs around an object.
Ans: Message passing is a method by which an object sends data to another object or requests other objects to invoke the method. This is also known as interfacing. It acts as a messenger from one object to another object to convey specific instructions.
Also, Have a look at SAP ABAP Resume |
Ans: Method overloading is the ability to define several methods all with the same name.
Ans: Operator overloading is a specific case of polymorphisms in which some or all operators like +, -, %, etc. are treated as polymorphic functions and as such have different behaviors depending on the types of its operands.
Ans; When a derived class object is assigned to a base class, only the base class's part of the content in the derived object is copied to the base class, leaving behind the derived class-specific contents. This is referred to as Object Slicing.
Class Base
{
public int i;
};
class Derived: public Base
{
public int j;
};
int main()
{
Base objB;
Derived objD;
objB = objD;
//Here objD contains both i and j.
//But only i is copied to objB.
}
Ans: Some of the programming languages which support object-oriented characteristics are ABAP, C++, Perl, LISP, Java, C#, Tcl, VB.Net, Ruby, Python, PHP, etc. The popularity of these languages has increased considerably as they can solve complex problems with ease.
Ans: A constructor is an operation that creates an object and/or initializes its state.
Checkout: [SAP BI ABAP Interview Questions]
Ans: Destructor is an operation that frees the state of an object and/or destroys the object itself. In Java, there is no concept of destructors. It's taken care of by the JVM.
Ans: The base class is the most generalized class in a class structure. Most applications have such root classes. In Java, Object is the base class for all classes.
Ans: Subclass is a class that inherits from one or more classes.
Ans: Superclass is a class from which another class inherits.
Ans: ABAP 4 data dictionary describes the logical structures of the objects used in application development and shows how they are mapped to the underlying relational database in tables/views.
Ans: Initialization, At selection-screen, Start-of-selection, end-of-selection, top-of-page, end-of-page, At line-selection, At user-command, At PF, Get, At New, At LAST, AT END, AT FIRST.
Ans: Creating an object for the private class is not possible, but can access the private class’s static method. We can call the method using its class name and import that object. For instance, take one static method having an exporting parameter inside the private class and write the object creation code in that static method and then export that object.
Ans: Understanding static components are essential before going to static classes in Sap ABAP Static Components: Static Components such as static attributes, static methods, and static events exist globally, it’s not necessary to create an instance/object of the class to access them, simply we can access them using static component selector =>.
Singleton Class: The class that does not allow creating multiple instances to access any object.
Static Class: The class that contains only static components without instance components is referred to as a static class.
You liked the article?
Like: 3
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.