Ask Question
20 January, 10:22

Suppose you have the following declaration. char[] nameList = new char[100]; Which of the following range is valid for the index of the array nameList. (i) 1 through 100 (ii) 0 through 1001. Both are invalid2. Only (i) 3. None of these4. Only (ii)

+1
Answers (1)
  1. 20 January, 10:34
    0
    4. Only (ii)

    Explanation:

    The declaration of the array can be of two types:

    1. int a[100];

    2. int[] a = new int[100];

    The general thing about an array is that whenever we want to undergo traversal in an array, we always have to start from the 0th position as the size of the array may be a whole number (let us say 10). So, to undergo traversal in an array, we start from 0 to n-1 (in this case 9) such that it covers the size of the array.

    The size of an array can be finite or infinite. The general rule is it starts from 0 to n-1 where n is the size of the array. In the above example, the range of the index of the array will be 0 through 100 and not 1 through 100.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Suppose you have the following declaration. char[] nameList = new char[100]; Which of the following range is valid for the index of the ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers