KyaPoocha.com

Huge Collection of Interview Questions


‘C# Interview Questions’ - KyaPoocha.com

Why can’t you specify the accessibility modifier for methods inside the interface ? 

They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility,... Read more »

What’s an interface class ? 

It’s an abstract class with public abstract methods all of which must be implemented in the inherited classes.  Read more »

When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram) ? 

When at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been... Read more »

What’s an abstract class ? 

A class that cannot be instantiated. A concept in C++ known as pure virtual method. A class that must be inherited and have the methods over-ridden. Essentially,... Read more »

What does the keyword virtual mean in the method definition ? 

The method can be over-ridden.  Read more »

How’s method overriding different from overloading ? 

When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.  Read more »

What’s the top .NET class that everything is derived from ? 

System.Object  Read more »

C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write 

Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there’s no implementation in... Read more »

When you inherit a protected class-level variable, who is it available to 

Classes in the same namespace.  Read more »

Does C# support multiple inheritance ? 

No, use interfaces instead.  Read more »

How do you inherit from a class in C# ? 

 Read more »

What’s the implicit name of the parameter that gets passed into the class’ set method ? 

Value, and its datatype depends on whatever variable we’re changing.  Read more »

Where we can use DLL made in C#.Net ? 

Supporting .Net, bcoz DLL made in C#.Net semicompiled version. Its not a com object. It is used only in .Net Framework.As it is to be compiled at runtime to byte... Read more »

If A.equals(B) is true then A.getHashcode & B.getHashCode must always return same hash code. 

The answer is False because it is given that A.equals(B) returns true i.e. objects are equal and now its hashCode is asked which is always independent of the fact... Read more »

What is an indexer in C#? 

Indexer is a special syntax for overloading [] operator for a class. After defining an indexer, array syntaxes can be used for the class objects.  Read more »

Page 4 of 11« First...«23456»...Last »