Filters
Question type

Study Flashcards

Assume array items contains the integer values 0,2,4,6 and 8.Which of the following uses the enhanced for loop to display each value in array items?


A)
For (int i = 0;i < items.length;i++)
System.out.prinf("%d%n",items[i]) ;
B)
For (int i : items)
System.out.prinf("%d%n",items[i]) ;
C)
For (int i : items)
System.out.prinf("%d%n",i) ;
D)
For (int i = 0 : items.length)
System.out.prinf("%d%n",items[i]) ;

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

Which of the following statements about arrays are true? a) An array is a group of variables containing values that all have the same type. b) Elements are located by index. c) The length of an array c is determined by the expression c.length() ;. d) The zeroth element of array c is specified by c[0].


A) A,C,D.
B) A,B,D.
C) C,D.
D) A,B,C,D.

E) All of the above
F) C) and D)

Correct Answer

verifed

verified

In array items,which expression below accesses the value at row 3 and column 4?


A) items[3].[4]
B) items[3[4]]
C) items[3][4]
D) items[3,4]

E) All of the above
F) None of the above

Correct Answer

verifed

verified

Consider array items,which contains the values 0,2,4,6 and 8.If method changeArray is called with the method call changeArray(items,items[2]) ,what values are stored in items after the method has finished executing? Public static void changeArray(int[] passedArray,int value) { PassedArray[value] = 12; Value = 5; }


A) 0,2,5,6,12.
B) 0,2,12,6,8.
C) 0,2,4,6,5.
D) 0,2,4,6,12.

E) A) and C)
F) B) and D)

Correct Answer

verifed

verified

Showing 41 - 44 of 44

Related Exams

Show Answer