Software Engineering
Accenture PrimermediumSoftware EngineeringArrays

Assume you have an array named numbers of size 10. Which of the assignment is valid?

Answer options

A
numbers[0] <- 10
B
numbers[9] <- 5
C
numbers[10] <- 11
D
numbers[11] <- 6

Correct answer: numbers[0] <- 10, numbers[9] <- 5

Explanation

array index starts from 0 to 9, for 10 elements. Assigning values to numbers[10],numbers[11] is not valid, since the index exceeds the size of array resulting in unpredictable results

Related Accenture Software Engineering questions

Practice more Accenture Software Engineering questions

PrimerDumps has 1400+ primer questions, 2026 mocks and coding hands-on — all free.