42.
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class Mammal
{
   public:
	Mammal(){
		cout<<"I'm a Mammal\n";
	}
	~Mammal(){}
};
 
class Human: public Mammal
{
   public:
	Human(){
		cout<<"I'm a Human\n";
	}
	~Human(){}
};
 
class Male: public Human
{
   public:
	Male(){
		cout<<"I'm a Male\n";
	}
	~Male(){}
};
 
class Female: public Human
{
   public:
	Female(){
		cout<<"I'm a Female\n";
	}
	~Female(){}
};
 
int main(int argc, char const *argv[])
{
	Male M;
	return 0;
}

43.
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class A
{
	float d;
     public:
	virtual void func(){
		cout<<"Hello this is class A\n";
	}
};
 
class B: public A
{
	int a = 15;
   public:
	void func(){
		cout<<"Hello this is class B\n";
	}
};
 
int main(int argc, char const *argv[])
{
	A *a;
	a->func();
	return 0;
}

44.
Which statement is incorrect about virtual function.

45.
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class A
{
	int a;
   public: 
	A(){
		a = 0;
	}
	void show(){
		a++;
		cout<<"a: "<<a<<endl;
	}
};
 
class B: public A
{
   public:
};
 
int main(int argc, char const *argv[])
{
	B b;
	b.show();
	return 0;
}

47.
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class A
{
	int a;
   public: 
	A(){
		a = 0;
	}
	static void show(){
		a++;
		cout<<a;
	}
};
 
class B: public A
{
   public:
 
};
 
int main(int argc, char const *argv[])
{
	B b;
	b.show();
	return 0;
}

48.
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class A
{
   public: 
	virtual A(){
		cout<<"A's Constructor\n";
	}
};
 
class B: public A
{
   public:
	A(){
		cout<<"Present inside the class B\n";
	}
};
 
int main(int argc, char const *argv[])
{
	A a;
	return 0;
}

49.
What happens if the following C++ program is compiled?
#include <iostream>
#include <string>
using namespace std;
class A
{
	int a;
   public: 
	A(){
		a = 0;
	}
	void show(){
		a++;
		cout<<"a: "<<a<<endl;
	}
};
 
class B: private A
{
   public:
	void show(){
		show();
	}
};
 
int main(int argc, char const *argv[])
{
	B b;
	b.show();
	return 0;
}

50.
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class Base
{
    public:
    virtual void print() const = 0;
};
class DerivedOne : public Base
{
    public:     
    void print() const
    {
        cout << "DerivedOne\n";
    }
};
class DerivedTwo : public Base
{
    public:
    void print() const
    {
        cout << "DerivedTwo\n";
    }     
}; 
class Multiple : public DerivedOne, public DerivedTwo
{
    public:
    void print() const
    {
        DerivedTwo :: print();
    } 
}; 
int main()
{
    int i;
    Multiple both; 
    DerivedOne one; 
    DerivedTwo two; 
    Base *array[ 3 ]; 
    array[ 0 ] = &both; 
    array[ 1 ] = &one;
    array[ 2 ] = &two;
    array[ i ] -> print();
    return 0;
}