What is use of new and delete operators? Illustrate with example. What are advantages of new over malloc. [5]
Classes & Objects
1.
Write a program according to the specification given below:- Create a class Teacher with data members id & subject and member functions for reading and displaying data members.- Create another class Staff with data members id & position, and member functions for reading and displaying data members.- Derive a class Coordinator from Teacher and Staff and the class must have its own data member department and member functions for reading and displaying data members.- Create two object of Coordinator class and read and display their details. [10]
2.
What is meant by return by reference? How can we return values by reference by using reference variable? Illustrate with example. [5]
3.
What is destructor? Write a program to show the destructor call such that it prints the message 'memory is released'. [5]
4.
What is this pointer? How can we use it for name conflict resolution? Illustrate the use of multiple catch statement with example. [5]
File handling
1.
Which function can be used for reading and writing object? Define briefly. Write a program that reads values of two objects of students class (assume data members are id, name, and level) and display the data in monitor. [5]
Function Templates and Exception Handling
1.
How can define catch statement that can catch any type of exception? Illustrate the use of multiple catch statement with example. [5]
2.
What is meant by template? How can you define function template to return maximum of two integers, floats, or characters? Explain with example. [5]
Introduction to Object Oriented Programming
1.
How object oriented programming differs from object based programming language? Discuss benefits of OOP. [5]
Operator Overloading
1.
Explain the concept of operator overloading? List the operators that cannot be overloaded. Write programs to add two object of distance class with data members feet and inch by using member function and friend function. [10]
Virtual Function, Polymorphism, and miscellaneous C++ Features
1.
Explain types of polymorphism briefly. Write down roles of polymorphism. How can we achieve dynamic polymorphism briefly? Write down roles of polymorphism. How can we achieve dynamic polymorphism? Explain with example. [10]
2.
Write short notes on:- Cascading of IO operation - Pure Virtual Function [5]