C# - Interfaces Questions and Answers
Practice ModeShowing 10 of 38 questions
Q31
Which of the following cannot be declared in an interface
Answer: Option D
Explanation: Interfaces cannot contain instance variables.
Q32
Can interfaces be used for dependency injection
Answer: Option B
Explanation: Interfaces are commonly used in dependency injection to reduce tight coupling.
Q33
What symbol separates multiple interfaces in implementation
Answer: Option A
Explanation: Multiple interfaces are separated using commas.
Q34
Can an interface extend multiple interfaces
Answer: Option B
Explanation: An interface can inherit multiple interfaces.
Q35
Which access modifier is not allowed in interface members
Answer: Option B
Explanation: Interface members cannot be private.
Q36
What is the main difference between interface and abstract class
Answer: Option C
Explanation: Interfaces support multiple inheritance, whereas abstract classes do not.
Q37
Can an interface contain static methods
Answer: Option B
Explanation: Static methods in interfaces are allowed starting from C# 8.0.
Q38
When should an interface be preferred over an abstract class
Answer: Option B
Explanation: Interfaces are preferred when multiple inheritance is required.