Object Oriented Programming with C++ - May 2016
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) Explain any three features of object oriented programming.(6 marks) 1(b) What is function overloading? Write a C++ program to define three overloaded functions to find the sum of two integers, sum of two floating point numbers and sum of three integers.(8 marks) 1(c) What are inline functions? Illustrate inline functions with a example.(6 marks) 2(a) Define class and objects. Write a c66 program to create a class STUDENT with the following specifications.
Data members: Name, Roll No. And Average Marks
Member functions: Read & Write
Use the above specification to read and print the information of 5 students.(10 marks) 2(b) What are constructors? Explain the different types of constructors. Write a c++ program to illustrate the different types of constructors.(10 marks) 3(a) What are friend functions? Write a c++ program to find the sum of two complex numbers using friend functions.(10 marks) 3(b) Write a c++ program to perform the addition of two location objects by overloading '+' operator, using a class 'LOCATION' with the data members longitude and latitude. Read and display the location objects by overloading the operators <<&>>.(10 marks) 4(a) Explain the visibility of the class members for the access specifiers:
i) Public ii) Private iii) Protected.
Illustrate the same with a program.(10 marks) 4(b) Write a c++ program to illustrate multiple inheritance and multilevel inheritance.(10 marks) 5(a) Illustrate with a C++ program the execution of constructors and destructors when single inheritance is involved.(6 marks) 5(b) Explain passing of parameters to base class constructors in multiple inheritance.(8 marks) 5(c) Explain the need for virtual base classes.(6 marks) 6(a) What is a virtual function? Write a C++'s program to demonstrate calling of virtual function through a base class reference.(10 marks) 6(b) With examples explain pure virtual function and abstract classes.(10 marks) 7(a) What are steams in C++? Explain C++'s predefined streams?(8 marks) 7(b) Explain width (), precision () and fill () functions.(6 marks) 7(c) What are I/O manipulators? Explain any five C++ manipulators used for output.(6 marks) 8(a) What is exception handling? Write a C++ program that illustrate exception handling with the help of keywords: try, throws and catch.(10 marks) 8(b) What is STL? Briefly explain the use of containers, vectors, lists and Maps.(10 marks)