The index(subscript) of the last element of an array ar[] is:

ICSE Class 10 Computer Applications PYQ · 2025 Paper · Section A

1(xiii)1 Mark · 2025 · Section A · 2025 Paper

The index(subscript) of the last element of an array ar[] is:

Show SolutionHide Solution↓

ar.length – 1

Reason — In Java, the length of an array ar is given by ar.length (without parentheses). Since array indexing starts from 0, the last element's index is always one less than the total length of the array. Therefore, the index of the last element is ar.length – 1.

← Previous questionNext question →

Browse the free Computer Applications sample bank