Difficulty: Easy
Correct Answer: 0 byte
Explanation:
Introduction / Context:
In managed languages such as C#, object layout is abstracted away by the runtime. Exams often check whether you incorrectly assume that “more methods or interfaces mean a larger object.”
Given Data / Assumptions:
Concept / Approach:
In exam-oriented C# questions, instance size is typically considered as coming from instance fields. Methods (including interface implementations) are shared code and do not add per-object data. Therefore, with no fields, the instance is treated as having “0 byte” payload in such questions—even though actual CLR objects have a header and alignment that are not part of this simplified model.
Step-by-Step Solution:
Verification / Alternative check:
Using reflection or unsafe code reveals real headers; however, MCQs usually abstract that away to emphasize that methods/interfaces don’t increase instance size.
Why Other Options Are Wrong:
They assume a fixed byte size unrelated to instance fields or mix in header sizes, which the exam does not request.
Common Pitfalls:
Confusing code size with object instance size; believing more methods or interfaces make each object larger.
Final Answer:
0 byte
Discussion & Comments