Top 50 Oops Interview Questions and Answers: Java PDF C# PDF C++ Programming Java Programming
Top 50 Oops Interview Questions and Answers: Java PDF C# PDF C++ Programming Java Programming
Top 50 OOPs Interview Questions and Answers for freshers and experienced are
below are below :
1. What is OOPS?
OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a
collection of objects. Each object is nothing but an instance of a class.
3. What is a class?
A class is simply a representation of a type of object. It is the blueprint/ plan/ template that describe the
details of an object.
4. What is an object?
Object is termed as an instance of a class, and it has its own state, behavior and identity.
5. What is Encapsulation?
http://www.itechaleart.com/2013/06/top-50-oop-interview-questions.html 1/7
1/16/2015 Top 50 OOPs Interview Questions and Answers - itechaleart
Encapsulation is an attribute of an object, and it contains all data which is hidden. That hidden data can be
restricted to the members of that class.
6. What is Polymorphism?
Polymorphism is nothing butassigning behavior or value in a subclass to something that was already declared
in the main class. Simply, polymorphism takes more than one form.
7. What is Inheritance?
Inheritance is a concept where one class shares the structure and behavior defined in another class.
Ifinheritance applied on one class is called Single Inheritance, and if it depends on multiple classes, then it is
called multiple Inheritance.
9. Define a constructor?
Constructor is a method used to initialize the state of an object, and it gets invoked at the time of object
creation.
Virtual function can be achieved in C++, and it can be achieved in C Languageby using function pointers or
pointers to function.
Friend can be declared anywhere in the class declaration, and it cannot be affected by access control
http://www.itechaleart.com/2013/06/top-50-oop-interview-questions.html 2/7
1/16/2015 Top 50 OOPs Interview Questions and Answers - itechaleart
Example:
void add(int& a, int& b);
void add(double& a, double& b);
void add(struct bob& a, struct bob& b);
Example:
class complex {
double real, imag;
public:
complex(double r, double i) :
real(r), imag(i) {}
complex operator+(complex a, complex b);
complex operator*(complex a, complex b);
complex& operator=(complex a, complex b);
}
a=1.2, b=6
A method that is declared as abstract and does not have implementation is known as abstract method.
Syntax:
abstract void show(); //no body and abstract keyword
http://www.itechaleart.com/2013/06/top-50-oop-interview-questions.html 3/7
1/16/2015 Top 50 OOPs Interview Questions and Answers - itechaleart
Even punctuation characters are also considered as tokens – Brackets, Commas, Braces and Parentheses.
Overriding is the same method names with same arguments and return types associates with the class and
its child class.
http://www.itechaleart.com/2013/06/top-50-oop-interview-questions.html 4/7
1/16/2015 Top 50 OOPs Interview Questions and Answers - itechaleart
30. How can we call the base method without creating an instance?
Yes, it is possible to call the base method without creating an instance. And that method should be,.
Static method.
Doing inheritance from that class.-Use Base Keyword from derived class.
http://www.itechaleart.com/2013/06/top-50-oop-interview-questions.html 5/7
1/16/2015 Top 50 OOPs Interview Questions and Answers - itechaleart
Example -.
Virtual void function1() // Virtual, Not pure
Virtual void function2() = 0 //Pure virtual
42. What does the keyword virtual represented in the method definition?
It means, we can override the method.
be associated with the class during compilation time , and it is also called as early Binding.
Dynamic binding is a binding in which name can be associated with the class during execution time , and it is
also called as Late Binding.
50. Which OOPS concept exposes only necessary information to the calling functions?
Data Hiding / Abstraction
http://www.itechaleart.com/2013/06/top-50-oop-interview-questions.html 7/7