73.
What will be the output of the following C++ code?
#include <iostream>
#include <array>
 
using namespace std;
 
int main(int argc, char const *argv[])
{
	int arr1[5] = {1,2,3,4,5};
	int arr2[5] = {6,7,8,9,10};
	arr1.swap(arr2);
	for(int i=0;i<5;i++)
		cout<<arr1[i]<<" ";
	cout<<endl;
	for(int i=0;i<5;i++)
		cout<<arr2[i]<<" ";
	cout<<endl;
	return 0;
}

74.
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class Parent
{
    public:
    Parent (void) 
    {     
        cout << "Parent()\n";
    }
    Parent (int i) 
    { 
        cout << "Parent("<< i << ")\n"; 
    };
    Parent (void) 
    { 
        cout << "~Parent()\n";
    }; 
};
class Child1 : public Parent { };
class Child2 : public Parent
{
    public:
    Child2 (void) 
    {
        cout << "Child2()\n";
    }
    Child2 (int i) : Parent (i) 
    {
        cout << "Child2(" << i << ")\n"; 
    }
    ~Child2 (void) 
    {
        cout << "~Child2()\n"; 
    }
};
int main (void)
{
    Child1 a;
    Child2 b;
    Child2 c(42);
    return 0;
}

75.
What will be the output of the following C++ code?
#include <iostream>
#include <algorithm>
using namespace std;
int main ()
{
    int myints[] = { 10, 20, 30, 30, 20, 10, 10, 20 };
    int* pbegin = myints;
    int* pend = myints + sizeof(myints) / sizeof(int);
    pend = remove (pbegin, pend, 20);
    for (int* p = pbegin; p != pend; ++p)
        cout << ' ' << *p;
    return 0;
}

76.
What will be the output of the following C++ code?
#include <typeinfo>
#include <iostream>
using namespace std;
class Myshape
{
    public:
    virtual void myvirtualfunc() const {}
};
class mytriangle: public Myshape
{
    public:
    virtual void myvirtualfunc() const
    {   
    };
};
int main()
{
    Myshape Myshape_instance;
    Myshape &ref_Myshape = Myshape_instance;
    try 
    {
        mytriangle &ref_mytriangle = dynamic_cast<mytriangle&>(ref_Myshape);
    }
    catch (bad_cast)
    {
        cout << "Can't do the dynamic_cast lor!!!" << endl;
        cout << "Caught: bad_cast exception. Myshape is not mytriangle.\n";
    }
    return 0;
}

77.
What will be the output of the following C++ code?
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
    stringstream mys(ios :: in | ios :: out);
    std :: string dat("The double value is : 74.79 .");
    mys.str(dat);
    mys.seekg(-7, ios :: end);
    double val;
    mys >> val;
    val = val*val;
    mys.seekp(-7,ios::end);
    mys << val;
    std :: string new_val = mys.str();
    cout << new_val;
    return 0;
}

79.
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
    int a = 10, b = 20, c = 30;
    float  d;
    try
    {
        if ((a - b) != 0)
        {
            d = c / (a - b);
            cout << d;
        }
        else
        {
            throw(a - b);
        }
    }
    catch (int i)
    {
        cout<<"Answer is infinite "<<i;
    }
}