Object Oriented Programming with C++ - Jun 2015
Computer Science Engg. (Semester 3)
TOTAL MARKS: 100
TOTAL TIME: 3 HOURS (1) Question 1 is compulsory.
(2) Attempt any four from the remaining questions.
(3) Assume data wherever required.
(4) Figures to the right indicate full marks. 1 (a) State the important features of object oriented programming. Compare object oriented programming with procedure oriented programming.(10 marks) 1 (b) Define function overloading. Write a C++ program to define three overloaded functions to swap two integers, swap two floats and swap two doubles.(10 marks) 2 (a) Differentiate between class and structure. With an example explain the syntax for defining a class.(10 marks) 2 (b) List the characteristics of a constructor. Write a C++ program to define a suitable parameterized constructor with default values for the class distance with data members feet and inches.(10 marks) 3 (a) Differentiate between function overloading and function templates, can we overload a fuction template? Illustrate with an example.(8 marks) 3 (b) Write a C++ program to create a class called STRING and Implement the following operations. Display the result after every operation by overloading the operator <<.
i) STRING S1= 'VTU'
ii) STRING S2 = 'BELGAUM'
iii) STRING S3 = S1+S2 (Use copy constructor).(8 marks) 3 (c) List the characteristics of a friend function.(4 marks) 4 (a) Explain the visibility of base class members for the access specifiers: private, protected and public while creating the derived class and also explain the syntax for creating derived class.(8 marks) 4 (b) Write a C++ program to illustrate multiple inheritance.(6 marks) 4 (c) List the types of inheritances. Write a C++ program to implement single inheritance with public access specific.(6 marks) 5 (a) With an example, explain the syntax for passing arguments to base class constructors in multiple inheritance.(10 marks) 5 (b) With an example, explain the order of invocation of constructors and destructors in multiple inheritance.(10 marks) 6 (a) Differentiate between early binding and late binding, with an example explain how late binding can be achieved in C++.(8 marks) 6 (b) With an example, explain how virtual functions are hierachical.(6 marks) 6 (c) Define pure virtual functions. Write a C++ program to illustrate pure virtual functions.(6 marks) 7 (a) Explain the output manipulators: setw(), setprecision() and setfill().(6 marks) 7 (b) Explain the use of ifstream and ofstream classes for file input and output.(8 marks) 7 (c) Explain the file operation functions in C++ to manipulate the position of file pointers in a random access file.(6 marks) 8 (a) Define exception handling. Explain the use of try, catch and throw for exception handling in C++.(8 marks) 8 (b) Write a C++ program to illustrate catching all exceptions.(6 marks) 8 (c) Explain briefly the three foundational items of standard template library.(6 marks)