Term-End Examination
June, 2007
CS-72 : C++ AND OBJECT ORIENTED PROGRAMMING
Time : 2 hours Maximum Marks : 60
Note Question number 1 is compulsory. Attempt any three questions from the rest.
1. (a) Mention the difference between C and C++. Why is it necessary to include header files in a program written in these languages ?(8)
(b) Discuss the basic data types of C++. Suggest appropriate data type for the following : (5)
(i) Someone's height in meters
(ii) An exclamation mark
(iii) The number of students in a university
(c) What is the purpose of information hiding ? (5)
(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 : (12)
AEIOU
01001
2. (a) Differentiate between operator and function overloading with the help of suitable example. (5)
(b) Explain the concept of a destructor in a class. What is its role in terms of cleanup of unwanted objects ? (5)
3. (a) How is the exception handling performed in C++ ? Write a program that throws an arithmetic exception as and when a number input is greater than 9999.(6)
(b) Write a C++ template function, called exchange() that accepts two arguments of generic type and swaps their contents. (4)
4. (a) Write a C++ program to print reverse of a 5-digit number.(5)
(b) Explain the concept of metadata. (5)
5. Define the following (10)
(i) Polymorphism
(ii) Typecasting
(iii) Class and instance
(iv) Containership
(v) Abstract class