Advertisements
Advertisements
Question
A single dimensional array has 50 elements; which of the following is the correct statement to initialize the last element to 100?
Options
x[51]=100
x[48]=100
x[49]100
x[50]=100
MCQ
Solution
x[49]100
Explanation:
- In a single-dimensional array with 50 elements, the indices range from 0 to 49.
- Therefore, the last element of the array is at index 49, and x[49]100 Correctly initializes this last element to 100.
shaalaa.com
Is there an error in this question or solution?