1.
What are binary functors?

2.
Why do we need relationships between classes?

3.
What will be the output of the following C++ code?
#include <iostream>  
#include <utility>
#include <string>
 
using namespace std;
 
int main () 
{
  pair <int,int> p1(1,2);
  pair <int,int> p2(3,4);
  cout<<"Pair(first,second) = ("<<p1.first<<","<<p1.second<<")\n";
  p1.swap(p2);
  cout<<"Pair(first,second) = ("<<p1.first<<","<<p1.second<<")\n";
  return 0;
}

4.
What is meant by permutation in c++?

6.
Which algorithm is used in subtract_with_carry_engine?

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 = next(ptr, 3);
    cout << *ptr << endl; 
    return 0; 
}

8.
What will be the output of the following C++ code?
#include <iostream>
#include <exception>
using namespace std;
struct MyException : public exception
{
    const char * what () const throw ()
    {
        return "C++ Exception";
    }
};
int main()
{
    try
    {
        throw MyException();
    }
    catch(MyException& e)
    {
        cout << "Exception caught" << std::endl;
        cout << e.what() << std::endl;
    }
    catch(std::exception& e)
    {
    }    
}

9.
What will be the output of the following C++ code?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main () 
{
    vector<int> myvector (5);
    fill (myvector.begin(), myvector.begin() + 4, 5);
    fill (myvector.begin() + 3,myvector.end() - 2, 8);
    for (vector<int> :: iterator it = myvector.begin();
        it != myvector.end(); ++it)
    cout << ' ' << *it;
    return 0;
}

10.
What will be the output of the following C++ code?
#include <iostream>  
#include <utility>
 
using namespace std;
 
int main () 
{
  pair <int,int> p(1,2);
  cout<<"Pair(first,second) = ("<<p.first<<","<<p.second<<")\n";
  return 0;
}