Examenjava 8
Examenjava 8
1
Some random number.
null (*)
0
Correct
6. What is the output?
int[] arr = new int[5];
for(int i=0; i<arr.length; i++){
arr[i] = i;
}
for(int i=0; i<arr.length; i++) {
System.out.print(arr[i]);
}
01234 (*)
123
12345
012345
Correct
(1/1) Points
7. The Java compiler does not check for an ArrayIndexOutOfBoundsException
during the compilation of a program containing arrays.
True (*)
False
Correct
(1/1) Points
8. What is the starting index of an array?
It depends on the type of the array.
1
0 (*)
You can start with anything
Correct
(1/1) Points
9. What is the output?
int[] arr = new int[1];
arr[0] = 10;
System.out.println(arr[0]);
0
ArrayIndexOutOfBoundsException
1
10 (*)
Correct
(1/1) Points
10. Testing and debugging are important activities in software development.
True (*)
False
Correct
11. Runtime errors can be caught by Java’s exception handling mechanism.
True (*)
False
Correct
(1/1) Points
12. Identify where there is a potential bug in this code: