:: Home

  login:         
  passwords:  

OOP Interview Questions and answers [Part 2]

The General Oop Interview Questions consists the most frequently asked questions in Oop. This list of 100+ questions guage your familiarity with the Oop . The q&a have been collected over a period of time from various blogs, forums and other sites

2. OOP Interview Questions and FAQs [Part 2]

    2.1 What is multi level inheritance?
    2.2 What is a mixin class?
    2.3 Difference between data encapsulation and abstraction?
    2.4 What is the difference between encapsulation and data hiding?
    2.5 Why do you need abstraction?
    2.6 What is the difference between instance and object?
    2.7 Difference between data abstraction & encapsulation?
    2.8 What is difference between void and null pointer?
    2.9 What is global constructor?
    2.10 What is the difference between implicit function & explicit function?
    2.11 What is factory class?
    2.12 How do you differentiate a constructor from a ordinary function?
    2.13 What is ASSERT STATEMENTS?
    2.14 What is stack unwidening?
    2.15 Can we inherit private members of class ?
    2.16 What is size of class having no variable & 1 function which returns int?
    2.17 Can we create a object of Base class?If we can not create a object of base class then why we need Abstract class?
    2.18 What is the similarities between macro and function?
    2.19 What do you mean by realization in oops,? what is presistent,transient object?
    2.20 What is late bound function call and early bound function call?

2.1 What is multi level inheritance?

The best example is Say we have 3 class ClassA,ClassB and ClassC. ClassB is derived from ClassA and ClassC is derived ClassB this is multi level inheritance.


2.2 What is a mixin class?

Mixin is a class that does not implement any method but are in fact has only pure virtual methods. The implementor decides the logic for these methods. The term mixin were originally explored in the Lisp language In C++, the term has been used to describe classes in a particular (multiple) inheritance arrangement:
As superclasses of a single class that themselves have a common virtual base class .
We would like to specify an extension without pre- determining what exactly it can extend. This is equivalent to specifying a subclass while leaving its superclass as a parameter to be determined later. The benefit is that a single class can be used to express an incremental extension, valid for a variety of classes.


2.3 Difference between data encapsulation and abstraction?

Wrapping of data and function together is called encapsulation.


2.4 what is the difference between encapsulation and data hiding?

Encapsulation is the concept of grouping of datamembers and member functions.Data hiding means we cannot use the datamembers out side of the class.


2.5 Why do you need abstraction?

If you want to develop any program you need abstract idea to start. So you will abstract the things according to program. As you want to develop a library software you will not abstract any motor or financial things in your abstraction.


2.6 What is the difference between instance and object?

When we create object from a class, it is created on stack or on heap. The existance of an object in memory (stack or heap) is called instance of an object. Hence Instance and object is used interchangeably.


2.7 Difference between data abstraction & encapsulation?

Data Abstraction is removing unnecessary details.
Data Encapsulation is wrapping up the data into the single frame called class, for further reusability


2.8 What is difference between void and null pointer?

Void pointer is a pointer it is automatically type casted, we can assign to any pointer. But NULL pointer is a pointer which holds 0 (zero) as its content. (i.e) It doesn't pointing anything.


2.9 What is global constructor?

global constructors and destructors in C++ have to be handled very carefully to meet the language specification. Constructors have to be called before the main function. Destructors have to be executed after it returns. The answer of this question is static variables.


2.10 What is the difference between implicit function & explicit function?

Implicit cursor we have to open and close for it's usage.It will not automatically close. Explicit cursor will automaticlly open and close.
eg: for x in (exp.) where x is the cursor name exp. is an expression.This will automatically open the cursor x and will close at the time of "end loop"


2.11 What is factory class?

A Factory class is one that is used to return instances of other classes. This is generally used in the context of Factory Design Pattern.


2.12 How do you differentiate a constructor from a ordinary function?

There are three differences. 1. In Java constructor has its class name. that can be unique. In .NET it has "NEW" by name. 2.It does not have any return type. 3. It cannot be subclass.


2.13 what is ASSERT STATEMENTS?

An ASSERT statement is used to check the value of a single variable at a particular location in the program. It may be placed at any point that a C++ / Java statement could be placed. In the following example, an ASSERT statement is used to insure that the variable x does not have a negative value after the assignment statement. . . . . x = y ; ASSERT( x >= 0, "x has a negative value") ; cout << "Value of x is " << x << endl ; . . . . ASSERT statements are useful to verify that values computed within methods/functions are within acceptable bounds. An ASSERT statement may only be used as a Definition Placed assertion.


2.14 What is stack unwidening?

Stack unwidening means,,, reversing the stack for push and pop opereation,then the stack top will pointing to the bottom element of the stack... to the class.


2.15 Can we inherit private members of class ?

we cannot inherit private members of a class


2.16 What is size of class having no variable & 1 function which returns int?

Integer constant always occupies two bytes in memory,so in 16 bits ,highest bit is used to store the sign of the integer.


2.17 Can we create a object of Base class?If we can not create a object of base class then why we need Abstract class?

Yes, we can create an object of the Base class. If we make a class as abstract then we can't create an object of that class. we can create only pointer of that class this is because to provide one interface to access and so that runtime time polymorphism can implement.


2.18 What is the similarities between macro and function?

macro are the special function but they consume very less time with respect ot function but there is some restriction in macro you do not use recursion as u can do in function.


2.19 What do you mean by realization in oops,? What is presistent,transient object?

Persistent Object is nothing but where we can store information permanently where as in Transient Object infomration is stored temporarily.


2.20 What is late bound function call and early bound function call?

Functions are boud to there address so that they could be executed. if the address of the functions are known durning compile time the compiler binds it, this kind of binding is known as compile time binding or early binding. Where as when we dont know which function needs to be exucuted during compile time (as in case of dynamic polymorphism), compiler uses mechaninsm of virtual table and binds the function address during runtime. this is known as runtime binding or late binding.

Copyright 2007, Megasolutions Ltd