If we stored five elements or data items in an array, what will be the index address or the index number of the array’s last data item?
A) 8
B) 4
C) 5
D) 2
Sign Up to our social questions and Answers Engine to ask questions, answer people's questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Answer: Option B) 4
The array uses the contiguous block of memory for storing the data elements. Hence the data items pushed into an array are stored at the continuous address space. The index number of the array begins with zero so, the first data item pushed into the array will be stored at zero and so on. Hence index number of the last (fifth) element will be 4.
Hence the answer is option B) 4
Answer: B) 4.
Explanation:
In an array, we have to store elements or data array index starting from 0(zero).
so 5 elements mean we store like this
int arr[] ={1,2,3,4,5}
arr[0]=1,
arr[1]=2,
arr[2]=3,
arr[3]= 4,
arr[4]=5.
arr[index] = value ends with 4.