Vidyalelo
C++ Programming · Q291

C++ miscellaneous

Programming · C++ Programming · question 291

Q291

What will be the output of the following C++ code? #include #include #include using namespace std; bool IsOdd (int i) return (i%2)==1; int main () vector v; for (int i=1; i ::iterator bound; bound = partition (v.begin(), v.end(), IsOdd); for (vector ::iterator it=v.begin(); it!=bound; ++it) cout ::iterator it=bound; it!=v.end(); ++it) cout << ' ' << *it; cout << ' '; return 0;

A.
1 9 3 7 5
6 4 8 2 10
Answer
B.
6 4 8 2 10
1 9 3 7 5
C.
6 4 8 2 10
6 4 8 2 10
D.
1 9 3 7 5
1 9 3 7 5

Answer: Option A

Solution

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