contestada

Consider this static method:

public static int[] blend( int[] a, int[] b )

{
int[] c = new int[ a.length + b.length ];
int i = 0;
while ( i < a.length && i < b.length )
{
c[ 2 * i ] = a[ i ];
c[ 2 * i + 1 ] = b[ i ];
i++;
}
if ( a.length < b.length )
{
for ( int j = i; j < b.length; j++ )
c[ i + j ] = b[ j ];
}
else
{
for ( int j = i; j < a.length; j++ )
c[ i + j ] = a[ j ];
}
return c;
}

If a and b are initialized arrays of ints, and if the elements of both arrays are initialized, then which of the following best describes the value of blend( a, b )?

a. An array formed by inserting all the elements of b (in order) after the last element of a.
b. An array formed by inserting all the elements of a (in order) after the last element of b.
c. An array formed by alternating elements from a and b, until one of them is exhausted, followed by any remaining elements of the other array (in order).
d. If a and b have the same length, an array formed by alternating elements from a and b. Otherwise, an array made up of all the elements (in order) of the longer array that extend beyond the length of the shorter array.