Working with Array

PRE TEST :


Question 1:
Which of these is an incorrect array declaration?

int arr[] = new int[5];
int [] arr = new int[5];
int arr[] arr = new int[5];
int arr[] = int [5] new;


Question 2:
What will this code print?
int arr[] = new int [5];
System.out.print(arr);
0.
value stored in arr[0].
00000
Garbage value.


Question 3:
Which of these is an incorrect Statement?
It is necessary to use new operator to initialize an array.
Array can be initialized using comma separated expressions surrounded by curly braces.
Array can be initialized when they are declared.
none of the above


Question 4:
Analyze the following code and choose the correct answer?
Int[] arr =new int[5];
Arr = new int[6];
The code has compile errors because the variable arr cannot be changed once it is assigned
The code has runtime errors because the variable arr cannot be changed once it is assigned
The code can compile and run fine. The second line assigns a new array to arr
The code has compile errors because we cannot assign a different size array to arr


Question 5:
In java arrays are?
objects
object references
primitive data type
None of the above


Question 6:
Which one of the following is a valid statement?
char[] c = new char();
char[] c = new char[5];
char[] c = new char(4);
char[] c = new char[];


Question 7:
Which is the valid for 2-D array?
int a[5];
int a[3][3];
int a[3][3][3];
None of mentioned


Number of score out of 7 = Score in percentage =