· Question 1 is compulsory and carries 28 marks. Answer any FOUR questions from the rest. Marks are indicated against each question.
· Parts of a question should be answered at the same place.
c. How does copy constructor differs from assignment operator?
d. Differentiate between private, protected and public base class?
e. Differentiate between cin and cout?
f. Explain the concept of this pointer?
g. What are different I/O flag? Explain their functions? (74)
Q.2 a. What is copy constructor? What are the benefits of copy constructor?
b. What are the advantages of template function over Macros in C++?
c. Write a C++ program that creates a calculator class with the addition, subtraction, multiplication and division member functions? (6+6+6)
Q.3 a. What is dynamic binding? Justify that run-time polymorphism is not possible without dynamic binding?
b. Why C++ does not support virtual constructor whereas it supports virtual destructor?
c. What are the benefits of friend classes or functions? Do they violate privacy of the class? Justify. (6+6+6)
Q.4 a. Abstraction and Encapsulation are complementary to each other. Justify?
b. Give an example showing three levels of inheritance where protected members inherited remain protected.
c. Function overloading is compile time polymorphism? Justify. (6+6+6)
Q.5 a. Using template class write a C++ program that create a stack of different types? Do not use struct.
b. What is a virtual function? Explain how virtual function is implemented in C++ compiler?
c. Define an abstract class with the help of an example from real life? (6+6+6)
Q.6 a. Write a class that implements complex number consisting of two data members real and imaginary both are of float type. Also overload insertion operator (<<) for this class?
b. Give the diagram for I/O class hierarchy of C++?
c. When does an exception class require data members? Give an example which throws an exception with an argument? (6+6+6)
Q.7 a. How does overloading of prefix and suffix decrement operators differ? Explain with help of an example?
b. Write short notes on (Any TWO):
(i) Nested classes
(ii) Template class
(iii) File handling
(iv) Multiple Inheritance. (6+6+6)