vector ch = {\’f\’, \’o\’, \’r\’, \’k\’, \’c\’, \’p\’, \’p\’};
vector ch2 = {\’f\’, \’o\’, \’r\’, \’k\’, \’j\’, \’a\’, \’v\’, \’a\’};
reverse(ch.begin() + 3, ch.end()-1);
reverse(ch2.begin() + 3, ch2.begin() + 5);
cout << ch[6] << \" \"<< ch2[5]; [/sourcecode] (A) p a
(B) c a
(C) k k
(D) None of the mentioned


Answer: (A)

Explanation:
reverse[first, last): reverse the elements of the vector including first but not last. The elements of the vector ch2 after reversing will be as such {\’f\’, \’o\’, \’r\’, \’j\’, \’k\’, \’a\’, \’v\’, \’a\’}.

Quiz of this Question


  • Last Updated : 19 Nov, 2018

Share your thoughts in the comments