Tricky_Java_Array_Questions
Tricky_Java_Array_Questions
System.out.println(arr[0]);
A) 0
B) Garbage value
C) Compilation error
D) Runtime error
Answer: A
int[] a = null;
System.out.println(a.length);
A) 0
B) NullPointerException
C) Compilation error
D) 1
Answer: B
A) Illegal
B) Needs size
C) Correct syntax
Answer: C
int[] a = {1,2,3};
int[] b = a;
b[0] = 99;
System.out.println(a[0]);
A) 1
B) 99
C) Compilation error
D) Garbage
Answer: B
System.out.println(arr[0][0]);
Answer: D) NullPointerException