C#.NET — Which statement about interfaces is correct?

Difficulty: Easy

Correct Answer: If a class implements an interface partially, then it should be an abstract class.

Explanation:


Introduction / Context:
Understanding how classes fulfill interface contracts is fundamental to C# design. This question targets partial implementations and what is permitted inside interfaces.



Given Data / Assumptions:

  • A concrete (non-abstract) class must implement every member of its interfaces.
  • Classic C# interface rules are assumed for this curriculum.


Concept / Approach:
If a class does not implement all interface members, it cannot be concrete; it must be declared abstract so that derived types are required to finish the job. Historically, interfaces did not contain static members or data (modern C# adds advanced features, but the exam context assumes classic rules). Multiple interface inheritance is allowed for classes and interfaces.



Step-by-Step Solution:

Option A: Correct — partial implementation requires the class to be abstract.Option B: Incorrect — partial implementation is allowed only if the class is abstract.Option C/D: Incorrect in the classic ruleset — interfaces declare behavior, not static members/data.Option E: Incorrect — classes can implement multiple interfaces, and interfaces can inherit multiple interfaces.


Verification / Alternative check:
Try compiling a non-abstract class that leaves one interface member unimplemented; the compiler errors. Marking the class abstract defers the requirement to subclasses.



Why Other Options Are Wrong:
They contradict C# interface semantics in the scope of this exam (multiple interfaces allowed; no static data in interfaces; static methods not part of the classic model).



Common Pitfalls:
Forgetting to mark a partially implementing class as abstract, leading to “does not implement interface member …” compile errors.



Final Answer:
If a class implements an interface partially, then it should be an abstract class.

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion