Question 1)a) Write the output for the following program code:
# include
void divide(int x, int y){
cout<<”\n Inside function”;
try{
if(y= = 0)
throw y;
else
cout<<”\nDivision=”<} catch(int) {
cout<<”\n Caught integer inside function”;
throiw;
}
cout<<”\nEnd of function”;
}
void main( ) {
cout<<”\n Inside main”;
try{
divide(10,3);
divide(30,0);
} catch(int) {
cout<<”\n Caught integer inside main”;
}
cout<<”\n End of main”;
}
Question 2)a) Give any 4 manipulators and their equivalent ios functions.
b) Write a user defined manipulator called currency that prints L. Write another user defined manipulator called form which prints **+798.650 ( width is 10). These manipulators must be used in main to display L**+798.650
c) In what order are the constructors called when a derived class object is created. Assume that there are virtual and normal base classes. Describe with a appropriate example.
Question 3)a) Which of the following declarations and definitions must be put in the header file?
i) float f1;
ii) extern int sum;
iii) void putvalues(float * f, int size);
iv) inline bool isequal(const int &, const int &) { }
b) What are the differences between a reference parameter and a pointer? When should a pointer be used? When it should not be used? Describe it with suitable example.
c) Give the three steps of function overload resolution.