Advertisements
Advertisements
Question
Identify the true statement.
Options
In an array, all elements have same data type.
In a class, all members have same data type.
In an array, all elements have different data type.
In a class, all members have same value.
MCQ
Advertisements
Solution
In an array, all elements have same data type.
Explanation:
- An array is a collection of elements of the same data type stored in consecutive memory locations. It is used to store multiple values under a single variable name.
- Since all elements belong to the same type, the compiler knows how much memory to allocate for each element.
shaalaa.com
Is there an error in this question or solution?
Chapter 2: Class as the Basis of all Computation - Exercises [Page 64]
