Multiple choice technology programming languages

Which of the folowing are correct for the Structs and Classes ?

  1. Both are essential templates for which we can create objects.

  2. Both structs and classes are reference types and are stored on heap .

  3. For both struct and class, we use 'new' keyword to declare an instance.

  4. All of the above are correct

Reveal answer Fill a bubble to check yourself
A,C Correct answer
Explanation

Both structs and classes serve as templates for object creation (option A), and both use the 'new' keyword to instantiate (option C). However, option B is incorrect because structs are value types stored on the stack (or inline), while classes are reference types stored on the heap.