Advertisements
Advertisements
Question
A single dimensional array has N elements in it. What is the last subscript?
Options
N
N+1
0
N−1
MCQ
Advertisements
Solution
N−1
Explanation:
- In computer programming languages like Java, C, and C++, arrays use a zero-based indexing system, meaning the very first element is stored at index 0.
- Because counting begins at 0 instead of 1, the index position shifts down by one digit, making the final element of an array with N elements always sit at index N−1.
shaalaa.com
Is there an error in this question or solution?
