Solved

Consider the Helper Method ReversePrint, Which Uses Recursion to Display

Question 104

Multiple Choice

Consider the helper method reversePrint, which uses recursion to display in reverse the elements in a section of an array limited by the firstIndex and lastIndex arguments. What statement should be used to complete the recursive method? public static void reversePrint(int[] array, int firstIndex, int lastIndex)
{
If (firstIndex < lastIndex)
{
________________________________________
}
System.out.println(array[firstIndex]) ;
}
Public static void main(String[] args)
{
Int [] numbers = { 4, 7, 1, 0, 2, 7 };
ReversePrint(numbers, 0, numbers.length - 1) ;
}


A) reversePrint(array, firstIndex, lastIndex + 1) ;
B) reversePrint(array, firstIndex, lastIndex - 1) ;
C) reversePrint(array, firstIndex + 1, lastIndex - 1) ;
D) reversePrint(array, firstIndex + 1, lastIndex) ;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions