A) int total = 0;
For ( int subItems : items )
For ( int item : subItems )
Total += item;
B) int total = 0;
For ( int item: int[] subItems : items )
Total += item;
C) int total = 0;
For ( int[] subItems : items )
For ( int item : items )
Total += item;
D) int total = 0;
For ( int[] subItems : items )
For ( int item : subItems )
Total += item;
Correct Answer
verified
Multiple Choice
A) Positive integers.
B) Negative integers.
C) Zero.
D) None of the above.
Correct Answer
verified
Multiple Choice
A) items[ 3 ].[ 4 ].
B) items[ 3[ 4 ] ].
C) items[ 3 ][ 4 ].
D) items[ 3,4 ].
Correct Answer
verified
Multiple Choice
A) ++arrayName[ i ].
B) arrayName++[ i ].
C) arrayName[ i++ ].
D) None of the above.
Correct Answer
verified
Multiple Choice
A) 0.
B) 3.
C) 9.
D) 0
Correct Answer
verified
Multiple Choice
A) The first statement declares an array reference.
B) The second statement creates the array.
C) g is a reference to an array of integers.
D) The value of g[ 3 ] is -1.
Correct Answer
verified
Multiple Choice
A) square brackets ([]) .
B) ellipsis (…) .
C) varargs keyword.
D) All of the above are acceptable to indicate a variable number of arguments.
Correct Answer
verified
Multiple Choice
A) 0,2,5,6,12.
B) 0,2,12,6,8.
C) 0,2,4,6,5.
D) 0,2,4,6,12.
Correct Answer
verified
Multiple Choice
A) takeArray( items[] ) .
B) takeArray( items ) .
C) takeArray( items[ 9 ] ) .
D) Arrays cannot be passed to methods-each item must be sent to the method separately.
Correct Answer
verified
Multiple Choice
A) int[] n = { 1,2,3,4,5 };.
B) array n[ int ] = { 1,2,3,4,5 };.
C) int n[ 5 ] = { 1;2;3;4;5 };.
D) int n = new int( 1,2,3,4,5 ) ;.
Correct Answer
verified
Multiple Choice
A) declare then reference the array.
B) create then declare the array.
C) create then reference the array.
D) declare then create the array.
Correct Answer
verified
Multiple Choice
A) ArrayOutOfBoundsException.
B) ArrayElementOutOfBoundsException.
C) ArrayIndexOutOfBoundsException.
D) ArrayException.
Correct Answer
verified
Multiple Choice
A) Calculating the product of all the values in an array.
B) Displaying all even element values in an array.
C) Comparing the elements in an array to a specific value.
D) Incrementing the value stored in each element of the array.
Correct Answer
verified
Multiple Choice
A) compare.
B) compares.
C) equal.
D) equals.
Correct Answer
verified
Multiple Choice
A) 4.
B) 8.
C) 12.
D) 6.
Correct Answer
verified
Multiple Choice
A) Changing the value of a constant after it is declared.
B) Changing the value at a given index of an array after it is created.
C) Using a final variable before it is initialized.
D) All of the above will produce compiler errors.
Correct Answer
verified
Multiple Choice
A) A and C.
B) A and D.
C) B and D.
D) B and C.
Correct Answer
verified
Multiple Choice
A) sort,binarySearch.
B) sort,fill.
C) binarySearch,equals.
D) binarySearch,fill.
Correct Answer
verified
Multiple Choice
A) int total = 0;
For ( int row = 0;row < items.length;row++ )
{
Total = 0;
For ( int column = 0;column < a[ row ].length;column++ )
Total += a[ row ][ column ];
System.out.printf( "%d\n",total ) ;
}
B) int total = 0;
For ( int row = 0;row < items.length;row++ )
{
For ( int column = 0;column < a[ row ].length;column++ )
Total += a[ row ][ column ];
System.out.printf( "%d\n",total ) ;
}
C) int total = 0;
For ( int row = 0;row < items.length;row++ )
{
For ( int column = 0;column < a[ column ].length;column++ )
Total += a[ row ][ column ];
System.out.printf( "%d\n",total ) ;
}
D) int total = 0;
For ( int row = 0;row < items.length;row++ )
{
Total = 0;
For ( int column = 0;column < a[ column ].length;column++ )
Total += a[ row ][ column ];
System.out.printf( "%d\n",total ) ;
}
Correct Answer
verified
Multiple Choice
A) a do while statement.
B) a for statement.
C) two nested for statements.
D) three nested for statements.
Correct Answer
verified
Showing 21 - 40 of 41
Related Exams