Q.1.
(a) Explain any five advantages of object Programming.
(b) Explain the need of inheritance and list any three advantages
of it.
(c) Explain the purpose of the following with a suitable example of
each:
(1) Use Case Diagram
(2) Interaction Diagram
(d) Write C++ code to create a class date. Using this class, calculate
the age of a person as on the current date.
(e) List the various restrictions with operator overloading. Write
a C++ program to illustrate the overloading of increment operator.
Q.2.
(a) Define the term exception handling. Write a program to raise an
exception if an attempt is made to divide a number by zero.
(b) Give output of the following:
{
int a = 10, b=20,d;
d = b++;
cout <<d<<b;
d = ++a;
cout<<d<<a;
}
Q.3.
(a) Explain the purpose of function overloading. Write a C++ program
that uses a function to check whether a given number is divisible
by another number or not. Give proper comments whether the denominator
number is a prime number or not.
(b) Explain briefly static data members.
Q.4.
(a) Define a friend function. Explain the relation of friend with
respect to public. Private and Protected data members of the class.
(b) Write a C++ program to find the sum of all digits in a five-digit
number. (For example, if given number is 12345 then the output is
1+2+3+4+5 = 15).