C# Interview Questions with Answers Pdf - 3

Question: 11

What is the difference between an interface and abstract class?

In an interface class, all methods are abstract- there is no implementation.

In an abstract class some methods can be concrete. In an interface class, no accessibility modifiers are allowed.

An abstract class may have accessibility modifiers.

Question: 12

What is the difference between a struct and a class?

Structs are value-type variables and are thus saved on the stack, additional overhead but faster retrieval.

Another difference is that structs cannot inherit.   

Question: 13

What does the keyword “virtual” declare for a method or property?

The method or property can be overridden.

Question: 14

What is the implicit name of the parameter that gets passed into the set method/property of a class?

Value, the data type of the value parameter is defined by whatever data type the property is declared as.

Question: 15

What are the different ways a method can be overloaded?

Different parameter data types, different number of parameters, different order of parameters.

Related Questions