C# - Interfaces Questions and Answers
Practice ModeShowing 10 of 38 questions
Q1
Which of the following statements is correct about the C#.NET code snippet given below?
interface IMyInterface
{
void fun1();
int fun2();
}
class MyClass: IMyInterface
{
void fun1()
{ }
int IMyInterface.fun2()
{ }
}
Answer: Option
Q2
Which of the following can be declared in an interface?
Properties
Methods
Enumerations
Events
Structures
Answer: Option B
Q3
A class implements two interfaces each containing three methods. The class contains no instance data. Which of the following correctly indicate the size of the object created from this class?
Answer: Option B
Q4
Which of the following statements is correct about an interface used in C#.NET?
Answer: Option D
Q5
Which of the following statements is correct about Interfaces used in C#.NET?
Answer: Option B
Q6
Which of the following statements is correct about an interface used in C#.NET?
Answer: Option A
Q7
Which of the following statements is correct about an interface?
Answer: Option C
Q8
Which of the following statements are correct about an interface in C#.NET?
A class can implement multiple interfaces.
Structures cannot inherit a class but can implement an interface.
In C#.NET, : is used to signify that a class member implements a specific interface.
An interface can implement multiple classes.
The static attribute can be used with a method that implements an interface declaration.
Answer: Option A
Q9
Which of the following statements is correct?
Answer: Option C
Q10
Which of the following statements are correct about an interface used in C#.NET?
An interface can contain properties, methods and events.
The keyword must implement forces implementation of an interface.
Interfaces can be overloaded.
Interfaces can be implemented by a class or a struct.
Enhanced implementations of an interface can be developed without breaking existing code.
Answer: Option B