Users Online

· Guests Online: 45

· Members Online: 0

· Total Members: 188
· Newest Member: meenachowdary055

Forum Threads

Newest Threads
No Threads created
Hottest Threads
No Threads created

Latest Articles

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

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

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

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

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

Answer: b
Explanation: None.
 

 

 

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

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

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

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

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.

 

 

 

 

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

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

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

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.

 

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Ratings

Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Render time: 0.86 seconds
10,843,394 unique visits