Build your intuition. Click the correct answer from the options.

What will the following pseudocode do to an input string?

1public static string ReverseStr(string str)
2{
3    int start = 0;
4    int end = str.Length - 1;
5    char[] strCopy = str.ToCharArray();
6    while (start < end)
7    {
8        char temp = strCopy[start];
9        strCopy[start] = strCopy[end];
10        strCopy[end] = temp;
11        start++;
12        end--;
13    }
14    return new string(strCopy);
15}

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.