written 8.7 years ago by |
Object Oriented Programming with C++ - Jun 2014
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) Compare object oriented programming with produced oriented progamming.(6 marks)
1 (b) Define function overloading. Write a C++ program to define overloaded functions to find volume of cube, volume of cylinder and volume of cuboid.(8 marks)
1 (c) With an example, explain when the set of overloaded functions can be combined into a single function definition by using default arguments.(6 marks)
2 (a) Define the terms class and object. Write a C++ program to define a class called distance with feet and inches as data members and get(), put() and add() as members to read. Display and add two distance objects.(10 marks)
2 (b) With an example, illustrate the characteristics of a constructor.(5 marks)
2 (c) Write a short note on destructors.(5 marks)
3 (a) With an example, explain the use of friend functions in C++.(6 marks)
3 (b) With an example, explain when to use member function and when to use friend function as an operator function for overloading binary operators.(8 marks)
3 (c) Write a C++ program to arrange set of integer and floating point values in acending order by using a function template.(6 marks)
4 (a) With the help of syntax for creating the derived class, explain the visibility of the base class members, for the access specifiers private, protected and public.(8 marks)
4 (b) With an example, explain multiple inheritance.(6 marks)
4 (c) Explain the necessity of protected data members, with an example.(6 marks)
5 (a) Explain the use of virtual base classes in diamond shape inheritance.(8 marks)
5 (b) Explain the order of invocation of constructors and destructors in multilevel inheritance.(8 marks)
5 (c) Write a short note on use of scope resolution operator in inheritance.(4 marks)
6 (a) Define a virtual function. Explain the need of a virtual function with an example.(6 marks)
6 (b) Write a C++ program to illustrate the virtual function in hierarchical inheritance.(8 marks)
6 (c) Define abstract class. Write a C++ program to illustrate abstract class.(6 marks)
7 (a) Explain the following output manipulators:
i) setĪ() ii) setprecision() iii) setfill()(6 marks)
7 (b) Briefly explain the facilities available in fstream class for file operations.(6 marks)
7 (c) Write a C++ program to read a binary file, which contains the detail of 5 students such as Name, rollno, age and grade obtained by the student. Display the above read details on the screen.(8 marks)
8 (a) What is exception handlling? Write a C++ program to demonstrate the "try", "throw", and "catch" keywords for implementing exception handling.(10 marks)
8 (b) List and explain five member functions from vectors and lists classes in STL.(10 marks)