Difficulty: Easy
Correct Answer: 1 and 3 only
Explanation:
Introduction / Context:
This question checks understanding of array types and memory model in C#. Arrays are reference types whose runtime types derive from System.Array. The variable itself is a reference; the array object lives on the managed heap, not the stack.
Given Data / Assumptions:
Concept / Approach:
An array instance such as System.Int32[] is a reference type whose base class is System.Array. Therefore statements describing it as (a) an object of System.Array (as a base type) and (c) a reference to an array of integers are acceptable. Claims about stack allocation for the array object are false: the array object is on the managed heap; only the local reference variable typically resides on the stack (implementation dependent, but conceptually distinct). The compiler does not literally “derive” a new class per declaration; array types are provided by the runtime and are already derived from System.Array.
Step-by-Step Solution:
Verification / Alternative check:
Printing intMyArr.GetType().BaseType yields System.Array, confirming inheritance.
Why Other Options Are Wrong:
Any option including (2), (4), or (5) asserts incorrect derivation or storage location.
Common Pitfalls:
Equating the reference variable's storage with the array object's storage; assuming compiler creates new array classes per declaration.
Final Answer:
1 and 3 only
Discussion & Comments