M.C.A-M.C.A 3rd Sem IT 33-303 : OBJECT ORIENTED PROGRAMMING USING C++(University of Pune, Pune-2013)
M.C.A. (Management Faculty) (Semester - III) Examination, 2013
IT 33-303 : OBJECT ORIENTED PROGRAMMING USING C++
(2008 Pattern)
Time : 3 Hours Max. Marks : 70
Note : 1) Q. 1 is compulsory.
2) Solve any six from Q. 2 to Q. 8.
3) Figures to right indicate full marks.
4) Make suitable assumption wherever necessary.
1. Explain output of the following program
a) # include <iostream.h>
class some
{
public:
~ some( )
{
cont <<"some's destructor"<<end l;
}
};
void main( )
{
some s;
s.~some( );
}
b) # include <iostream.h>
class base
{
int arr[10];
};
class b1 : public base { }; class b2 : public base { };
class derived : public b1, public b2 { };
int main( )
{
cout<<sizeof(derived);
getchar( );
return 0;
}
c) # include <iostream.h>
class base
{
public :
virtual void foo( )
{
cout <<"base class function is called\n";
}
~base( )
{
cout <<"base class destructor is called\n";
}
};
class derived: public base
{
public:
void foo( )
{
cout<<"derived class function is called\n";
}
~derived( )
{
cout<<"\n derived class destructor is called\n";
}
};
void main( )
{
base*bp = new derived;
bp® foo( );
delete bp;
}
d) #include<iostream.h>
class nameless
{
public:
nameless( )
{
cout<<"constructor called\n";
}
~nameless( )
{
cout<<"destructor called\n";
}
};
void main( )
{
nameless( );
nameless obji;
}
e) #include<iostream.h>
void execute (int 4x, int y = 200)
{
int temp = x+y;
x+=temp;
int(y! = 200)
cout <<temp<<x<<y<<endl;
}
void main( )
{
int a = 50, b = 20;
execute(b);
cout<<a<<b<<endl;
execute(a, b);
cout<<a<<b<<endl;
}
2. Answer any five : (2×5=10)
a) What is need of copy constructor ?
b) What is difference between early and late binding ?
c) What is need of default arguments ? How are they defined ?
d) What is this pointer ?
e) Can we use same function name for a member function and non member
function of the class in the same program file ? If yes, how are they
distinguished ? If no, give reasons.
f) What is downcasting ?
3. Design classes Rupee and Dollar such that they support the following statements
Rupee r1, r2;
Dollar d1, d2;
d1 = r2; // converts Rupee to Dollar
r2 = d2; // converts Dollar to Rupee
Note : 1 Dollar = 50 Rs.
4. Write a program for generic Queue class with two member functions, insert and
delete. Use the array to implement the queue.
5. a) Explain what is virtual and pure virtual function ?
b) What are virtual base classes ? Explain need of virtual base class in building
class hierarchy.
6. a) Explain three different types of containers.
b) What is RTTI ? Suggest some cases where we need to use RTTI ?
7. a) Write a program to read text file and count number of characters in it.
b) Explain the roles of seekg( ), seekp( ), tellg( ) and tellp( ) functions in the
process of random access in a binary file.
8. Write short notes (any two) : (2×5=10)
a) Dynamic memory management in C++
b) Rethrow( ) in Exception handling
c) Explicit constructor ?
———-----———
B/I/13/2,900
Earning: ₹ 8.10/- |