Being one of the important programming, the questions about OOP are frequently asked about OOP in the jobs interviews. So, my purpose of writing this article is to aware you about the most crucial part of your interview and I’m sure that it would definitely help you out guys. I will also suggest suitable answers for the questions.
This is the first question that you may encounter from the interviewer about the OOPquestions. So, there are four basic concepts on which OOP depends.
It could be the second question from the interviewer, abstract class is a class which cannot be formed by itself. It cannot be created but inherited. Abstract class only contains Abstract methods.
Inheritance can be defined as that when an object of class is fully based on another class for all of its properties and using all of its implementations and maintaining the same behavior (inheriting from a class)
Overloading is the method which creates more than one method with same name but different parameter in same class while overriding creates two or more methods with same name and same parameter in different classes.
Abstraction and encapsulation are a bit different but the origin is same. The abstraction is based of design while the encapsulation is based on implementation. Abstraction focuses on interface while the encapsulation focuses on behavior of that object.
1. What Are the Basic Concepts Of OOP?
This is the first question that you may encounter from the interviewer about the OOPquestions. So, there are four basic concepts on which OOP depends.
- Inheritance
- Encapsulation
- Abstraction
- Polymorphism
2. What is Abstract Class?
It could be the second question from the interviewer, abstract class is a class which cannot be formed by itself. It cannot be created but inherited. Abstract class only contains Abstract methods.
3. What is Inheritance?
Inheritance can be defined as that when an object of class is fully based on another class for all of its properties and using all of its implementations and maintaining the same behavior (inheriting from a class)
4. Differentiate Between Method Overriding and Method Overloading
Overloading is the method which creates more than one method with same name but different parameter in same class while overriding creates two or more methods with same name and same parameter in different classes.
5. Differentiate Between Abstraction and Encapsulation
Abstraction and encapsulation are a bit different but the origin is same. The abstraction is based of design while the encapsulation is based on implementation. Abstraction focuses on interface while the encapsulation focuses on behavior of that object.
6. What Are Different Types of Arguments?
Arguments are always passed to the function and it should match to the parameters defined during the declaration of the function. There are two types of arguments:
- Call by value
- Call by reference
7. What is An Interface?
An interface is usually defined as the collection of the abstract methods. For example, if the class implements an inheritance, then what happens if that it inherits all the abstract method of an interface.
8. What are Tokens?
Token is recognized by a compiler and it can’t be broken down into components. Punctuation are considered as tokens and brackets, commas, keywords, constants and string literals are examples of tokens.
9. Define Some Types of Constructors.
An interviewer always tries to ask the practical questions which usually help us in practical work. This question is one of them. Well, there are five types of constructors.
- Copy constructor
- Private constructor
- Default constructor
- Parameterized constructor
- Static constructor
10. What is Inline Function?
An inline function is one qualified with the keyword inline, this serves our two core purposes. First it serves as a compiler directive and the second purpose of inline function is that it acts as change linkage behavior.
0 comments:
Post a Comment