VTU Computer Science (Semester 3)
Object Oriented Programming with C++
December 2014
Total marks: --
Total time: --
INSTRUCTIONS
(1) Assume appropriate data and state your reasons
(2) Marks are given to the right of every question
(3) Draw neat diagrams wherever necessary


1(a) Explain the terms encapsulation,Polymorphism and inheritance in object oriented programming.
6 M
1(b) Explain the different types of argument passing techniques,with example.
6 M
1(c) What is function overloading?Write a C++ program to define three overloaded functions area() find area of rectangle,area of rectangular box and area of circle
8 M

2(a) What is a constructor? How is a constructor different form member function? Illustrate with an example.
6 M
2(b) What are static data members? Explain with an example? What is the use of static data members?
6 M
2(c) Write a class 'rectangle'containing two data items 'length' and 'breadth' and for functions setdata(), getdata(),displaydata() and area() to set the length and breadth,to get user inputs, to display and to find the area of the rectangle respectively.Also write a main program which declares the objects and uses the member functions of the class.
8 M

3(a) Define friend functions?Explain what the rules to be used while using a friend function?illustrate with an example.
10 M
3(b) What is operator overloading? Write a C++ program to add two complex numbers by overloading the+ operator.Also overload<
10 M

4(a) Explain and write a C++ program,the process when the class is derived by the following visibility modes : i) public ii) private iii) protected
10 M
4(b) What is inheritance? Explain different types of inheritance.Explain the inheriting multiple base classes with an example.
10 M

5(a) Explain with an example,the order of invocation of constructors and destructors and passing arguments to base class constructors in multilevel inheritance.
10 M
5(b) What are the ambiguities that arise in multiple inheritance? How to overcomes this? Explain with example.
10 M

6(a) What are virtual functions? What is the need of virtual functions? How is early binding different form late biding?
6 M
6(b) How to inherit a virtual attribute? Explain with example.
6 M
6(c) What is pure virtual function? Write a C++ program to create a class called NUMBER with an integer data form member and member function to set value for this data member.Derive three classes form this base class called HEXADECIMAL, DECIMAL and OCTAL. Include a member function DISPLAY() in all these three derived classes to display the value of base class data member in hexadecimal,decimal and octal respectively.Use the concept of pure virtual function.
8 M

7(a) Define the concept of IO stream provided in C++. Explain in detail IO stream class hierarchy.
6 M
7(b) Write a C++ program to define a class called phonebook with data members name, area code,prefix and number and member functions readdata() which reads the values of the data members form the keyboard and writedata() which displays the values of data members.Enter the data for at least five phone numbers and store details in binary file phone and read the stored details and display on the screen.
8 M
7(c) Explain the following member functions: setf(), unsetf() and fill (),
6 M

8(a) What is exception handling? Write a C++ program to demonstrate the try"
10 M
8(b) Explain the following with respect to STL :
i) Containers
ii) Types of containers
iii)Iterators.
10 M



More question papers from Object Oriented Programming with C++
SPONSORED ADVERTISEMENTS