1.

What is the output of this program?
#include <iostream>
#include <vector>
using namespace std;
int main ()
{
vector<int> VectorData;
int * ptr;
unsigned int k;
ptr = VectorData.get_allocator().allocate(6);
for (k = 0; k < 6; k++)
VectorData.get_allocator().construct(&ptr[k], k);
for (k = 0; k < 6; k++)
cout << ' ' << ptr[k];
for (k = 0; k < 6; k++)
VectorData.get_allocator().destroy(&ptr[k]);
VectorData.get_allocator().deallocate(ptr, 6);
return 0;
}

A. 0 1
B. 0 1 2
C. 0 1 2 3
D. 0 1 2 3 4
E. 0 1 2 3 4 5
Answer» F.


Discussion

No Comment Found

Related MCQs