Note: Question number 1 is compulsory. Answer any three questions from the rest.
Q.1.
(a) Mention the difference between C and C++. Why is it necessary
to include header files in a program written in these languages?
(b) Discuss the basic data types of C++. Suggest appropriate data
type for the following:
(1) Someone’s height in meters
(2) An exclamation mark
(3) The number of students in a university
(c) What is the purpose of information hiding?
(d) Write a program, which will accept a string of maximum 10 characters
from the keyboard, and count the occurrences of each of the 5 vowels
in the string. The output should be in tabbed format as shown below:
A E I O U
0 1 0 0 1
Q.2
(a) Differentiate between operator and function overloading with the
help of suitable example.
(b) Explain the concept of a Destructor in a class. What is its role
in terms of cleanup of unwanted objects?
Q.3.
(a) How is a exception handling performed in C++? Write a program
that throws an arithmetic exception as and when a number input is
greater than 9999.
(b) Write a C++ template function, called exchange ( ) that accepts
two arguments of generic type and swaps their contents.
Q.4.
(a) Write a C++ program to print reverse of a 5-digit number.
(b) Explain the concept of metadata.