Try this exercise. Click the correct answer from the options.
What will the following pseudocode do to an input string?
1#include <algorithm>
2std::string reverseStr(std::string str) {
3 int start = 0;
4 int end = str.length() - 1;
5 while (start < end) {
6 std::swap(str[start], str[end]);
7 start++;
8 end--;
9 }
10 return str;
11}Click the option that best answers the question.
- Make a copy
- Reverse the string
- Swap the first and last letters
- Infinite loop
OUTPUT
Results will appear here.