1.
What will be the output of the following C++ code?
#include <iostream>
#include <string>
#include <tuple>
using namespace std;
int main()
{
	tuple <int, string> tp1;
	tuple <int, string> tp2;
	tp1 = make_tuple(0, "Hello");
	tp2 = make_tuple(1, "World");
	auto tp3 = tuple_cat(tp1, tp2);
	cout<<"("<<get<0>(tp3)<<", "<<get<1>(tp3)<<", "<<get<2>(tp3)<<", 
        "<<get<3>(tp3)<<")"<<endl;
	return 0;
}

2.
What will be the output of the following C++ code if the following arguments are executed on terminal?
===============program.cpp=============
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
    for(int i=0;i<argc;i++)
	cout<<argv[i]<<"\n";
}
=======================================
================commands===============
$ g++ program.cpp -o output
$ ./output Hello World
=======================================

3.
What will be the output of the following C++ code?
#include <iostream>
using namespace std; 
int main()
{
    int x = -1;
    char *ptr;
    ptr = new char[256];
    try 
    {
        if (x < 0)
        {
            throw x;
        }
        if (ptr == NULL)
        {
            throw " ptr is NULL ";
        }
    }
    catch (...) 
    {
        cout << "Exception occurred: exiting "<< endl;
    }
    return 0;
}

5.
What will be the output of the following C++ code?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool myfunction (int i, int j) 
{
    return (i==j);
}
int main () 
{
    int myints[] = {10, 20, 20, 20, 30, 30, 20, 20, 10};
    vector<int> myvector (myints, myints + 9);
    vector<int> :: iterator it;
    it = unique (myvector.begin(), myvector.end());                                
    myvector.resize( distance(myvector.begin(), it) );
    unique (myvector.begin(), myvector.end(), myfunction);
    for (it = myvector.begin(); it != myvector.end(); ++it)
        cout << ' ' << *it;
    return 0;
}

7.
What will be the output of the following C++ code?
#include<iostream> 
#include<iterator> 
#include<vector> 
using namespace std; 
int main() 
{ 
    vector<int> ar = { 1, 2, 3, 4, 5 }; 
    vector<int>::iterator ptr = ar.begin(); 
    ptr = advance(ptr, 2);
    cout << *ptr << endl; 
    return 0; 
}

8.
What will be the output of the following C++ code?
#include <iostream> 
#include <algorithm>
#include <vector>
using namespace std;
int main ()
{
    int first[] = {5, 10, 15, 20, 25};
    int second[] = {50, 40, 30, 20, 10};
    vector<int> v(10);
    vector<int> :: iterator it;
    sort (first, first + 5);
    sort (second, second + 5);
    it = set_union (first, first + 5, second, second + 5, v.begin());  
    v.resize(it-v.begin());
    for (it = v.begin(); it != v.end(); ++it)
        cout << ' ' << *it;
    cout << '\n';
    return 0;
}

10.
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class X 
{
    public:
    int a;
	void f(int b) 
	{
		cout<< b << endl;
	}
};
int main() 
{
    int X :: *ptiptr = &X :: a;
    void (X :: * ptfptr) (int) = &X :: f;
    X xobject;
    xobject.*ptiptr = 10;
    cout << xobject.*ptiptr << endl;
    (xobject.*ptfptr) (20);
}