Solved

Assume the Method DoSomething Has Been Defined as Follows

Question 95

Multiple Choice

Assume the method doSomething has been defined as follows:
Int [] doSomething (int[] values)
{
Int [] result = new int[values.length - 1];
For (int i = 0; i < result.length; i++)
{
Result[i] = values[i] + values[i + 1];
}
Return result;
}
What is printed by the statements below?
Int [] nums = {3, 18, 29, -2} ;
System.out.print (Arrays.toString(doSomething(nums) ) ) ;


A) [4, 19, 30, -1]
B) [21, 47, 27]
C) [21, 50, 48]
D) [3, 21, 47, 27]

Correct Answer:

verifed

Verified

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

Related Questions