A complete reference about Interview Question all Freshers and Experience students.Microsoft .NET is a software development platform based on virtual machine based architecture. Dot net is designed from the scratch to support programming language independent application development. The entire .NET programs are independent of any particular operating system and physical hardware machine.
Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts
What is Sealed class ?
A class can be made sealed in c# using the sealed keyword. Sealed means that the class cant be inhereted. You can extend this functionality to the individual methods as well. In case you want a class to be inhereted, excluding one of its methods, just make that particular method sealed.
Metadata and Manifest
Manifest describes the assembly itself. Assembly name, version, culture, strong name, list of files, type reference and reference assembly. While Metadata describes contents within the assembly like classes, namespaces, interfaces, scope, properties, methods and their parameters etc.
Garbage Collection
It is Automatic Memory Manager for .Net Framework. It manages the memory allocated to .Net Framework.
When a variable is defined it gets a space in memory (stack) and when an object is created memory for the object is allocated in heap. When an object is assigned to a variable it increments the reference counts for the object and when program control comes out of the function the scope of variable gets ended Or NULL is assigned to variable it decrements the reference count of object by 1. When reference count of one object becomes zero GC acts call destructor of object and then releases the memory acquired by the object.
When a variable is defined it gets a space in memory (stack) and when an object is created memory for the object is allocated in heap. When an object is assigned to a variable it increments the reference counts for the object and when program control comes out of the function the scope of variable gets ended Or NULL is assigned to variable it decrements the reference count of object by 1. When reference count of one object becomes zero GC acts call destructor of object and then releases the memory acquired by the object.
Boxing and Un-Boxing:
Implicit(automatic) conversion of value type to reference type is known as Boxing And Explicit (manual) conversion of Reference type to value type is said to be Un-boxing. (conversion of Integer variable to object type)
Static Variable and Its Life-Time
VB.NET: Public Shared VAR As Type.
C#: public static Type VAR;
Life time is till the class is in memory.
C#: public static Type VAR;
Life time is till the class is in memory.
What is a Delegate?
A strongly typed function pointer. A delegate object encapsulates a reference to a method. When actual function needs to be called will be decided at run-time.
Identifiers/Access Specifies and scope
VB.NET: Private, Protected, Friend, Protected Friend, Public.
C#: private, protected, internal, protected internal, public.
C#: private, protected, internal, protected internal, public.
Early-Binding
Calling an non-virtual method decides the method to call at compile time is known as Early-Binding.
Polymorphism
Mean by more than one form. Ability to provide different implementation based on different no./type of parameters. A method behaves differently based on the different input parameters. Does not depend on the Return-Type.
Interface
What a Class must do, But not how-to.
Bridge for the communication when the caller does not know to whom he is calling.
Describes externally visible behavior of element.
Only Public members which defines the means of the communication with the outer world. Can-be-Used-As Relationship.
Can not contain data but can declare property. There can be no implementation. Interface can be derived from another interface.
Bridge for the communication when the caller does not know to whom he is calling.
Describes externally visible behavior of element.
Only Public members which defines the means of the communication with the outer world. Can-be-Used-As Relationship.
Can not contain data but can declare property. There can be no implementation. Interface can be derived from another interface.
Abstract Class
Instance can not be created. Optionally can have one or more abstract methods but not necessary. Can provide body to Classes.
Inheritance
Gives you ability to provide is-a relationship. Acquires attributes and behaviors from another. When a class acquires attributes and behaviors from another class. (must not be Final or sealed class in .Net)
Overloading
Adding a new method with the same name in same/derived class but with different number/types of parameters. Implements Polymorphism.
Overriding
When we need to provide different implementation than the provide by base class, We define the same method with same signatures in the derived class. Method must be Protected/Protected-Friend/Public for this purpose. (Base class routine can be called by Mybase.Method, base.Method).
Encapsulation
Binding of attributes and behaviors. Hiding the implementation and exposing the functionality.
Abstraction
Hiding the complexity. Defining communication interface for the functionality and hiding rest of the things.
In .Net destructor can not be abstract. Can define Either Finalize / Destructor. For Destructor access specifiers can not be assigned. It is Private.
In .Net destructor can not be abstract. Can define Either Finalize / Destructor. For Destructor access specifiers can not be assigned. It is Private.
Subscribe to:
Posts (Atom)