C# - Interfaces Questions and Answers
Practice ModeShowing 10 of 38 questions
Q21
Which of the following can implement an interface
Answer: Option C
Explanation: Both classes and structs can implement interfaces.
Q22
What happens if a class does not implement all interface members
Answer: Option C
Explanation: All interface members must be implemented, otherwise a compile-time error occurs.
Q23
Which feature is mainly achieved using interfaces
Answer: Option B
Explanation: Interfaces support polymorphism by allowing different implementations of the same contract.
Q24
Can an interface contain properties in C#
Answer: Option C
Explanation: Interfaces can declare properties but cannot implement them.
Q25
Which version of C# introduced default interface methods
Answer: Option D
Explanation: Default method implementations in interfaces were introduced in C# 8.0.
Q26
What keyword is used to explicitly implement an interface member
Answer: Option D
Explanation: Explicit interface implementation uses the interface name, not a keyword.
Q27
Why is explicit interface implementation used
Answer: Option B
Explanation: It is used to hide interface members from direct access through the class object.
Q28
Can an interface contain fields in C#
Answer: Option B
Explanation: Interfaces cannot contain fields.
Q29
Which statement about interfaces is correct
Answer: Option C
Explanation: Interfaces define a contract that implementing classes must follow.
Q30
How many interfaces can a class implement
Answer: Option C
Explanation: A class can implement multiple interfaces.