Home
C-Sharp
Interview FAQs

Show

FAQs of level

An Enumeration is a user defined integer type which provides a way for attaching names to numbers, thereby increasing the comprehensibility of the code. The enum keyword automatically enumerates a list of words by assigning them values 0,1,2 and so on.

When you declare an enumeration, you specify a set of acceptable values that instance of that enumeration can contain. Not only that, but you can give the values user-friendly names. If, somewhere in your code, you attempt to assign a value that is not in the acceptable set of values to an instance of that enumeration, the compiler will flag an error. Eg.

enum shape{
Circle,
Square,
Triangle }

this can be written in one line as follows:
enum shape { Circle, Square,Triangle }
Value Type holds the data directly
Reference Type points to the location that holds the data.

Examples of value type variables: byte, decimal, float, int, structs
Examples of reference type variables: string, class, delegate, interface

Value Type cannot contain null value
Reference Type can contain null value.

Value Type variables are stored on stack.
Reference Type variables are stored on heap.

A new type cannot be derived from value type.
A new type can be derived from reference type.

Application doamin is a logical partition within which the process is isolated and hosts .Net assemblies inside it.

The single process can have multiple application domains, and in turn each application domain has multiple threads inside it, but the thread not confined to the application domain as it is free to cross the app. domain boundries to another domain provided that the thread execution can be done only in a specific domain at a time.

The application domain is managed and created by basically CLR.

The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array. The CopyTo() method copies the elements into another existing array. Both perform a shallow copy. A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array. A deep copy (which neither of these methods performs) would create a new instance of each elements object, resulting in a different, yet identacle object.
An abstract class may contain complete or incomplete methods. Interfaces can contain only the signature of a method but no body. Thus an abstract class can implement methods but an interface can not implement methods. An abstract class can contain fields, constructors, or destructors and implement properties. An interface can not contain fields, constructors, or destructors and it has only the properties signature but no implementation. An abstract class cannot support multiple inheritance, but an interface can support multiple inheritance. Thus a class may inherit several interfaces but only one abstract class. A class implementing an interface has to implement all the methods of the interface, but the same is not required in the case of an abstract Class. Various access modifiers such as abstract, protected, internal, public, virtual, etc. are useful in abstract Classes but not in interfaces
A class representing a base class which other types can subclass. A normal, non-abstract class is called a concrete class. An abstract class may contain either or both abstract and concrete methods. (Properties cannot be marked abstract.) As in ordinary inheritance, a type derived from an abstract class inherits all the base type members including any method implementations. But, if any abstract methods are inherited, the class must either declare itself abstract or provide an implementation.

A C# abstract class is declared with the abstract keyword.

Reference type containing only abstract members—delegates, events, indexers, public methods, properties. The interface contains only member declarations. A class implementing an interface must provide the implementation of the interface members. An interface cannot contain constants, constructors, data fields, destructors, or static members. Interface member declarations are implicitly public. Classes or structs may inherit any number of interfaces.

A C# interface is declared with the interface keyword

AppDomain is the logical and physical boundary created around every .Net application within the same application scope—the sequence of object activations starting from the application entry point—by the Common Language Runtime (CLR). The CLR can allow multiple .Net applications to be run in a single process by loading them into separate application domains. To make runtime behavior predictable, the CLR isolates each application domain from all other application domains and prevents the configuration, security, or stability of a running .NET applications from affecting other applications.
Event handling mechanism of .Net. To raise events, a class must define one delegate per event type. To handle events, types must implement one event handler per event type. Delegates can reference both instance and static methods. C# uses the delegate keyword.
Notification by an application or operating system that some event has occurred. An event is fired—raised—when a predefined condition occurs, e.g., focus change in a GUI, interval timer, mouse click. An event handler is called in response to an event. The C# event model is publish and subscribe: Publishers create and publish events: Subscribers register to receive specifc events: Then, publishers send out their events only to subscribers.
PreviousDisplaying 12 of 25Next
Need Help? Contact Us.

Log in

*
*

Forgot password?

*

New User

*
*
*
*