C++MidTermPaper October 2021
C++MidTermPaper October 2021
Q.3 (a) Explain the concept of static data member and static member function with the help of
a program.
(b) Explain the concept of function overloading. Write a program to demonstrate function
overloading for function swap( ) to swap values corresponding to different data types
using C++ code.
Q.4 (a) Create a class named employee. Allow multiple constructors in it. Create methods
to generate salary report of each employee. The program should run and also display the
details of 5 employees.
(b) Explain Reference variable with a suitable example. What is the principle reason of
passing arguments by Reference? Differentiate between passing arguments by using
pointer variables and reference variable. Explain with C++ program.
Q.5 (a) What do you mean by a friend class? Explain with suitable code.
(b) WAP to create a class Matrix to represent a 2D array to be allocated the memory
dynamically by using concept of array of array pointers. Write down a parametric
constructor that receives no. of rows and no. of columns as arguments. Write a destructor
to release a memory. Write down two member function input() and output() for elements
of the 2D Array.
Q.6 (a) Write a program to illustrate the concept of object as an argument and returning
objects.
(b) What is the difference between member function defined inside and outside the body
of a class? How is inline member function defined outside the body of a class? Explain
with example.