C#.NET — Which statements about interfaces are correct? 1) A class can implement multiple interfaces. 2) Structures cannot inherit a class but can implement an interface. 3) In C#.NET, the colon (:) is used to signify that a class member implements a specific interface. 4) An interface can implement multiple classes. 5) The static modifier can be used on a method that implements an interface member.

Difficulty: Medium

Correct Answer: None of the above.

Explanation:


Introduction / Context:
This question tests nuanced understanding of interface usage across classes and structs, the correct meaning of the colon syntax, and restrictions on static members with interface implementations.



Given Data / Assumptions:

  • We assess five statements; some are partly true, partly misworded.
  • Classic C# rules apply for this syllabus.


Concept / Approach:
1) True on its face: classes can implement multiple interfaces. 2) True: structs cannot inherit classes, but they can implement interfaces. 3) False as written: the colon (:) is used after the type name to list base types and interfaces that the type implements or inherits; it does not apply to a “class member.” 4) False: interfaces do not implement classes; classes implement interfaces; interfaces can inherit other interfaces. 5) False in classic C#: methods implementing interface members are instance members; marking them static does not implement the interface member for instances.



Step-by-Step Solution:

Identify that options provided in the answers do not match the correct subset (1 and 2 only).Check available choices: (A) includes 3 (wrong); (B) includes 4 (wrong); (C) includes 3 and 5 (both wrong); (D) None of the above → best reflects that none of the offered groupings are correct; (E) is not in the original options list for this question block.


Verification / Alternative check:
Declare class C : IComparable, IDisposable { ... } and struct S : IComparable { ... }. Observe that implementations are instance methods, not static.



Why Other Options Are Wrong:

  • A/B/C include demonstrably false statements.


Common Pitfalls:
Misreading (:) as applying to members, and assuming static methods can satisfy instance interface contracts.



Final Answer:
None of the above.

More Questions from Interfaces

Discussion & Comments

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