VTU Computer Science (Semester 3)
Object Oriented Programming with C++
December 2012
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 following OOP features:
i) Class ii) Encapsulation iii) Polymorphism iv) Inheritance
8 M
1 (b) Define inline function. Explain with an example program. What are the conditions, where inline functions can not be expanded?
6 M
1 (c) Define function overloading. Demonstrate with C++ program.
6 M

2 (a) Write a C++ program to keep track of the number of objects created by a particular class without using extern variable.
6 M
2 (b) Determine the output for the following snippers and comment.
i) class A
{ int x=10;
void display ()
{
cout<<"The value of x="< }
}
void main()
{
A obj;
obj.display();
}

ii) class A
{ int pvt;
Public; int*ptr-pub;
A() {
pvt=25;
pvt_pub=&pvt;
}
void print_private()
{
cout< }
};
void main ()
{
A objA;
*objA.ptr_pub=10;
objA.print_private()
}
8 M
2 (c) Demonstrate with C++ program for
i) Passing objects to functions
ii) Returning objects.
8 M

3 (a) Define friend function. Explain with a C++ program to add 2 complex numbers.
8 M
3 (b) Write a C++ program to overload pre-increment and post-increment operators.
8 M
3 (c) State the advantages of Generic functions and classes and give the syntax for both.
4 M

4 (a) Write bubble sort program in C++ to sort in and double data type elements, using template function.
8 M
4 (b) List out the impact on public, protected and private data members of base class, when the base class is derived by
i) public
ii) protected
iii) private access specifies. Demostrate it by writing separate C++ program for each.
12 M

5 (a) What ambiguities arise when multiple base class are inherited. How do you resolve them? Explain with a C++ program.
8 M
5 (b) Explain with a C++ program how a pass parameter to base-class constructor.
8 M
5 (c) Discuss the order of invocation of constructor and destructor.
4 M

6 (a) Show that in C++, virtual functions are hierarchical.
6 M
6 (b) What is an abstract class? Write a C++ program to implement the abstract class.
10 M
6 (c) Write a short note on early v/s binding.
4 M

7 (a) With examples, list and explain any four I/O manipulators in C++.
6 M
7 (b) Demonstrate the random access to files in C++, using relevant stream class functions.
6 M
7 (c) What is the necessity of exception handling? Show how multiple catch statement are used.
8 M

Write short note on the following :-
8 (a) Copy constructor
5 M
8 (b) New and delete
5 M
8 (c) Lists
5 M
8 (d) Vectors.
5 M



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