Which of the following code gives error of “out of bounds” in array?
PYQ RPSC Programmer 2024
Which of the following code gives error of “out of bounds” in array?
- A.
int[] a = new int[5];
a[4] = 5; - B.
int[] a = {1, 2, 3, 4, 5};
System.out.print(a[2]); - C.
int[] a = new int[10];
for (int i = 0; i < a.length; i++) {
a[i] = i * 2;
} - D.
int[] a = new int[3];
a[3] = 9; - E.
Question not attempted
Attempted by 367 students.
Sign up free to check your answer
Sign up freeLoading lesson…

