Answer:Consider the following code snippet:
int main()
{
vector <int> v1(10);
vector <int> v2(10);
v1.at(0)=24;
v1.at(1)=20;
v1.at(2)=38;
for(int i=0;i <3; i++)
{
cout<<v1[i]<<" ";
}
v2=v1;
cout<<v2[0];
return 0;
}
What is the output of the above program?
Options
a) Error as vectors cannot be copied
b) 24 20 38 24
c) 24 20 38
d) No output
Answer : b) 24 20 38 24