Friday, January 3, 2014

C++ important interview questions and exam notes

  1. Important benefits OOPS programming in C++
    Encapsulation- Securing data in single unit in form of class.
    Data Abstraction- Creating new user defined data types modeling real world entities complete with built in data type properties and allowed operators.
    Inheritance- Allows a sub class to inherit the properties of the base class. Help avoid the problem of rewriting the code again and again in a program.
    Multiple Inheritance- Type of inheritance where there are multiple base classes each with its own instance variable
    Polymorphism- Single name/operator associated with multiple operations depending on the type of data. It is done by operator overloading, function overloading and dynamic binding (virtual functions).
    Message Passing- It invokes an operation on an object by passing a message
    Genericity- It is declaration of data items without specifying data type. It is done when the data type is not fixed and varies according to the data passed to it. Example is sort() function. It is realized through function templates and class templates.
    Delegation- Based on the object view that an object can be a collection of multiple objects and relationships. That is it has a has a relationship or containership relationship. It is quite similar to inheritance in that it passes (delegates) a receiving operating to its delegate.
    Persistence- Object outlives the existence of its program execution period and exists during the program execution too. Supported in C++ by use of file streams.
    Extensibility- This is what is done by inheritance and abstract classes. They allow the extension of a software or function.