Java.lang Class

1

Which of the following statements are valid array declarations?
A. int number();
B. int number[];
C. double[] marks;
D. counter int[];

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

2

Which three are legal array declarations?
1.int [] myScores [];
2. char [] myChars;
3. int [6] myScores;
4. Dog myDogs [];
5. Dog myDogs [7];

A. 1, 2, 4
B. 2, 4, 5
C. 2, 3, 4
D. All are correct.

3

Which one of the following will declare an array and initialize it with five numbers?

A. Array a = new Array(5);
B. int [] a = {23,22,21,20,19};
C. int a [] = new int[5];
D. int [5] array;

4

int number[] = new int[5]; After execution of this statement, which of the following are true?

(A) number[0] is undefined
(B) number[5] is undefined
(C) number[4] is null
(D) number[2] is 0
(E) number.length() is 5

A. (A) & (E)
B. (C) & (E)
C. (E)
D. (B), (D) & (E)

5

Which of the following statements are valid array declaration ?

(A) int number();
(B) float average[];
(C) double[] marks;
(D) counter int[];
A. (A)
B. (A) & (C)
C. (B) & (C)
D. (D)