1.
Q1: The following method is intended to return a String formed by concatenating elements from the parameter
words
. The elements to be concatenated start with startIndex
and continue through the last element of words
and should appear in reverse order in the resulting string.
// Assume that words.length > 0 and startIndex >= 0
public String concatWords (String [] words, int startIndex) {
String result = "";
/* missing code */
return result;
}
For example, the execution of the following code segment should result in “CarHouseGorilla” being printed.
String [] things = {"Bear", "Apple", "Gorilla", "House", "Car"};
System.out.println(concatWords(things, 2));
Which of the following code segments is a correct replacement for
/* missing code */
so that the method will work as intended?

- I only
- II only
- III only
- I and II only
- II and III only