Users Online
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
Forum Threads
Latest Articles
Articles Hierarchy
C# Questions & Answers ? Interfaces Introduction
C# Questions & Answers – Interfaces Introduction
This section of our 1000+ C# multiple choice questions focuses on interface introduction in C# Programming Language.
1. Which statement correctly defines Interfaces in C#.NET?
a) Interfaces cannot be inherited
b) Interfaces consists of data static in nature and static methods
c) Interfaces consists of only method declaration
d) None of the mentioned
Explanation: Leaving all options only option ‘a’ is correct as interfaces can be inherited i.e inheritance can be performed in csharp .net.
2. Which of the following cannot be used to declare an interface correctly?
a) Properties
b) Methods
c) Structures
d) Events
Explanation: None.
3. A class consists of two interfaces with each interface consisting of three methods. The class had no instance data. Which of the following indicates the correct size of object created from this class?
a) 12 bytes
b) 16 bytes
c) 0 bytes
d) 24 bytes
Explanation: None.
4. Which of the following statements correctly define about the implementation of interface?
a) The calls to implementation of interface methods are routed through a method table
b) A class which implements an interface can explicitly implement members of that interface
c) One interface can be implemented in another interface
d) None of the mentioned
Explanation: None.
5. Select the correct statement among the given statements?
a) One class could implement only one interface
b) Properties could be declared inside an interface
c) Interfaces cannot be inherited
d) None of the mentioned
Explanation: None.
6. Which keyword is used for correct implementation of an interface in C#.NET?
a) interface
b) Interface
c) intf
d) Intf
Explanation: None.
7. Choose the statements which makes interface different from classes?
a) Unlike classes, interfaces consists of only declaration but not implementation
b) Interfaces cannot be used directly like classes to create new objects
c) Interfaces consists of declaration of methods, properties events and type definitions
d) All of the mentioned
Explanation: None.
8. Which of the following is the correct way of implementing an interface addition by class maths?
a) class maths : addition {}
b) class maths implements addition {}
c) class maths imports addition {}
d) none of the mentioned
Explanation: None.
9. Does C#.NET support partial implementation of interfaces?
a) True
b) False
c) Can’t Say
d) None of the mentioned
Explanation: Interface is a behaviour. It represents a protocol or a contract of sorts. Hence, it is impossible to implement an interface partially.
10. Select the correct implementation of the interface which is mentioned below.
-
interface a1
-
{
-
int fun(int i);
-
}
a)
-
class a
-
{
-
int fun(int i) as a1.fun
-
{
-
}
-
}
b)
-
class a: implements a1
-
{
-
int fun(int i)
-
{
-
}
-
}
c)
-
class a: a1
-
{
-
int a1.fun(int i)
-
{
-
}
-
}
d) None of the mentioned
Explanation: None.
11. Which of these can be used to fully abstract a class from its implementation?
a) Objects
b) Packages
c) Interfaces
d) None of the Mentioned
Explanation: None.
12. Access specifiers which can be used for an interface are?
a) Public
b) Protected
c) Private
d) All of the mentioned
Explanation: Access specifier of an interface is either public or none. When no access specifier is specified then only default access specifier is used due to which interface is available only to other members of the package in which it is declared, when declared public it can be used by any code declared anywhere in the class area.