1.
What is the use of rank() function in C++?

2.
What will be the output of the following C++ code?
#include <iostream>
#include <array>
using namespace std;
int main(int argc, char const *argv[])
{
	array<int,10> arr = {1,2,3,4,5};
	cout<<"size:"<<arr.size()<<endl;
	cout<<"maxsize:"<<arr.max_size()<<endl;
	return 0;
}

3.
What will be the output of the following C++ code?
#include <iostream>
#include <new>
#include <cstdlib>
using namespace std;
const int bsize = 512;
int *pa;
bool allocate = true;
void get_memory() 
{
    cerr << "free store exhausted" << endl;
    delete [] pa;
    allocate = false;
}
void eat_memory(int size) 
{
    int *p = new int[size];
    if (allocate)
        eat_memory(size);
    else
        cerr << "free store addr = " << p << endl;
}
int main()
{
    set_new_handler(get_memory);
    pa = new int[bsize];
    cerr << "free store addr = " << pa << endl;
    eat_memory(bsize);
    return 0;
}

4.
What will be the output of the following C++ code?
#include <iostream> 
#include <vector> 
 
using namespace std; 
 
int main() 
{ 
    vector<int> v; 
    for (int i = 1; i <= 5; i++) 
        v.push_back(i); 
    cout<<v.capacity()<<endl;
    v.shrink_to_fit();
    cout<<v.capacity()<<endl;
    return 0; 
}

5.
What is the operation for .*?

6.
What is the property of stable sort function provided by the STL algorithm?

7.
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int funcstatic(int)
{
    int sum = 0;
    sum = sum + 10;
    return sum;
}
int main(void)
{
    int r = 5, s;
    s = funcstatic(r);
    cout << s << endl;
    return 0;
}

8.
What will be the output of the following C++ code?
#include <iostream>
using namespace std; 
template <class T, int max>
int arrMin(T arr[], int n)
{
   int m = max;
   for (int i = 0; i < n; i++)
      if (arr[i] < m)
         m = arr[i];
 
   return m;
}
 
int main()
{
   int arr1[]  = {10, 20, 15, 12};
   int n1 = sizeof(arr1)/sizeof(arr1[0]);
 
   char arr2[] = {1, 2, 3};
   int n2 = sizeof(arr2)/sizeof(arr2[0]);
 
   cout << arrMin<int, 10000>(arr1, n1) << endl;
   cout << arrMin<char, 256>(arr2, n2);
   return 0;
}

9.
What will be the output of the following C++ code?
#include <iostream>
#include <typeinfo>
using namespace std;
class A 
{ 
};
int main()
{ 
    char c; float x;
    if (typeid(c) != typeid(x))
    cout << typeid(c).name() << endl;
    cout << typeid(A).name();
    return 0;
}

10.
What will be the output of the following C++ code?
#include <iostream>
#include <map> 
using namespace std;
int main ()
{
    multimap<char, int> mymultimap;
    mymultimap.insert(make_pair('x', 100));
    mymultimap.insert(make_pair('y', 200));
    mymultimap.insert(make_pair('y', 350));
    mymultimap.insert(make_pair('z', 500));
    cout << mymultimap.size() << '\n';
    return 0;
}