ASP .NET Interview Questions (Part-2)
I had discussed some Interview Questions in my previous article ASP .NET Interview Questions (Part-1) Which covered the basic concepts of OOP. In this article, I will discuss some more Interview Questions which will cover some remaining important concepts of OOP.
Question # 1: What is the difference between Overloading and Overriding?
Overloading: If a class has two functions with the same name and different parameters, then this is called the Overloading of Methods.
Overriding: If a child class implements the method which was already implemented in its parent class, then this is called Overriding. In this case, both functions have the same name and same parameters.
Question # 2: What is Polymorphism?
Polymorphism is a phenomenon in which different classes implement a single class or a single interface and in which different classes use a single function differently according to their requirements.
Example: For example, we have two classes “Carpenter” and “Tailor”. Let’s say that both the classes implement an Interface “Worker” which has a function named “Work” then both the classes will implement this function in different ways. This function will be related to Wood Work for carpenter and will be related to Clothes Work for Tailor.
Question # 3: What are Encapsulation and Abstraction? How are they Different?
It is the phenomenon in which only necessary details will be visible to the user; all unnecessary details (implementation details) will remain hidden from the user.
It is the phenomenon of wrapping up the detailed and complexed data under a single unit for minimizing the complexity of code.
Example: For Example, when a user creates an account on any website, System Understanding is not necessary for him, he only fills up his details and got registered. So, in this scenario, unnecessary details remain hidden from the user which means that this “Registration Process” exhibits the phenomenon of Abstraction.
Example: For Example, We create a Function “Registration”, and then We wrap the actions like Creating Database Connection, Checking the existence of Email, and Adding the user in the Database in this single unit so rather than using all the actions for every registration, we can simply use this function for registering on the website. This wrapping exhibits the phenomenon of Encapsulation.
Question # 4: What are Sealed Classes?
The classes which do not support inheritance are called sealed classes. For creating sealed classes, we use the keyword “sealed” before the class.
Question # 5: What are Constructors and Deconstructors?
Constructor: The method which is called at the time of Initialization of the Object is called the constructor.
Deconstructor: The method which is called at the time of Disposal of the Object is called Deconstructor.
Example: For example, if a class is using the Database Connection, then we can Start Database Connection in Constructor and we can Close Database Connection in Deconstructor.
I tried to give you an easy understanding of all the questions so I hope that this article will be helpful for your Interview.
Here is the video where I explained these questions in very easy words.
Must watch this video (In Urdu):
Posted: 03 May 2021
Visit for more
I am Programmer, I love writing about technology. You can contact me for any suggestions & feedback about this website. Keep writing & reading awesome articles.
() () ()