Bird
0
0

Which of the following is a key reason to choose an interface over an abstract class in C#?

easy🧠 Conceptual Q1 of 15
C Sharp (C#) - Interfaces
Which of the following is a key reason to choose an interface over an abstract class in C#?
AYou want to define a contract without any implementation details.
BYou want to provide default method implementations.
CYou want to restrict inheritance to a single class.
DYou want to store state in fields.
Step-by-Step Solution
Solution:
  1. Step 1: Understand interface purpose

    An interface defines a contract with no implementation, focusing on what methods a class must have.
  2. Step 2: Compare with abstract class features

    Abstract classes can provide default implementations and hold state, unlike interfaces.
  3. Final Answer:

    You want to define a contract without any implementation details. -> Option A
  4. Quick Check:

    Interface = Contract only [OK]
Quick Trick: Interface = contract only, no code or state [OK]
Common Mistakes:
MISTAKES
  • Thinking interfaces can hold fields
  • Confusing default implementations with interfaces
  • Believing abstract classes cannot have state

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes