Vidyalelo
C++ Programming · Q668

C++ miscellaneous

Programming · C++ Programming · question 668

Q668

What will be the output of the following C++ code? #include #include using namespace std; int main() vector v; for (int i = 1; i :: iterator i; i = v.begin(); *i = 3; for (i = v.begin(); i != v.end(); ++i) cout << *i << " "; cout<<endl; return 0;

A.
1 2 3 4 5
B.
3 2 3 4 5
Answer
C.
5 4 3 2 1
D.
3 3 3 3 3

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board