B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2011
Third Semester
Computer Science and Engineering
CS 2203 — OBJECT ORIENTED PROGRAMMING
(Common to Information Technology)
(Regulation 2008)
T
Time : Three hours Maximum : 100 marks
Answer ALL questions
PART A — (10 × 2 = 20 marks)
1. Define abstraction and encapsulation.
2. Justify the need for static members.
3. Explain the functions of default constructor.
4. What is the need for overloading the assignment operator?
5. What is an exception?
6. What is a function template?
7. What is a pure virtual function?
8. What is meant by dynamic casting?
9. What is a namespace?
10. Justify the need for object serialization.
PART B — (5 × 16 = 80 marks)
11. (a) (i) Highlight the features of object oriented programming language. (8)
(ii) Explain function overloading with an example. (8)
Or
(b) (i) Consider a Bank Account class with Acc No. and balance as data members. Write a C++ program to implement the member functions get_Account_Details ( ) and display_Account_Details (). Also write a suitable main function. (10)
(ii) Write a C++ program to explain how the member functions can be accessed using pointers. (6)
12. (a) (i) Explain copy constructor with an example. (8)
(ii) Consider a Fruit Basket class with no. of Apples and no. of Mangoes as data members. Overload the ‘+’ operator to add two objects of this class. (8)
Or
(b) (i) Justify the need for using friend functions in overloading with an example. (10)
(ii) Explain the use of destructor with an example. (6)
13. (a) (i) Explain with an example, how exception handling is carried out in C++. (8)
(ii) Write a class template to insert an element into a linked list. (8)
Or
(b) (i) Write a class template to implement a stack. (10)
(ii) What is a user defined exception? Explain with an example. (6)
14. (a) (i) Explain runtime polymorphism with an example. (10)
(ii) Write short notes on: RTTI, down casting. (3 + 3)
Or
(b) (i) Discuss the different types of inheritance supported in C++ with suitable illustration. (10)
(ii) Describe the purpose of a virtual base class, giving a suitable example. (6)
15. (a) Write a C++ program to store set of objects in a file and to retrieve the same. (16)
Or
(b) (i) Highlight the features of STL. (6)
(ii) List the different stream classes supported in C++ (4)
(iii) Write a C++ program to read the contents of a text file. (6)