Computer Applications
Answer
run time error
Reason — In Java, arrays are zero-indexed, meaning the valid indices range from 0 to arr.length - 1. arr.length gives the total number of elements in the array, but accessing arr[arr.length] tries to access an index outside the valid range, resulting in a ArrayIndexOutOfBoundsException at runtime.
Analysing other options:
- Logical error: Incorrect because this is not an issue of incorrect logic but an attempt to access an invalid array index.
- Syntax error: Incorrect because the code is syntactically valid and compiles without issues.
- No error: Incorrect because a runtime error occurs when the code is executed.