C# Interview Questions and Answers for Experienced - 2

Question: 6

What is the difference between using while and until loops?

While will loop as long as its test condition evaluates to true.

Until will loop as long as its test condition evaluates to false.

Question: 7

Differentiate between Overriding and Overloading?

Overriding – you override a virtual class.

Overloading – you overload a method with different number of parameters or different type of parameters.

Question: 8

What is shadowing?

Shadowing is used within 2 programmers come up with same method in the same class one of the methods get shadowed by scope or inheritance.

Override means that using your class throught a base class will use your method, while new means your method will only be called if accessing through your class, and when using your class throught a base class the base class method will be called. I think that shadowing is the using new, but I’m not certain.

Question: 9

What is an abstract class?

Abstract class is a class that has no direct instances, but whose descendants may have direct instances. There are case in which it is useful to define classes for which the programmer never intends to instantiate any objects; because such classes normally are used as base-classes in inheritance hierarchies, we call such classes abstract classes. These classes cannot be used to instantiate objects; because abstract classes are incomplete. Derived classes called concrete classes must define the missing pieces.

Question: 10

What are indexers?

Indexers are similar to properties, except that the get and set accessors of indexers take parameters, while property accessors do not.

Related Questions