Try this exercise. Click the correct answer from the options.
What will the following pseudocode do to an input string?
1public static String reverseStr(String str) {
2 int start = 0;
3 int end = str.length() - 1;
4 char[] strCopy = str.toCharArray();
5 while (start < end) {
6 char temp = strCopy[start];
7 strCopy[start] = strCopy[end];
8 strCopy[end] = temp;
9 start++;
10 end--;
11 }
12 return new String(strCopy);
13}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.