Ask Question
12 October, 11:11

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

+2
Answers (1)
  1. 12 October, 11:32
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers