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
View Answer

Answer: d
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
View Answer

Answer: c
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
View Answer

Answer: d
Explanation: None.
advertisement
advertisement

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
View Answer

Answer: a
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
View Answer

Answer: b
Explanation: None.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. Which keyword is used for correct implementation of an interface in C#.NET?
a) interface
b) Interface
c) intf
d) Intf
View Answer

Answer: a
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
View Answer

Answer: d
Explanation: None.
advertisement

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
View Answer

Answer: a
Explanation: None.

9. Does C#.NET support partial implementation of interfaces?
a) True
b) False
c) Can’t Say
d) None of the mentioned
View Answer

Answer: b
Explanation: Interface is a behaviour. It represents a protocol or a contract of sorts. Hence, it is impossible to implement an interface partially.
advertisement

10. Select the correct implementation of the interface which is mentioned below.

  1. interface a1
  2. {
  3.     int fun(int i);
  4. }

a)

  1.  class a
  2.  {
  3.      int fun(int i) as a1.fun
  4.      {
  5.      }
  6.  }

b)

  1. class a: implements a1
  2. {
  3.     int fun(int i)
  4.     {
  5.     }
  6. }

c)

  1.  class a: a1
  2.  {
  3.      int a1.fun(int i)
  4.      {
  5.      }
  6.  }

d) None of the mentioned
View Answer

Answer: c
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
View Answer

Answer: c
Explanation: None.

12. Access specifiers which can be used for an interface are?
a) Public
b) Protected
c) Private
d) All of the mentioned
View Answer

Answer: a
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.

Sanfoundry Global Education & Learning Series – C# Programming Language.
Here’s the list of Best Books in C# Programming Language.

To practice all features of C# programming language, here is complete set on 1000+ Multiple Choice Questions and Answers on C#

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.