TA-002-P · Question #135
Which of the following type of variable allows multiple values of several distinct types to be grouped together as a single value?
The correct answer is B. Object C. Tuple. Both Object and Tuple support grouping multiple values of different (distinct) types. An object groups named attributes each with their own specified type, e.g., object({ name = string, age = number }). A tuple is an ordered sequence where each element can have a different type,
Question
Which of the following type of variable allows multiple values of several distinct types to be grouped together as a single value?
Options
- AMap
- BObject
- CTuple
- DList
How the community answered
(53 responses)- A4% (2)
- B91% (48)
- D6% (3)
Explanation
Both Object and Tuple support grouping multiple values of different (distinct) types. An object groups named attributes each with their own specified type, e.g., object({ name = string, age = number }). A tuple is an ordered sequence where each element can have a different type, e.g., tuple([string, number, bool]). By contrast, a map (A) requires all values to be of the same type, and a list (D) also requires uniform element types. The key differentiator is that object and tuple are structural types that permit heterogeneous types.
Topics
Community Discussion
No community discussion yet for this question.