Question DSA-ARR-0022
EasyWith 0-based indexing, what is the index of the last element of an array of n elements?
- A.
n
- B.
n − 1
- C.
Show answer and explanation
Answer: B
Indices run from 0 to n − 1.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Arrays question
With 0-based indexing, what is the index of the last element of an array of n elements?
n
n − 1
Answer: B
Indices run from 0 to n − 1.
n + 1
1