Which of the following is the advantage of the array data structure?
2023
Which of the following is the advantage of the array data structure?
- A.
Elements of mixed data types can be stored
- B.
Easier to access the elements in an array
- C.
Index of the first element starts from 1
- D.
More than one of the above
- E.
None of the above
Attempted by 1357 students.
Show answer & explanation
Correct answer: B
Arrays provide direct access to elements using their index, which allows for fast retrieval and efficient memory access. This is a key advantage of arrays. However, arrays store elements of the same data type, not mixed types. Also, indexing typically starts from 0 in most programming languages, not 1. Therefore, only the advantage related to easy access is valid. Other options either misstate properties or claim multiple advantages when only one is correct.