-
What is the correct way to declare an array of integers in Java?
array arr[];
int arr[];
int arr;
int arr{};
-
Which index does a Java array start from?
1
0
-1
Any random number
-
What will happen if you try to access an array element beyond its size?
ArrayIndexOutOfBoundsException
NullPointerException
Compilation Error
Program runs normally
-
Which of the following is the correct way to initialize an array at the time of declaration?
int arr[5] = {1, 2, 3, 4, 5};
int arr[] = {1, 2, 3, 4, 5};
int arr{} = {1, 2, 3, 4, 5};
int arr = {1, 2, 3, 4, 5};
-
What is the length of the array `int[] arr = new int[10];`?
9
10
Depends on elements
0