Abstract Class Interview Questions

Below are the Abstract Class Interview Questions for beginners and experienced developers for Interview Preparation. What is the need for abstract classes? Abstract classes allow partial implementations of a methods in a class Which is mostly used for an extension the sub class. Where parent class has default implementation and class specific implementation can be done in the child class. Abstract class promotes code reusability … Continue reading Abstract Class Interview Questions

What is Abstract class in C#, when abstract class is used, can abstract class be used in multilevel inheritance

Abstract class

Before understanding the abstract class let’s understand the abstract methods. Abstract Method The abstract method is a method without implementation. i.e. Abstract method just has the declaration of the method, however, there is no implementation or body for a method. The implementation of a method is done in the derived class. The derived class must implement all the abstract methods to avoid compile-time errors. C# … Continue reading Abstract class

Interface

Introduction In object-oriented programming, An interface is a collection of abstract methods (without body implementations), properties, indexers, and events. It is used to define the behavior that can be implemented by the classes. It enforces classes to implement all the members of it. For example, suppose we have a Truck class and a Car class. Each of these classes should have an action start engine, … Continue reading Interface

Polymorphism Interview Questions

Below is the list of Polymorphism Interview Questions for interview preparations for beginners and experience professional What is Polymorphism in C#? Polymorphism is one of the main pillars of object-oriented programming (OOP), it allows the programmer to change the object behavior based on object creation or way the is being called. It also provides the facility to inject different features to the existing functionality or … Continue reading Polymorphism Interview Questions

Polymorphism

Polymorphism meaning Polymorphism is a Greek word constructed from two words, poly and morph. The word poly means many and morph means changing forms. polymorphism means having many forms. In computer science, It provides the ability to object to change the forms based on context usage. “Polymorphism is an object-oriented programming concept that refers to the ability of a variable, function, or object to take … Continue reading Polymorphism

Inheritance

What is inheritance? Inheritance is the process of deriving quality from the parent. In object-oriented programming (OOP), it is the process of creating a class from another class called a base class. So that derived class(child class) can acquire the property, methods of a base class. Derive (a quality, characteristic, or predisposition) genetically from one’s parents or ancestors. We can say that inheritance would be … Continue reading Inheritance

Constructors Interview Questions

Why we need a constructor in object-oriented programming? The purpose of Constructor is to initialize the values of data members or to perform some logic when an instance of the class gets created. Yes, we can achieve this without constructor but for that, we need to make explicit calls and chances that someone might forget to call method to initialize the values before creating an … Continue reading Constructors Interview Questions

Constructors

What is constructor with example Constructors are special methods inside a class that is called when an object is instantiated. In other words, when we create an instance of the class using the “new” keyword, the constructor gets called automatically and initializing the variables of that class. Example: Suppose we have a “Car” class as mentioned below Now if we want to initialize “Car” class … Continue reading Constructors

Encapsulation

In object-oriented programming people often get confused with encapsulation and abstractions. Encapsulation in programming is the process of encapsulating data members and data methods into a single unit to hide it from another class. Encapsulation is a strategy used as part of abstraction. It refers to the state of objects – objects encapsulate their state and hide it from the outside; outside users of the … Continue reading Encapsulation

Abstraction

Introduction In Simple terms, Abstraction is the process of hiding the irrelevant information in a higher degree and only showing essential thing to the user. It focusses on what the thing does instead of how it does. For example, a mobile phone to make the call we don’t need to know how our call gets connected to another phone, we just need to dial number … Continue reading Abstraction

What are class and object in OOP?

In object-oriented programming (OOP), object and class play an essential role; In fact, OOP is based on object and class. Definition of Objects An object is any real-time entity which has some properties (State) and can perform some task (Behaviour). For example, Mobile is an object; it has some properties (State) like length, colour, weight, etc. and it perform some task (Behaviour) like call, message, etc. In programming, objects … Continue reading What are class and object in OOP?

Object-Oriented Programming (OPPs)

Introduction to object-oriented programming As the software becomes more complicated, The codebase is becoming huge with more program logic. So, it is necessary to think about the structure of the program in advance. In sophisticated software, it is a must to structure a software program into simple, reusable pieces of code. Object-Oriented Programming (OOPs) has all the required features. What is object-oriented programming (OOP)? Object-Oriented … Continue reading Object-Oriented Programming (OPPs)