What is constructor? Why constructor is needed in a class? Illustrate the types of constructor with an example. [10]
2.
Write a C++ program to display the number of objects created using static member. [5]
3.
Explain about friend function and friend class with an example. [5]
File handling
1.
What do you mean by stream? Explain different stream class for file input/output. [5]
Function Templates and Exception Handling
1.
When inline functions may not work? Define and write syntax for default arguments. Write a program to display N number of characters by using default arguments for both parameters. Assume that the function takes two arguments, one character to be printed and other how many times the character to be printed respectively. [10]
2.
Differentiate between concrete class and abstract class. Define class template and function template with syntax. [5]
Inheritance
1.
State the use of new operator. An educational institute wishes to maintain a data of its employee. The hierarchical relationships of related classes are as follows. Define all the classes to represent above hierarchy and define functions to retrieve individual information as and when required.
[10]
2.
Describe the chain of constructors and destructors in inheritance. [5]
Operator Overloading
1.
List any two operators that cannot be overloaded. Write a program to handle the possible exception in taking 'age' as input. Here the exception must be thrown in the input is negative or greater than 200. [5]
2.
Create a class named Point with data members x(int) and y(int). Add operator overloading to find the Euclidean distance between two points. [5]
Virtual Function, Polymorphism, and miscellaneous C++ Features
1.
What is the use of reinterpret cast operator? Why do we need virtual function? [5]
2.
Explain the reason for member function overriding when using virtual function. [5]