31.
Which of the following is an advantage of Forward iterator over input and output iterator?

35.
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.pop_back();
    v.pop_back();
    cout<<v.capacity()<<endl;
    return 0; 
}

39.
What will be the output of the following C++ code?
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
template <class type>
type MyMax(const type Var1, const type Var2)
{
    cout << "no specialization";
    return Var1 < Var2 ? Var2 : Var1;
}
template <>
const char *MyMax(const char *Var1, const char *Var2)
{
    return (strcmp(Var1, Var2)<0) ? Var2 : Var1;
}
int main()
{
    string Str1 = "class", Str2 = "template";
    const char *Var3 = "class";
    const char *Var4 = "template";
    const char *q = MyMax(Var3, Var4);
    cout << q << endl;
    return 0;
}

40.
What will be the output of the following C++ code in text files?
#include <stdio.h>
int main ()
{
    char buffer[BUFSIZ];
    FILE *p1, *p2;
    p1 = fopen ("myfile.txt", "w");
    p2 = fopen ("myfile2.txt", "a");
    setbuf ( p1 , buffer );
    fputs ("Buffered stream", p1);
    fflush (p1);
    setbuf ( p2 , NULL );
    fputs ("Unbuffered stream", p2);
    fclose (p1);
    fclose (p2);
    return 0;
}