English

A single dimensional array has N elements in it. What is the last subscript?

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 N1.
shaalaa.com
  Is there an error in this question or solution?
Chapter 7: Arrays - One Dimension - Exercises [Page 172]

APPEARS IN

Rupa Pandit Computer Applications [English] Class 10 ICSE
Chapter 7 Arrays - One Dimension
Exercises | Q 1. (i) | Page 172
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×