Q88
What will be the output of the following C++ code? #include #include using namespace std; int main() vector v; for (int i = 1; i <= 5; i++) v.push_back(i); for(int i=0;i<v.size();i++) cout<<v[i]<<" "; cout<<endl; v.assign(3, 8); for(int i=0;i<v.size();i++) cout<<v[i]<<" "; cout<<endl; return 0;
A.
1 2 3 4 5
8 8 8
Answer8 8 8
B.
1 2 3 4 5
8 8 8 8 8
8 8 8 8 8
C.
1 2 3 4 5
8 8 8 4 5
8 8 8 4 5
D.
1 2 3 4 5
Answer: Option A
Solution
Answer: Option A
No explanation is given for this question Let's Discuss on Board