1.

What is the output of this program?
#include <iostream>
#include <vector>
#include <iterator>
using namespace std;
int main ()
{
vector<int> VectorData;
for (int k = 0; k <= 8; k++)
VectorData.push_back(k);
VectorData.erase (VectorData.begin() + 6);
VectorData.erase (VectorData.begin(), VectorData.begin() + 4);
for (unsigned k = 0; k < VectorData.size(); ++k)
{
cout << ' ' << VectorData[k];
}
return 0;
}

A. Compilation Error
B. Runtime Error
C. 4 5 7 8
D. 4 5 7
E. None of these
Answer» D. 4 5 7


Discussion

No Comment Found

Related MCQs