Object Oriented Programming with C++ - Dec 2015
Computer Science Engg. (Semester 4)
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 system with procedure oriented system.(8 marks) 1 (b) What is function overloading? Illustrate function overloading through swan function which swaps two integers, two double and two character data.(8 marks) 1 (c) Explain the working of an inline function with example.(4 marks) 2 (a) Define the term class and objects. Write a C++ program to define a class complex with real and imaginary as data members and get data(), add() and display_Data() as member function to read, add and display complex object.(8 marks) 2 (b) Explain with example different types of constructors.(8 marks) 2 (c) Explain with an example the role of static data member in a class to count the number of object created in a program.(4 marks) 3 (a) Explain how 'new' and 'delete' operator manages memory allocation/de-allocation dynamically.(8 marks) 3 (b) What are friend functions? Why is it required? Explain with the help of a suitable example.(6 marks) 3 (c) Write a C++ program to arrange a set of integers and floating point values in ascending order by using template functions.(6 marks) 4 (a) What is inheritance? Explain with example different types of inheritance in C++.(10 marks) 4 (b) With an example, explain the effect of private, protected and public access specifier. When a base class is inherited by a derived class?(10 marks) 5 (a) With the illustration code, explain how the constructors and destructors are involved when a derived class object is created.(10 marks) 5 (b) What is the ambiguity that might arise in multiple inheritance? How to overcome this? Explain with an example.(6 marks) 5 (c) Explain methods of restoring the original access specification of a base class members when it is inherited as private.(4 marks) 6 (a) What is virtual function? Explain with an example. How virtual function can be used to implement the runtime polymorphism?(8 marks) 6 (b) Explain with an example pure virtual function.(6 marks) 6 (c) Explain how virtual functions are hierarchical with an example.(6 marks) 7 (a) What are various IOStream in C++? Give the steam class hierarchy.(10 marks) 7 (b) Describe the use of following manipulators:
i) setw ii) setfill iii) setprecision() iv) setioflags() v) resetioflags().(10 marks) 8 (a) What is exception handling? Explain with an example how exception is handled in C++.(10 marks) 8 (b) What are standard template library? List and explain any five member function from vectors and lists class in STL.(10 marks)