Q. What is an array?
β
Correct Answer: (B)
an array is a collection of variables that are of the same data type.
Explanation:
In C language, an array is:
A collection of elements (variables), all of the same data type, stored in contiguous memory locations, and accessed using an index.
Example:
int numbers[5] = {1, 2, 3, 4, 5};
- This is an array of 5 integers.
- All elements are of type int.
- Indexed from 0 to 4.
Evaluating the Options:
| Option | Explanation | Correct? |
|---|---|---|
| (A) Collection of dissimilar data types | β Incorrect β that would describe a structure (struct) | |
| (B) Collection of same data type | β Correct | |
| (C) Not a collection of same data type | β Incorrect | |
| (D) None of the above | β Incorrect |
Final Answer: (B) An array is a collection of variables that are of the same data type. β