Array in Java MCQs Exercise I

Ques 1 Array


Which of the following is the correct declaration of Array in Java?

A int arr[];
B int arr[5];
C int [] arr;
D Both (a) and (c)

Ques 2 Array


Which of the following is true about Array?

A Array index start with 0.
B Array have a non contiguous memory allocation.
C Array index can be any primitive datatypes.
D All of these

Ques 3 Array


Which two statements are true for a two-dimensional array?
i) It is implemented as an array of the specified element type
ii) Using a row by column convention, each row of a two-dimensional array must be of same size
iii) At declaration time,the number of elements of the array in each dimension must be specified
iv) All the methods of the class Object may be invoked on the two-dimensional arrary

A Option (i) and (ii)
B Option (i) and (iv)
C Option (ii) and(iii)
D Option (iii) and (iv)

Ques 4 Array


How can you copy the contents of one array into another in Java?

A Using System.arraycopy()
B Using a for loop
C Using the clone() method
D All of the above