Vidyalelo
C++ Programming · Q519

C++ miscellaneous

Programming · C++ Programming · question 519

Q519

What will be the output of the following C++ code? #include #include #include #include using namespace std; int square(int i) return i * i; int main() vector V, V2; V.push_back(0); V.push_back(1); V.push_back(2); transform(V.begin(), V.end(), back_inserter(V2), square); copy(V2.begin(), V2.end(), ostream_iterator (cout, " ")); cout << endl;

A.
0
B.
1
C.
2
D.
0 1 4
Answer

Answer: Option D

Solution

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