Question: 1 / 400
Which of the following statements about arrays is true?
Arrays can only store numerical values
Arrays have a fixed size and can hold a collection of values
Arrays are versatile data structures that can hold a collection of values, and one of their key characteristics is that they have a fixed size. This means that when you create an array, you define its length, and it can only hold that specified number of elements. Each element can be of a specific data type (such as integers, strings, or objects, depending on the programming language).
By having a fixed size, arrays provide efficient indexing based on numerical indices, allowing for quick access to each element. This organization is beneficial for tasks that require storing and managing multiple related values as a single unit.
The other statements do not accurately reflect the capabilities or properties of arrays. For instance, arrays can store various types of data, not just numerical values; they can be accessed using numerical indices rather than string indices; and they can accommodate duplicate values—an attribute that enhances their utility in numerous programming scenarios. Thus, the assertion that arrays have a fixed size and can hold a collection of values accurately captures the essential characteristics of arrays.
Get further explanation with Examzify DeepDiveBetaArrays can only be accessed by string indices
Arrays cannot store duplicate values