बुधवार, 12 अक्तूबर 2011

C++ interview question and answers for experienced



 C++



















What are containers in C++ and in Object Oriented Programming ? Which objects are available as containers ?
A container is an object that can store other objects as its elements. However all the objects stored in a container should be of the
same data type. E.g. array is a container as it allows you to store multiple objects. However there are a few problems with arrays like
an array can’t allow you to store an element anywhere in the middle of the array, an array cannot grow dynamically to append new
elements at the end of the array. A sequence container is the one which allows storing elements of the same type in a linear fashion.
There are three objects which are sequence containers: 1. Vector: an array like container that allows storing elements of the same
type and provides random access to these elements. Insertions and deletions at the end of the vector are efficient.2. List: provides
efficient insertions and deletions at any position within a list.3. dequeue: double ended queue with constant time insertions and
deletions both at the end and the beginning of the queue.
===================
Explain the Concept of Data Abstraction and Data Encapsulation in Object Oriented Programming (OOPS)
Data encapsulation: the wrapping up of data and functions that act upon that data in a single unit is termed as data encapsulation. It
binds together both the data and code and thus keeps both safe from the outside world. The data and the code to manipulate the data
are combined in such a way that a black box is created which is self contained and modular. This box is termed as a class in object
oriented terminology. Within a class the code or the data can be private or public. If it is private then these cannot be accessed by the
outside world whereas public means that the code and the data is accessible to everyone. Typically the data is private and the
methods are an interface to the private elements of the object. Data abstraction: The term data abstraction is similar to data
encapsulation. All the data and the methods that make sense to the objects of a class that is been designed need to be a part of the
class. All unnecessary details should be left behind. E.g. when designing a class to represent a student we need data elements such
as student no, student name, marks, grade, etc. If we now design a class representing a cricket player we need details like no of
centuries, striking rate, no of matches played, etc. It will not make sense to add the player’s marks, grades which are applicable to a
student class to this player class. The classes designed in object oriented language are also termed as User defined data types
(UDT).
========================
What are classes ? How are they defined ?
A class in an object oriented language is a User defined data type (UDT). A class is made up of member variables (data) and
member functions (interface).
A class is created or declared using the class keyword. It defines a new type to represent a real life entity. This type is composed of
data that is private to the class and accessible through the public member functions of the class.
As an analogy consider a home. A home is like an object that has a state (whether lights are on, number of walls, temperature, etc)
and it provides services (like buttons to switch off the lights, a thermostat that controls the temperature). This blueprint for a home is a
class since it defines the characteristics of a group of such houses.
Syntactically a class structure is similar to a structure except that everything in a class by default is made private whereas everything
is public in a structure by default.
E.g. class student{ public: //public interface private://private implementation}
================================
What are objects ? What is common between all objects of a class ?
Objects are physical or conceptual things that are found in the universe. Objects are thought of having state associated with them.
E.g. state of an account would be the account balance; the state of a clock would be the time.
In object oriented terminology a class is just a plain structure and an object is an instance of a structure. A class is a blueprint that
does not take memory however when a class is instantiated by creating an object of that class then each such object takes up
memory space.
All objects of a class have identical structure however each object will have its own private data. E.g. a class student will have multiple
instances of students where each student instance will have distinct values for their attributes.
Each object will have its own memory with its data however all the objects of a class share the member functions of a class.
E.g. we will define a class called account and create two objects of this class.
class Account
{
private:
double account_balance;
int account_no;
public:
double calculateInterest();
void deposit(double);
double withdraw();
}
==============================
State all the class access modifiers and explain each one of them
C++ has three access modifiers namely public, private and protected.
Public: a public modifier means that the data or the functions of a class are accessible by any program. There are no restrictions in
accessing public members of a class. Ideally all the functions that allow manipulating or accessing the class data are made public.
Private: the private keyword means that the data and member functions that are private cannot be accessed by other programs. They
are accessible only within the class or struct in which they are declared. If one tries to access the private members of a class it results
in a compile time error. Encapsulation is possible due to the private access modifier.
Protected: this access modifier plays a key role in inheritance. This keyword gives a protected access to the member variables and
functions which means that these are accessible from within the class as well as any classes that are derived from the class that
declared this member. However the protected members are not accessible to the any other programs.
=====================
What are Vectors in C++(Object Oriented Programming) and how are they used ?
Vector is a part of the sequential container which holds an ordered collection of elements of one type. A vector holds all these
elements in a contiguous area of memory. Random access of elements is efficient however insertion of elements at any other position
other than the end of the vector is inefficient since each element to the right of the element to be inserted has to be shifted one by one
which leads to inefficiency. Similarly deletion of an element besides the last element is inefficient as well.
The vector is a part of the std namespace and one must include #include header in order to use a vector.
#include
using namespace std;
int main()
{
vector v1;
v1.push_back(1);
v1.push_back(2);
}
The function capacity () returns the total number of elements that the vector can hold and size () returns the number of elements that
are currently stored in the vector
=====================
What are Iterators in C++ and Object Oriented Programming ? Explain where we use them
Iterators allow the traversal of a container object. They provide a generic interface to navigate a container without having to know the
actual type of its elements. Several member functions of containers like begin () and end () return a pointer to iterators. Begin ()
returns a pointer to the beginning of a container and end returns a pointer one position past the last valid element of a container. This
element past the last element marks the end of the container like a \0 is used to mark the end of strings.
The functions begin () and end () come in two flavors: const and non const. The non cons version returns non const iterator that
enables a user to modify the value of its container while const iterators cannot modify its container.
e.g. vector v1;
vector ::iterator p = v.begin ();
====================
What are the Algorithms namespace used for ?
Algorithms are an important part of STL. These are generic algorithms that can be applied to containers. The algorithms are divided
into three categories:
1. Non-modifying sequence operations: these algorithms do not directly modify the object they work on. These are basically the
search algorithms, checking for equality and counting. E.g. find () algorithm is used to locate an element within a sequence.
2. Mutations sequence operations: these algorithms modify the object that they operate on. These are operations such as copy,
fill, replace and transform. E.g. copy () algorithm is used to copy a sequence of objects to a target object.
3. sorting algorithms: these algorithms provide sorting and merging sequences and they operate on sorted sequences. E.g. sort
(), partial_sort (), binary_search (), etc.
==============================
What are Enumerations in C++ and Object Oriented Programming ? Explain with an example ?
An enumeration is a type that can hold a set of constant values that are defined by the user. Once you define an enumeration you can
use it like integer types.E.g. enum {OFF, ON};The enum defines two integer constants called enumerators and these constants are
assigned values by default. The value assigned to OFF = 0 and ON = 1. The above is an unnamed enumeration, however an enum
can be named. E.g. enum STATE {OFF, ON};Each enumeration is a distinct type and the type of the enumeration is the enumerator.
For example OFF is of type STATE. An enumerator can optionally be initialized by a constant expression of integral type. E.g. enum
{WHITE = 3, BLACK = 5}; A value of an integral type can be converter to an enumeration type. This needs to be done explicitly. The
results are undefined unless the value is within the range of the enumeration.E.g. enum COLORS {RED = 1; BLUE = 3, WHITE =
7};COLORS c1 = COLORS (5); All enumerators are converted to integral type for any arithmetic operation.
==============================
What are References in C++ and OOPS ? How are they used ?
A reference means an alias. It is an alternative name to an object. An object can have multiple references. However the most
important use of references is to pass arguments to function and return values for functions as well as for overloaded operators. E.g.
consider a reference for a variable x created as x1.int x = 10;int &x1 = x; To make sure that the reference denotes an object it has to
be initialized. Once initialized the value of a reference cannot be changed. In order to get a pointer to the object denoted by the
reference x1 we can write it as &x1; One of the important uses of reference is to pass an object to a function as a reference so that
the function can change the value of that object. e.g. void swap (int &a, int &b){ int tmp = a; a = b; b = a;}void main (){ int x =
10, y = 12; swap (x, y );} Since x and y are passed by reference to the function swap their values get actually swapped.
============================
Explain the Rules for using Default Arguments with an example in C++.
A default argument is used by functions to free the programmer from specifying values which can be set to default by the function.
E.g. consider a function for printing an integer. A user can be given an option to decide of what base the integer should be printed
however in most cases it will be decimal. E.g. void print (int value, int base = 10); //here the base is set to 10 by defaultThe above
function can be called as: print (10); //here default base will be taken as 10 print (10, 8); a function can specify a default argument
for one or more of its parameters at the initialization time within the parameter list. A function that has a default parameter can be
invoked with or without that parameter. If it gets invoked without the parameter then the default value applies to that parameter.
Arguments to the call are resolved by position and hence the default arguments can be specified as trailing arguments only.e.g. void
display (int a, int b = 0, int c = 9); // correct void display (int a = 0, int b, int c = 9); //wrong void display (int a = 0, int b = 9, int c);
//wrong The default arguments are specified in the function declaration and not in the function definition.
==================================
What do you mean by “Pointers to Function”? What are Function Pointers ?
We can use a function in two ways: one is to invoke a function and the second is to obtain the address of a function. This address that
is obtained is called as pointer to the function and is used to invoke the function.E.g. we have a function named display and we will
invoke this function using a pointer to this function as follow:void display (string s) /* … */void (*ptr)(string); //pointer to a function ptr =
&display; //assign the address of the function ptr (“hello”); // call the function In the above example the compiler will discover that ptr is
a pointer to the function display and calls the function. The dereferencing of a pointer to a function using a * is optional. Similarly it is
not necessary to use & to get the address to the pointer. As pointers to functions have argument types declared just like the functions
themselves, therefore in pointer assignments the complete function type must exactly match. A function name does not constitute its
type. A function type is determined by its return type and its parameter list
======================
What are NameSpaces in C++ ? How do we use namespaces in C++ ?
The purpose of namespaces is to reduce the name clashes that occur with multiple independently developed libraries. It is used to
package names, improve program readability and reduce the name clashes in the global namespace.
e.g. namespace mynamespace{ class Stack { }}The class Stack has to be referred as mynamespace::Stack.
In this way namespace facilitate building large systems by partitioning names into logical groups. Java has a similar concept called
packages. One can access the names within the namespace in the following ways: a. Use the scope resolution operator to prefix
the object declared in the namespace with the name of the namespace. e.g. mynamespace::Stack *s = new
mynamespace::Stack (); b. Using directive E.g. using namespace Stack; Stack *s = new Stack ();
===============
What is the Exception Handling mechanism in C++ ? What is Try and Catch in C++ ?
The ability to gracefully handle an error or an exception is known as exception handling. C++ has built exception handling techniques
which allows the program to handle and exceptions and deal with them.
- try block: the code that is likely to throw an exception should be enclosed in a try lock. This allows the function to recover from
this exception. If a code called from a try block cannot throw an exception then there is no need for the try block.
- Catch block: the exception that is thrown in the try block has to be caught in the catch block. There can be multiple catch blocks
for a try block however there cannot be any code between try and catch block. Once an exception is caught and if the function can
recover from that error then it can either continue normal processing or restart the try block by putting the try block in a loop. If
required the catch block can also propagate the exception to the calling function either by throwing the same exception object or
throwing a different exception object.
e.g.
try { File x (filename); } catch (BadFileName& e) { cout << " second(): " << e.what() << ": Partial recovery\n"; throw; } catch
(AccessViolation& e) { cout << " second(): " << e.what() << ": Full recovery\n"; }
* Login or register to post comments
Re: What is the Exception Handling mechanism in C++ ? What is Tr
Submitted by Anonymous on Wed, 2007-07-11 16:19.
Exception handling in C++ is complex and subtle. It is not as trivial as the above would make you believe.
If you are interested in learning, go and read Meyers, Sutter/GOTW et al.
For a proper treatment, you need to discuss (at a bare minimum):
- What happens to x when an exception is thrown.
- What happens if the destructor of File throws.
- Why you want to catch by reference.
- What can throw (answer: a lot more than you think).
- RAII.
===================================
What is Operator Overloading in C++ ?
The ability to overload operators is one of the most powerful features of C++. The operators are overloaded so that they can perform
special operations on the user defined classes. Say for example you create a class representing complex number. We can overload
the + operator to add two complex numbers. When an operator is overloaded it original meaning is not lost in fact the type of objects
that the operator can operate expands. Operators are overloaded by creating operator functions. It is created using the keyword
operator. These functions can either be member of a class or then they have to be friend functions. Syntax: returntype classname::
operator#(arg-list) { } E.g. class Complex { private: float real; float imaginary; public: Complex operator+ (Complex); };
//overloaded + operator for class Complex Complex Complex::operator+ (Complex c) { Complex tmp; tmp.real = this.real + c.real;
tmp.imaginary = this.imaginary + c.imaginary; return temp; } The only C++ operators that cannot be overloaded are dot (.), .*, ?:,
sizeof, typeid and scope resolution operator (::).
========================
What are Friend Functions and Friend Classes in C++ ?
A friend can be a function, another class or individual member function of a class. With the help of a friend function it is possible to
grant a non member function access to the private members of a class using a friend. A friend function has all access to all the
private and protected members of the class for which it is the friend. To declare a friend function includes the function prototype within
the class preceding it with the keyword friend. When a friend function is called it need to be qualified by the object name as it is not a
member function of the class. E.g. class Complex { private: float real; float imaginary; public: friend Complex operator+ (Complex,
Complex); };//overloaded + operator for class Complex Complex operator+ (Complex c, Complex d) { Complex tmp; tmp.real = d.real
+ c.real; tmp.imaginary = d.imaginary + c.imaginary; return temp; } To call the function: int main (){ Complex a, b, c; a = b + c; //this
will be called as operator+(b, c)} Friend classes are used when two or more classes are designed to work together and need access
to each other’s implementation. E.g. a class DataBaseCursor may want more privileges to the class Database. E.g. class
DatabaseCursor; class Database { //member variable and function declarations friend DatabaseCursor; };
=============================
What are Constructors and Destructors in C++ ?
A constructor constructs an object i.e. it initializes the objects internal data members as well as it may allocate resource (memory,
files, sockets, etc). The constructor has the same name as the class name and cannot have a return type not even void. A constructor
can take multiple arguments as its parameters. A class can have multiple constructors i.e. a constructor can be overloaded.
Whenever an object of a class is created it calls a constructor by default which is responsible for initializing the object. By default
every class has a default constructor which is a constructor with no arguments. However once you provide a constructor to a class
then the default constructor does not exist. e.g. class Stack{ int size;int top; int arr []; Stack(int a) //constructor of the class { size = a;
arr = new int[size]; }}; The destructor is the last member function called in the lifetime of a class object. Its job is to free the resources
that an object is holding. A class can have no more than a single destructor. The name of the destructor is ~ classname (). Like a
constructor, a destructor cannot have a void return type. e.g. ~Stack () //destructor { delete [] arr; }
======================
What is Inheritance ? How is a Class Inherited in C++ ?
Inheritance is one of the most important principles of object oriented language. Using inheritance one can create a class that can
have traits common to a set of related items. This class is then inherited by other classes each adding things are specific to them.
The class that is inherited is called the base class and the class that inherits from it is called as the derived class. When a class
inherits a base class, then all the members of the base class become members of the derived class. E.g. class derived-class-name::
access base-class-name{ //body of class}; The access of the members in the base class by derived class depends on the access
parameter. The access specifier must either be private, public or protected. If one doesn’t provide an access specifier then it is taken
as private by default. When access specifier is private then these members remain private to base class and the derived class cannot
access them. When access specifier is public then all the public members of a base class become public members of the derived
class and all the protected members of the base class become protected in the derived class. On using a protected access specifier
all public and protected members of the base class become protected members of the derived class.
================================
What are Virtual Functions ? Why do we need Virtual Functions? Explain with an example.
A function that is defined in a base class but overridden by the derived class is called a virtual function. To create virtual functions
precede the function declaration in the base class with the keyword virtual. When a class containing a virtual function is inherited the
derived class overrides the virtual function with its own definition. Virtual functions are like member functions however what makes
them different is the capability to support run time polymorphism when accessed via a pointer. A base class pointer can point to an
object of a derived class. When a base class pointer points to an object of a derived class that contains a virtual function, C++
determines which function version to call based on the type of object pointed by the base class pointer. This is runtime polymorphism
as it can be determined at run time. In this way when different objects are pointed to then different versions of virtual functions are
executed. Whenever a virtual function is defined all aspects of its prototype should match. Also virtual functions should be non static
members of the class and they cannot be friend functions too. E.g. class base { public: virtual void display (); }; class derived: public{
public: virtual void display ();};base *p, b;derived d1, d2;p = &b;p->display (); //calls base class functionp = &d1;p->display (); //calls
derived class function
======================
What are Templates in C++ ? How are Templates declared and used ?
Many data structures and algorithms can be defined independently of the type of data they manipulate. A template allows the
separation of the type dependent part from the type independent part. This results in a significant amount of code reusability.
Templates can be class templates or function templates. A class template is used for creating a class in which one more values are
parameterized. The syntax of a class template is:
template class class-name{ ...};
A class template can also have multiple parameters.
template class class-name{ ...};
Example -
template class Array{ private: T *arr []; public: Array (int size = 10); };template Array::Array(int
size){ arr = new T[size];}
Create an Array object as: Array a; The function template is also written using the keyword template.
E.g. template class void push (T &element) { arr[top] = elemen
========================
What is Polymorphism ? How is Polymorphism achieved in C++ ?
Polymorphism is one of the most important principle of object oriented language. Polymorphism means many forms i.e. one interface
multiple methods. The specific method to call depends on the nature of the situation. No matter what type of car it is the driving
mechanism is the same. For example, you might have a program that defines three different types of stacks. One stack is used for
integer values, one for character values, and one for floating-point values. Because of polymorphism, you can define one set of
names, push() and pop() , that can be used for all three stacks. In your program you will create three specific versions of these
functions, one for each type of stack, but names of the functions will be the same. The compiler will automatically select the right
function based upon the data being stored. Thus, the interface to a stack—the functions push() and pop() —are the same no matter
which type of stack is being used. C++ supports both run time and compile time polymorphism. Function overloading is a form of
compile time polymorphism while dynamic binding is a form of runtime polymorphism.
===============
What are the Standard Exceptions in C++ ?
C++ defined a hierarchy of standard exceptions that are thrown at runtime whenever an abnormal condition takes place. These
exceptions are derived from std::exception class defined in the header. Since there is a common base class of all these exceptions it
enables the application to catch these exceptions in a single catch statement. E.g. catch (std::exception &e){//code to handle the
exception} Some of the standard exceptions that are built in the language are: - std::bad_alloc: thrown by operator new -
std::bad_cast: as a result of dynamic_cast - std::bad_typeid: as a result of operator typeid - std::bad_exception: Whenever you want
to catch all exceptions then the exception parameter in the catch block should be an ellipsis. E.g. catch (…){ //this block will catch all
exceptions}
==============
What is Multiple Inheritance in C++ ? Explain with an example
It is possible for a derived class to inherit more than a single base class. This is referred as multiple inheritance. The class inherits
from multiple base classes where these classes are comma separated. Each listed base class must specify its own access level.
E.g.
class base1
{}
;
class base2
{}
;
class derived: public base1, public base2
{
};
The base class constructors are invoked in the declaration order within the class derivation list. In the above example the constructor
for base1 will be called first followed by the base2 constructor. Similarly the order of destructor is reverse of the constructor order.
If a class inherits from one or more base classes which themselves inherit from a common base class then it can lead to problems. In
such case one should use virtual inheritance. Under virtual inheritance only a single shared base class object is inherited regardless
of how many times the base class occurs in the derivation hierarchy.
E.g.
class derived: public virtual base1, public virtual base2
{}
;
==================
What is a Copy Constructor in C++ ? Give an example
Copy constructor is a type of constructor which constructs an object by copying the state from another object of the same class.
Whenever an object is copied, another object is created and in this process the copy constructor gets called. If the class of the object
being copied is x, the copy constructor’s signature is usually x::x (const x&).
Let’s take an example to illustrate this:
class Complex
{ int real, img;
public:
Complex (int, int);
Complex (const Complex& source); //copy constructor
};Complex:: Complex (const Complex& source)
{ this.real =
source.real;
this.img = source.img;
}
main ()
{
Complex a (2, 3);
Complex b = a; // this invokes the copy constructor
}
A copy constructor is called whenever an object is passed by value, returned by value or explicitly copied.
==================================
What is Function Overloading in C++ ?
Function overloading is the process of using the same name for two or more functions. However each function will be different in
terms of either different types of parameters or a different number of parameters. It is only through these differences that the compiler
knows which function to call in any given situation. Even if the number of parameters are same and types are same but they are
written in a different order then these functions will still be considered different. The return type parameter does not hold any
relevance to make two functions distinct. E.g. void display (int a);void display (string str); Both the above functions have the same
name but different parameters. So when a function display (2) is called the compiler calls the first function and when the argument
passed to display is a string then the second version is invoked.E.g. int display (int a );void display (int a); In the above example the
compiler will generate a compile time error as the return types are insufficient to overload functions
====================================
What are Pointers in C++ (Object Oriented Programming) ?
Pointers are used to store memory address values of objects. C++ defines a special address-of operator that when applied to an
object returns that object’s address value. E.g. int *pint; //this defines a pointer variableIn order store the address of the variable ‘j’ into
pint one should assign the address of j into pint variable as follows:pint = &j; // assigning the address of variable j into pointer pint In
order to access the actual object pint addresses we must first dereference pint using the dereference operator (*). *pint = *pint + 1; //
this statement will increment the value pint points to by 1 The type of the pointer variable should be the same as the variable whose
address it is used to hold. E.g. you cannot define a pointer variable of type float and use it to assign the address of a variable of type
integer
========================
What are volatile variables ? Explain Volatile variables
A variable is declared as volatile if its value can possibly be changed in ways outside either the control or detection of the compiler.
For example a variable that is updated by the system clock. Certain optimizations ordinarily performed by a compiler should therefore
not be applied to objects the programmer specifies as volatile. The volatile qualifier is used in much the same way as is the const
qualifier as an additional modifier to a type.E.g. volatile int count_value; The purpose of defining a variable as volatile is to inform the
compiler that the variable can change in ways undetectable by the compiler and hence the compiler should not perform any kind of
optimizations on these variables.
============================
What is the Difference between Overloaded Functions and Overridden Functions ?
In C++, overloading is simply the use of the same function identifier for different functions declared in the same scope.
E.g. void display (int);void display (string);
The above two functions are clearly overloaded. The compiler will distinguish among them by the actual argument used in the call to
display.
Overriding can occur only in the presence of a base class virtual function. Overriding has nothing whatsoever to do with overloading.
A nonvirtual base class function cannot be overridden, only hidden. In overriding the function prototype in the derived class has to be
exactly the same as the one in the base class
=============================
What are Inline Functions ? When are Inline Functions used ?
The idea behind inline functions is to insert the code of a called function at the point where the function is called. It is useful to
distinguish between "inline," a keyword qualifier that is simply a request to the compiler, and "inlined," which refers to actual inline
expansion of the function. A function can be decorated with the inline keyword either in the class definition or in its own definition if the
definition physically occurs before the function is invoked. The compiler does not promise that an inline function will be inlined, and the
details of when/when not are compiler-dependent. On the other hand, any function that is defined within the class body will be treated
implicitly as an inline function with or without the explicit inline keyword. Inline code is faster than a function call for two reasons. First,
a CALL instruction takes time to execute. Second, if there are arguments to pass, these have to be placed on the stack, which also
takes time
============================
What are Mutable and Const in C++ ?
Class member functions may be declared as const, which causes them to be treated as a const pointer. Thus, that function cannot
modify the object that invokes it. Also, a const object may not invoke a non-const member function. However, a const member
function can be called by either const or non-const objects. Sometimes there will be one or more members of a class that you want a
const function to be able to modify even though you don't want the function to be able to modify any of its other members. You can
accomplish this through the use of mutable. It overrides constness. That is, a mutable member can be modified by a const member
function. E.g. class MyClass{ int i; mutable int j; Public: void setValues const () { i = 10; //wrong j = 15; //correct }};
===========================
What is ‘this’ Pointer (object) in C++
When a member function is called, it is automatically passed an implicit argument that is a pointer to the invoking object (that is, the
object on which the function is called).This pointer is called this.Within a member function, the members of a class can be accessed
directly, withoutany object or class qualification. The this pointer points to the object that invoked the member function. Also the this
pointer is automatically passed to all member functions. Another thing to note is that the friend functions are not members of a class
and, therefore, are not passed a this pointer. Second, static member functions do not have a this pointer. e.g. class Stack { int top; int
size; Stack (int top, int size) { this.top = top; this.size = size; }};
========================
What is Scope Resolution Operator in C++?
There are two used of the scope resolution operator in C++. The first use being that a scope resolution operator is used to unhide the
global variable that might have got hidden by the local variables. Hence in order to access the hidden global variable one needs to
prefix the variable name with the scope resolution operator (::). e.g. int i = 10; int main () { int i = 20; Cout << i; // this prints the value
20 Cout << ::i; // in order to use the global i one needs to prefix it with the scope //resolution operator. } The second use of the
operator is used to access the members declared in class scope. Whenever a scope resolution operator is used the name of the
member that follows the operator is looked up in the scope of the class with the name that appears before the operator.
==================================
What is Scope Resolution Operator in C++?
There are two used of the scope resolution operator in C++. The first use being that a scope resolution operator is used to unhide the
global variable that might have got hidden by the local variables. Hence in order to access the hidden global variable one needs to
prefix the variable name with the scope resolution operator (::). e.g. int i = 10; int main () { int i = 20; Cout << i; // this prints the value
20 Cout << ::i; // in order to use the global i one needs to prefix it with the scope //resolution operator. } The second use of the
operator is used to access the members declared in class scope. Whenever a scope resolution operator is used the name of the
member that follows the operator is looked up in the scope of the class with the name that appears before the operator.
===================
What are Const Member Functions in C++ ?
There can be two cases in which a member function can be declared as a const function: whenever the member function wants to
guarantee that it won't make any changes to its this object or whenever a caller needs to invoke the member function via a referenceto-
const or pointer-to-const. The compiler wont allow a const member function to change *this or to invoke a non-const member
function for this object. E.g. int getCount() const;int getCount () const{ //function definition}
===========================
Explain Composition in C++ with an example
Composition allows software to be developed by assembling existing components rather than creating new ones. Composition is also
sometimes called as aggregation and defines the process of putting an object inside another object. It models the has-a relationship.
E.g. a class employee can contain an object of type salary which itself is another type of object. e.g.
class Salary{ private: double DA; double HRA; double travelAllowance; double basic salary; public: //member functions};Class
Employee{ private: int empno; Salary salary; //composition: salary object is contained inside employee public: //member functions};
==================
What do you mean by ‘Return by Reference’ in C++ ?
A function can be declared to return a pointer or a reference. When the function is returning a reference, the calling function receives
the lvalue for the variable. The calling function can then modify the variable or take its address.
If the return value is a large class object, using a reference (or pointer) return type is more efficient than returning the class object by
value. In some cases, the compiler can automatically transform a return by value to a return by reference.
E.g.
Complex& compute (Complex c)
{
Complex *tmp = new Complex ();
// …
return tmp;
}However care should be exercised when returning a reference to a local object. The lifetime of the local object terminates with the
termination of the function. The reference is left aliasing undefined memory after the function terminates.
====================
What are static Data and Static Member Functions in C++ ?
Static data members are data and functions that are associated with the class itself, rather than with the objects of the class. For
example a count is needed of how many objects of a particular class type have been created at any one point in the program. A static
data member acts as a global object that belongs to its class type. Unlike other data members where each class object has its own
copy, there is only one copy of a static data member per class type. A static data member is a single, shared object accessible to all
objects of its class type. A data member is made static by prefixing the data member declaration within the class body with the
keyword static or prefixing the function declaration with the keyword static. A static function cannot access any other member
variables of the object. One does not need to create a class object for accessing a static member or a static function; a static function
can be invoked using the class name as class_name::static_member_function. e.g. class ShoppingCart{ private: static int totalItems;
//static data member public: static int getTotalItems (); //static member function};

What is a Pure Virtual Member Function ?
Whenever a virtual function in a base class is not redefined by the derived class then the version defined in the base class will be
used. However in many cases it may so happen that there can be no meaningful definition of a virtual function within the base class.
Or you may want to ensure that all derived classes override a virtual function. To handle both these cases the solution is a pure virtual
function.
A pure virtual function is a function that has no definition in the base class. The definition of such a function is equal to 0.E.g. void
draw () = 0; // this is a pure virtual function
If a class contains at least one virtual function then that class is called an abstract class and one cannot create an instance of an
abstract class. Also if a class inherits from a class that contains a pure virtual function then the derived class has to provide a
definition for the pure virtual function. Failure to do so will result in an abstract derived class.
==============================
What are Preprocessor Directives ?
The preprocessor directives are instructions to the compiler. All these preprocessor lines begin with a pound (#). They are executed
before the compilation of the code begins. These directives can only span a single line and does not need to end in a semicolon.
The preprocessor contains the following directives:
- #define: this defines an identifier and some value to this identifier. This value can be any character sequence and will be substituted
in the code file for each instance of the corresponding identifier.
e.g. #define MIN 0
- #include: it tells the compiler to link to another source file. The name of the source file can be in angle brackets or double quotes.
e.g. #include
- #error: tells the compiler to stop compilation. Used primarily for debugging purposes.
- #if:
- #elif
- #endif
- #else: The above four directives are conditional directives. They allow you to conditionally include portions of code based on
outcome of a constant expression.
E.g. #if OPTION == 1
//do something
#else
//do something else
#endif
- #ifndef
- #undef: the above indicates conditional compilation dependinf upon if a variable is defined or not defined.
======================================

C++ INTERVIEW QUESTIONS



















What is encapsulation??
Containing and hiding information about an object, such as internal data structures and
code. Encapsulation isolates the internal complexity of an object's operation from the rest
of the application. For example, a client component asking for net revenue from a business
object need not know the data's origin..

What is inheritance?
Inheritance allows one class to reuse the state and behavior of
another class. The derived class inherits the properties and method implementations of
the base class and extends it by overriding methods and adding additional properties and
methods.

What is Polymorphism??
Polymorphism allows a client to treat different objects in the same way even if they were
created from different classes and exhibit different behaviors. You can use implementation
inheritance to achieve polymorphism in languages such as C++ and Java. Base class object's
pointer can invoke methods in derived class objects. You can also achieve polymorphism in
C++ by function overloading and operator overloading.

What is constructor or ctor?
Constructor creates an object and initializes it. It also creates vtable for virtual
functions. It is different from other methods in a class.


What is destructor?
Destructor usually deletes any extra resources allocated by the object.

What is default constructor?

Constructor with no arguments or all the arguments has default values.

What is copy constructor?
Constructor which initializes the it's object member variables ( by shallow copying) with
another object of the same class. If you don't implement one in your class then compiler
implements one for you.
for example:
Boo Obj1(10); // calling Boo constructor
Boo Obj2(Obj1); // calling boo copy constructor
Boo Obj2 = Obj1;// calling boo copy constructor

When are copy constructors called?
Copy constructors are called in following cases:
a) when a function returns an object of that class by value
b) when the object of that class is passed by value as an argument to a function
c) when you construct an object based on another object of the same class
d) When compiler generates a temporary object

What is assignment operator?

Default assignment operator handles assigning one object to another of the same class.
Member to member copy (shallow copy)

What are all the implicit member functions of the class? Or what are all the functions which
compiler implements for us if we don't define one.??

default ctor
copy ctor
assignment operator
default destructor
address operator


What is conversion constructor?

constructor with a single argument makes that constructor as conversion ctor and it can be
used for type conversion.
for example:
class Boo
{
public:
Boo( int i );
};
Boo BooObject = 10 ; // assigning int 10 Boo object

What is conversion operator??
class can have a public method for specific data type conversions.
for example:
class Boo
{
double value;
public:
Boo(int i )
operator double()
{
return value;
}
};
Boo BooObject;
double i = BooObject; // assigning object to variable i of type double. now conversion
operator gets called to assign the value.
What is diff between malloc()/free() and new/delete?
malloc allocates memory for object in heap but doesn't invoke object's constructor to
initiallize the object.
new allocates memory and also invokes constructor to initialize the object.
malloc() and free() do not support object semantics
Does not construct and destruct objects
string * ptr = (string *)(malloc (sizeof(string)))
Are not safe
Does not calculate the size of the objects that it construct
Returns a pointer to void
int *p = (int *) (malloc(sizeof(int)));
int *p = new int;
Are not extensible
new and delete can be overloaded in a class
"delete" first calls the object's termination routine (i.e. its destructor) and then
releases the space the object occupied on the heap memory. If an array of objects was
created using new, then delete must be told that it is dealing with an array by preceding
the name with an empty []:-
Int_t *my_ints = new Int_t[10];
...
delete []my_ints;



What is the diff between "new" and "operator new" ?

"operator new" works like malloc.

What is difference between template and macro??
There is no way for the compiler to verify that the macro parameters are of compatible
types. The macro is expanded without any special type checking.
If macro parameter has a postincremented variable ( like c++ ), the increment is performed
two times.
Because macros are expanded by the preprocessor, compiler error messages will refer to the
expanded macro, rather than the macro definition itself. Also, the macro will show up in
expanded form during debugging.
for example:
Macro:
#define min(i, j) (i < j ? i : j)


template:
template
T min (T i, T j)
{
return i < j ? i : j;
}


What are C++ storage classes?
auto
register
static
extern
auto: the default. Variables are automatically created and initialized when they are defined
and are destroyed at the end of the block containing their definition. They are not visible
outside that block
register: a type of auto variable. a suggestion to the compiler to use a CPU register for
performance
static: a variable that is known only in the function that contains its definition but is
never destroyed and retains its value between calls to that function. It exists from the
time the program begins execution
extern: a static variable whose definition and placement is determined when all object and
library modules are combined (linked) to form the executable code file. It can be visible
outside the file where it is defined.

What are storage qualifiers in C++ ?
They are..
const
volatile
mutable

Const keyword indicates that memory once initialized, should not be altered by a program.
volatile keyword indicates that the value in the memory location can be altered even though
nothing in the program
code modifies the contents. for example if you have a pointer to hardware location that
contains the time, where hardware changes the value of this pointer variable and not the
program. The intent of this keyword to improve the optimization ability of the compiler.
mutable keyword indicates that particular member of a structure or class can be altered even
if a particular structure variable, class, or class member function is constant.
struct data
{
char name[80];
mutable double salary;
}
const data MyStruct = { "Satish Shetty", 1000 }; //initlized by complier
strcpy ( MyStruct.name, "Shilpa Shetty"); // compiler error
MyStruct.salaray = 2000 ; // complier is happy allowed

What is reference ??
reference is a name that acts as an alias, or alternative name, for a previously defined
variable or an object. prepending variable with "&" symbol makes it as reference. for
example:
int a;
int &b = a;

What is passing by reference?
Method of passing arguments to a function which takes parameter of type reference. for
example:
void swap( int & x, int & y )
{
int temp = x;
x = y;
y = x;
}
int a=2, b=3;
swap( a, b );
Basically, inside the function there won't be any copy of the arguments "x" and "y" instead
they refer to original variables a and b. so no extra memory needed to pass arguments and it
is more efficient.

When do use "const" reference arguments in function?
a) Using const protects you against programming errors that inadvertently alter data.
b) Using const allows function to process both const and non-const actual arguments, while a
function without const in the prototype can only accept non constant arguments.
c) Using a const reference allows the function to generate and use a temporary variable
appropriately.

When are temporary variables created by C++ compiler?
Provided that function parameter is a "const reference", compiler generates temporary
variable in following 2 ways.
a) The actual argument is the correct type, but it isn't Lvalue
double Cuberoot ( const double & num )
{
num = num * num * num;
return num;
}
double temp = 2.0;
double value = cuberoot ( 3.0 + temp ); // argument is a expression and not a Lvalue;
b) The actual argument is of the wrong type, but of a type that can be converted to the
correct type
long temp = 3L;
double value = cuberoot ( temp); // long to double conversion

What is virtual function?When derived class overrides the base class method by redefining the same function, then if
client wants to access redefined the method from derived class through a pointer from base
class object, then you must define this function in base class as virtual function.
class parent
{
void Show()
{
cout << "i'm parent" << endl;
}
};
class child: public parent
{
void Show()
{
cout << "i'm child" << endl;
}
};
parent * parent_object_ptr = new child;
parent_object_ptr->show() // calls parent->show() i
 now we goto virtual world...
class parent
{
virtual void Show()
{
cout << "i'm parent" << endl;
}
};
class child: public parent
{
void Show()
{
cout << "i'm child" << endl;
}
};
parent * parent_object_ptr = new child;
parent_object_ptr->show() // calls child->show()

What is pure virtual function? or what is abstract class?
When you define only function prototype in a base class without and do the complete
implementation in derived class. This base class is called abstract class and client won't
able to instantiate an object using this base class.
You can make a pure virtual function or abstract class this way..
class Boo
{
void foo() = 0;
}
Boo MyBoo; // compilation error

What is Memory alignment??

The term alignment primarily means the tendency of an address pointer value to be a multiple
of some power of two. So a pointer with two byte alignment has a zero in the least
significant bit. And a pointer with four byte alignment has a zero in both the two least
significant bits. And so on. More alignment means a longer sequence of zero bits in the
lowest bits of a pointer.

What problem does the namespace feature solve?
Multiple providers of libraries might use common global identifiers causing a name collision
when an application tries to link with two or more such libraries. The namespace feature
surrounds a library's external declarations with a unique namespace that eliminates the
potential for those collisions.
namespace [identifier] { namespace-body }
A namespace declaration identifies and assigns a name to a declarative region.
The identifier in a namespace declaration must be unique in the declarative region in which
it is used. The identifier is the name of the namespace and is used to reference its
members.

What is the use of 'using' declaration?

A using declaration makes it possible to use a name from a namespace without the scope
operator.

What is an Iterator class?

A class that is used to traverse through the objects maintained by a container class. There
are five categories of iterators: input iterators, output iterators, forward iterators,
bidirectional iterators, random access. An iterator is an entity that gives access to the
contents of a container object without violating encapsulation constraints. Access to the
contents is granted on a one-at-a-time basis in order. The order can be storage order (as in



the code within the function
definition for every instance of a function call. However, substitution occurs only at the
compiler's discretion. For example, the compiler does not inline a function if its address
is taken or if it is too large to inline.
What is overloading??
With the C++ language, you can overload functions and operators. Overloading is the practice
of supplying more than one definition for a given function name in the same scope.
- Any two functions in a set of overloaded functions must have different argument lists.
- Overloading functions with argument lists of the same types, based on return type alone,
is an error.
What is Overriding?
To override a method, a subclass of the class that originally declared the method must
declare a method with the same name, return type (or a subclass of that return type), and
same parameter list.
The definition of the method overriding is:
• Must have same method name.
• Must have same data type.
• Must have same argument list.
Overriding a method means that replacing a method functionality in child class. To imply
overriding functionality we need parent and child classes. In the child class you define the
same method signature as one defined in the parent class.
What is "this" pointer?
The this pointer is a pointer accessible only within the member functions of a class,
struct, or union type. It points to the object for which the member function is called.
Static member functions do not have a this pointer.
When a nonstatic member function is called for an object, the address of the object is
passed as a hidden argument to the function. For example, the following function call

myDate.setMonth( 3 );
can be interpreted this way:
setMonth( &myDate, 3 );
The object's address is available from within the member function as the this pointer. It is
legal, though unnecessary, to use the this pointer when referring to members of the class.

What happens when you make call "delete this;" ??
The code has two built-in pitfalls. First, if it executes in a member function for an
extern, static, or automatic object, the program will probably crash as soon as the delete
statement executes. There is no portable way for an object to tell that it was instantiated
on the heap, so the class cannot assert that its object is properly instantiated. Second,
when an object commits suicide this way, the using program might not know about its demise.
As far as the instantiating program is concerned, the object remains in scope and continues
to exist even though the object did itself in. Subsequent dereferencing of the pointer can
and usually does lead to disaster.
You should never do this. Since compiler does not know whether the object was allocated on
the stack or on the heap, "delete this" could cause a disaster.

How virtual functions are implemented C++?
Virtual functions are implemented using a table of function pointers, called the vtable.
There is one entry in the table per virtual function in the class. This table is created by
the constructor of the class. When a derived class is constructed, its base class is
constructed first which creates the vtable. If the derived class overrides any of the base
classes virtual functions, those entries in the vtable are overwritten by the derived class
constructor. This is why you should never call virtual functions from a constructor: because
the vtable entries for the object may not have been set up by the derived class constructor
yet, so you might end up calling base class implementations of those virtual functions

What is name mangling in C++??
The process of encoding the parameter types with the function/method name into a unique name
is called name mangling. The inverse process is called demangling.
For example Foo::bar(int, long) const is mangled as `bar__C3Fooil'.
For a constructor, the method name is left out. That is Foo::Foo(int, long) const is mangled
as `__C3Fooil'.

What is the difference between a pointer and a reference?
A reference must always refer to some object and, therefore, must always be initialized;
pointers do not have such restrictions. A pointer can be reassigned to point to different
objects while a reference always refers to an object with which it was initialized.

How are prefix and postfix versions of operator++() differentiated?
The postfix version of operator++() has a dummy parameter of type int. The prefix version
does not have dummy parameter.

What is the difference between const char *myPointer and char *const myPointer?
Const char *myPointer is a non constant pointer to constant data; while char *const
myPointer is a constant pointer to non constant data.

How can I handle a constructor that fails?
throw an exception. Constructors don't have a return type, so it's not possible to use
return codes. The best way to signal constructor failure is therefore to throw an exception.

How can I handle a destructor that fails?
Write a message to a log-file. But do not throw an exception.
The C++ rule is that you must never throw an exception from a destructor that is being
called during the "stack unwinding" process of another exception. For example, if someone
says throw Foo(), the stack will be unwound so all the stack frames between the throw Foo()
and the } catch (Foo e) { will get popped. This is called stack unwinding.
During stack unwinding, all the local objects in all those stack frames are destructed. If
one of those destructors throws an exception (say it throws a Bar object), the C++ runtime

system is in a no-win situation: should it ignore the Bar and end up in the } catch (Foo e)
{ where it was originally headed? Should it ignore the Foo and look for a } catch (Bar e) {
handler? There is no good answer -- either choice loses information.
So the C++ language guarantees that it will call terminate() at this point, and terminate()
kills the process. Bang you're dead.

What is Virtual Destructor?
Using virtual destructors, you can destroy objects without knowing their type - the correct
destructor for the object is invoked using the virtual function mechanism. Note that
destructors can also be declared as pure virtual functions for abstract classes.
if someone will derive from your class, and if someone will say "new Derived", where
"Derived" is derived from your class, and if someone will say delete p, where the actual
object's type is "Derived" but the pointer p's type is your class.
Can you think of a situation where your program would crash without reaching the breakpoint

which you set at the beginning of main()?
C++ allows for dynamic initialization of global variables before main() is invoked. It is
possible that initialization of global will invoke some function. If this function crashes
the crash will occur before main() is entered.
Name two cases where you MUST use initialization list as opposed to assignment in
constructors.
Both non-static const data members and reference data members cannot be assigned values;
instead, you should use initialization list to initialize them.

Can you overload a function based only on whether a parameter is a value or a reference?
No. Passing by value and by reference looks identical to the caller.

What are the differences between a C++ struct and C++ class?
The default member and base class access specifiers are different.
The C++ struct has all the features of the class. The only differences are that a struct
defaults to public member access and public base class inheritance, and a class defaults to
the private access specifier and private base class inheritance.

What does extern "C" int func(int *, Foo) accomplish?
It will turn off "name mangling" for func so that one can link to code compiled by a C
compiler.
How do you access the static member of a class?
::

What is multiple inheritance(virtual inheritance)? What are its advantages and
disadvantages?
Multiple Inheritance is the process whereby a child can be derived from more than one parent
class. The advantage of multiple inheritance is that it allows a class to inherit the
functionality of more than one base class thus allowing for modeling of complex
relationships. The disadvantage of multiple inheritance is that it can lead to a lot of
confusion(ambiguity) when two base classes implement a method with the same name.

What are the access privileges in C++? What is the default access level?
The access privileges in C++ are private, public and protected. The default access level
assigned to members of a class is private. Private members of a class are accessible only
within the class and by friends of the class. Protected members are accessible by the class
itself and it's sub-classes. Public members of a class can be accessed by anyone.

What is a nested class? Why can it be useful?
A nested class is a class enclosed within the scope of another class. For example:
// Example 1: Nested class
//
class OuterClass
{
class NestedClass

{
// ...
};
// ...
};
Nested classes are useful for organizing code and controlling access and dependencies.
Nested classes obey access rules just like other parts of a class do; so, in Example 1, if
NestedClass is public then any code can name it as OuterClass::NestedClass. Often nested
classes contain private implementation details, and are therefore made private; in Example
1, if NestedClass is private, then only OuterClass's members and friends can use
NestedClass.
When you instantiate as outer class, it won't instantiate inside class.

What is a local class? Why can it be useful?
local class is a class defined within the scope of a function -- any function, whether a
member function or a free function. For example:
// Example 2: Local class
//
int f()
{
class LocalClass
{
// ...
};
// ...
};
Like nested classes, local classes can be a useful tool for managing code dependencies.


Can a copy constructor accept an object of the same class as parameter, instead of reference
of the object?
No. It is specified in the definition of the copy constructor itself. It should generate an
error if a programmer specifies a copy constructor with a first argument that is an object
and not a reference.
(From Microsoft) Assume I have a linked list contains all of the alphabets from ‘A’ to ‘Z’.
I want to find the letter ‘Q’ in the list, how does you perform the search to find the ‘Q’?
How do you write a function that can reverse a linked-list? (Cisco System)
void reverselist(void)
{
if(head==0)
return;
if(head->next==0)
return;
if(head->next==tail)
{
head->next = 0;
tail->next = head;
}
else
{
node* pre = head;
node* cur = head->next;
node* curnext = cur->next;
head->next = 0;
cur->next = head;

10 of 15 26-07-2010 1:57 PM
for(; curnext!=0; )
{
cur->next = pre;
pre = cur;
cur = curnext;
curnext = curnext->next;
}
curnext->next = cur;
}
}

How do you find out if a linked-list has an end? (i.e. the list is not a cycle)
You can find out by using 2 pointers. One of them goes 2 nodes each time. The second one
goes at 1 nodes each time. If there is a cycle, the one that goes 2 nodes each time will
eventually meet the one that goes slower. If that is the case, then you will know the
linked-list is a cycle.

How can you tell what shell you are running on UNIX system?
You can do the Echo $RANDOM. It will return a undefined variable if you are from the
C-Shell, just a return prompt if you are from the Bourne shell, and a 5 digit random numbers
if you are from the Korn shell. You could also do a ps -l and look for the shell with the
highest PID.

What is Boyce Codd Normal form?
A relation schema R is in BCNF with respect to a set F of functional dependencies if for all
functional dependencies in F+ of the form a->b, where a and b is a subset of R, at least one
of the following holds:
• a->b is a trivial functional dependency (b is a subset of a)
• a is a superkey for schema R

Could you tell something about the Unix System Kernel?
The kernel is the heart of the UNIX openrating system, it’s reponsible for controlling the
computer’s resouces and scheduling user jobs so that each one gets its fair share of
resources.

What is a Make file?
Make file is a utility in Unix to help compile large programs. It helps by only compiling
the portion of the program that has been changed

How do you link a C++ program to C functions?
By using the extern "C" linkage specification around the C function declarations.
Explain the scope resolution operator.
Design and implement a String class that satisfies the following:
Supports embedded nulls
Provide the following methods (at least)
Constructor
Destructor
Copy constructor
Assignment operator
Addition operator (concatenation)
Return character at location
Return substring at location
Find substring
Provide versions of methods for String and for char* arguments
Suppose that data is an array of 1000 integers. Write a single function call that will sort
the 100 elements data [222] through data [321].
Answer: quicksort ((data + 222), 100);

What is a modifier?

What is an accessor?
Differentiate between a template class and class template.
When does a name clash occur?
Define namespace.
What is the use of ‘using’ declaration.
What is an Iterator class?
List out some of the OODBMS available.
List out some of the object-oriented methodologies.
What is an incomplete type?
What is a dangling pointer?
Differentiate between the message and method.
What is an adaptor class or Wrapper class?
What is a Null object?
What is class invariant?
What do you mean by Stack unwinding?
Define precondition and post-condition to a member function.
What are the conditions that have to be met for a condition to be an invariant of the class?
What are proxy objects?
Name some pure object oriented languages.
Name the operators that cannot be overloaded.
What is a node class?
What is an orthogonal base class?
What is a container class? What are the types of container classes?
What is a protocol class?
What is a mixin class?
What is a concrete class?
What is the handle class?

What is an action class?
When can you tell that a memory leak will occur?
What is a parameterized type?
Differentiate between a deep copy and a shallow copy?
What is an opaque pointer?
What is a smart pointer?
What is reflexive association?
What is slicing?
What is name mangling?
What are proxy objects?
What is cloning?
Describe the main characteristics of static functions.
Will the inline function be compiled as the inline function always? Justify.
Define a way other than using the keyword inline to make a function inline.
How can a '::' operator be used as unary operator?
What is placement new?
What do you mean by analysis and design?
What are the steps involved in designing?
What are the main underlying concepts of object orientation?
What do u meant by "SBI" of an object?
Differentiate persistent & non-persistent objects?
What do you meant by active and passive objects?
What is meant by software development method?
What do you meant by static and dynamic modeling?
How to represent the interaction between the modeling elements?
Why generalization is very strong?
Differentiate Aggregation and containment?
Can link and Association applied interchangeably?
What is meant by "method-wars"?
Whether unified method and unified modeling language are same or different?

Who were the three famous amigos and what was their contribution to the object community?
Differentiate the class representation of Booch, Rumbaugh and UML?
What is an USECASE? Why it is needed?
Who is an Actor?
What is guard condition?
Differentiate the following notations?
USECASE is an implementation independent notation. How will the designer give the
implementation details of a particular USECASE to the programmer?
Suppose a class acts an Actor in the problem domain, how to represent it in the static
model?
Why does the function arguments are called as "signatures"?

fly