Ask Question

int[] num = new int[100]; for (int i = 0; i < 50; i++) num[i] = i; num[5] = 10; num[55] = 100; What is the index number of the last component in the array above?1. 992. 1003. 04. 101

+1
Answers (1)
  1. 21 June, 16:36
    0
    1. 99

    Explanation:

    As the array is declared with space of 100 integers, 100 integers' space will be allocated to variable num. Moreover, Index number of last component is always the length - 1 because array's index start with 0 and ends till length-1. As array will initialize all the remaining spaces with garbage value so they will be displayed if accessed through num[index] where index s the index number to be displayed.

    As size of array is 100. So, 99 will be the index of the last component of the array.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “int[] num = new int[100]; for (int i = 0; i < 50; i++) num[i] = i; num[5] = 10; num[55] = 100; What is the index number of the last ...” 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