What follows is a fill in the blank question with 9 blanks.
The curly bracket used in java to enclose units of code can not be used in a fill in questions. For this
questions the curly brackets will be substituted with comments. Interpret the open and close comments as curly brackets.
Given the following method with an array values [7,2,5,8,3,9]
public static int sumValues(int index)
//open method
if(index>=values.length)
return 0;
else
return values[index] + sumValues(index +1);
//close method
Is sumValues(4) a valid call? Yes/No Blank 15. Fill in the blank, read surrounding text.
If so what is returned from the method? returned value or No Blank 16. Fill in the blank, read surrounding text.
Is sumValues(1) a valid call? Yes/No Blank 17. Fill in the blank, read surrounding text.
If so what is returned from the method? returned value or No Blank 18. Fill in the blank, read surrounding text.
Is sumValues(4) a valid call? Yes/No Blank 15. Fill in the blank, read surrounding text.
Yes
If so what is returned from the method? returned value or No Blank 16. Fill in the blank, read surrounding text.
12
Is sumValues(1) a valid call? Yes/No Blank 17. Fill in the blank, read surrounding text.
Yes
If so what is returned from the method? returned value or No Blank 18. Fill in the blank, read surrounding text.
27
Comments
Leave a comment