The specification does not tell you specifically how the sort is implemented (only that it is in-place). Tracing through a basic min-sorting algorithm (basically starting at the first index and finding the next smallest number in the array to put there).
First iteration (index = 0):
grab the first two numbers and use compareNums to find out which is smaller and put it at the index => compareNums(5, 2) = 3 therefore we know 2 is less so we swap them; array = [2, 5, 1, 3, 4]
compare current min with the next number => compareNums(2, 1) = 1 therefore we know 1 is less so we swap them; array = [1, 5, 2, 3, 4]
compare current min with the next number => compareNums(1, 3) = -2 therefore we know 1 is less (no swap needed)
compare current min with the next number => compareNums(1, 4) = -3 therefore we know 1 is less (no swap needed); we are at the end of the array so we are done with this iteration
Iteration 2 (index = 1, array = [1, 5, 2, 3, 4])
starting at the index, grab the next two values and compare => compareNums(5, 2) = 3 so we know 2 is less and we swap; array = [1, 2, 5, 3, 4]
compare current min with the next number => compareNums(2, 3) = -1 so we know 2 is less (no swap needed);
etc, we get to the end of the array again with no further modifications and we are done with this iteration
Iteration 3 (index = 2, array = [1, 2, 5, 3, 4])
starting at the index, grab the next two values and compare => compareNums(5, 3) = 2 so we know 3 is less and we swap; array = [1, 2, 3, 5, 4]
etc, we get to the end of the array again with no further modifications and we are done with this iteration
Iteration 3 (index = 2, array = [1, 2, 3, 5, 4])
starting at the index, grab the next two values and compare => compareNums(5, 4) = 1 so we know 4 is less and we swap; array = [1, 2, 3, 4, 5]
As you can see, we now have a sorted array (in place). Hopefully this clarifies how the function can be used repeatedly to do the sorting.