|
Object Oriented Interview Questions and Answers
What is the difference
between superclass and subclass?
A super class is a class that is inherited whereas sub class is a class that
does the inheriting.
What is difference
between overloading and overriding?
a) In overloading, there is a relationship between methods available in the
same class whereas in overriding, there is relationship between a superclass
method and subclass method.
b) Overloading does not block inheritance from the superclass whereas
overriding blocks inheritance from the superclass.
c) In overloading, separate methods share the same name whereas in
overriding, subclass method replaces the superclass.
d) Overloading must have different method signatures whereas overriding must
have same signature.
How many ways can an
argument be passed to a subroutine?
An argument can be passed in two ways. They are Pass by Value and Passing by
Reference.
Passing by value: This method copies the value of an argument into the
formal parameter of the subroutine.
Passing by reference: In this method, a reference to an argument (not the
value of the argument) is passed to the parameter.
What is the difference
between procedural and object-oriented programs?
1. In procedural program, programming logic follows certain procedures and
the instructions are executed one after another. In OOP program, unit of
program is object, which is nothing but combination of data and code.
2. In procedural program, data is exposed to the whole program whereas in
OOPs program, it is accessible with in the object and which in turn assures
the security of the code.
What are the advantages
of OOPL?
Object oriented programming languages directly represent the real life
objects. The features of OOPL as inheritance, polymorphism, encapsulation
makes it powerful.
Can a method be
overloaded based on different return type but same argument type ?
No, because the methods can be called without using their return type in
which case there is ambiguity for the compiler.
What is Downcasting ?
Downcasting is the casting from a general to a more specific type, i.e.
casting down the hierarchy.
Who were the three
famous amigos and what was their contribution to the object community?
The Three amigos namely,
James Rumbaugh (OMT): A veteran in analysis who came up with an idea about
the objects and their Relationships (in particular Associations).
Grady Booch: A veteran in design who came up with an idea about partitioning
of systems into subsystems.
Ivar Jacobson (Objectory): The father of USECASES, who described about the
user and system interaction.
What is meant by
“method-wars”?
Before 1994 there were different methodologies like Rumbaugh, Booch,
Jacobson, Meyer etc who followed their own notations to model the systems.
The developers were in a dilemma to choose the method which best
accomplishes their needs. This particular span was called as “method-wars”
Page Numbers : 1
2
3
4
5
Have a Question ?
post your questions here. It
will be answered as soon as possible.
Check
Structs Interview
Questions for more Structs Interview Questions with answers
Check
Job Interview Questions
for more Interview Questions with Answers
|