Ask Question

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 100

1. Both are invalid

2. Only (i)

3. None of these

4. Only (ii)

+5
Answers (1)
  1. 26 February, 02:34
    0
    Option 1 is the correct answer.

    Explanation:

    If a user declares an array of "100" size then it will count the index value from (0 to 99) because an array property says that when there is an array of "N" size then the array index value starts from 0 and ends on (N-1).

    Statement (i) says that the index value is 1 to 100 when the array size is 100. but it is a wrong statement because it neglects the property of an array. Statement (ii) says that the index value is 0 to 100 when the array size is 100. but it is a wrong statement because it neglects the property of array and the index value is (0 to 100) is right when the size of an array is 101.

    Option 1 says that both are the incorrect statement. Hence it is the correct choice answer for the above question. while the other is not because - -

    Option 2 says that Statement (i) is right but it is wrong because it neglects the property of an array. Option 3 says that none of the options are correct but option 1 is the correct answer. Option 4 says that Statement (ii) is right but it is wrong because it neglects the property of an array.
Know the Answer?
Not Sure About the Answer?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers