Computers
Go to...
Index
Translations
Pronunciation
Images
Computers
Geography
Languages
0 / 60 seg.
Which statement accesses the third element of an array named foo?
F
_
_
[
2
]
Clue
foo[2]
foo(3)
foo[3]
foo(2)
In many programming languages, arrays are indexed starting at 0, so the first element of the array is at index 0, the second element is at index 1, and so on. Therefore, to access the third element of an array named "foo", you would use the index 2 (since the array is indexed starting at 0). This can be done using the syntax foo[2] or foo(2) depending on the programming language. In some languages like Java, you can use foo[2] or foo[3] to access the third element.
Previous question
Start
Next question
Please enable JavaScript to continue using this application.