.Net Interview Questions

If you're looking for .Net Interview Questions, you are at right place. There are lot of opportunities from many reputed companies in the world. According to research .Net has a market share of about 20.90%. So, You still have opportunity to move ahead in your career in .Net Certification. Mindmajix offers advanced .Net Interview Questions that helps you in cracking your interview & acquire dream career.

Are you intereted in taking up for .Net Training Online? Enroll for Free Demo on.Net Training

Q. What is the relation between Classes and Objects?
Class applies to a type or model of a GROUP of itedot-ms, objects, or concepts.
Object applies to a specific material item or concept, a group of which may comprise a class.

Q. What is an IL?
(IL) Intermediate Language is also known as MSIL is MicroSoft Intermediate Language or Common Language Runtime (CLR) . When we compile .Net applications, its complied to MSIL, which is not machine read language. Hence Common Language Runtime (CLR) with JustIn Time Complier (JIT) , converts this MSIL to native code (binary code) , which is machine language.

Q. What are the defining traits of an object-oriented language?
The defining traits of an object-oriented language are:
a) Inheritance
b) Abstraction
c) Encapsulation
d) Polymorphism
Inheritance: The main class or the root class is called as a Base Class. Any class which is expected to have ALL properties of the base class along with its own is called as a Derived class. The process of deriving such a class is Derived class.
Abstraction: Abstraction is creating models or classes of some broad concept. Abstraction can be achieved through Inheritance or even Composition.
Encapsulation: Encapsulation is a collection of functions of a class and object. The “Food” class is an encapsulated form. It is achieved by specifying which class can use which members (private, public, protected) of an object.
Polymorphism: Polymorphism means existing in different forms. Inheritance is an example of Polymorphism. A base class exists in different forms as derived classes. Operator overloading is an example of Polymorphism in which an operator can be applied in different situations.

Q. What is the concept of DISPOSE method?
DISPOSE method belongs to IDisposable interface. It is used to free unmanaged resources like files, network connection etc. It manages and handles this by an instance of the class that implements this interface. Dispose methods must be called explicitly and hence the any object using IDisposable must also implement finalizer to free resources in situations wherein Dispose is not called. Multiple calls to dispose method must be ignored when called once. The objects disposable methods must be called in the order of containment.

Q. What is a CLR?
The Common Language Runtime (CLR) is a core component of .NET framework. It is Microsoft’s implementation of the Common Language Infrastructure (CLI) standard, which defines an execution environment for program code. In the CLR, code is expressed in a form of bytecode called the Common Intermediate Language (CIL) . Developers using the CLR write code in a language such as C# or VB.NET. At compile time, the .NET compiler converts such code into CIL code. At runtime, the CLR’s just-in-time compiler converts the CIL code into code native to the operating system. Alternatively, the CIL code can be compiled to native code in a separate step prior to runtime by using the Native Image Generator (NGEN) . This speeds up all later runs of the software as the CIL-to-native compilation is no longer necessary.
During the execution of the program, the Common Language Runtime (CLR) manages memory, Thread execution, Garbage Collection (GC) , Exception Handling, Common Type System (CTS) , code safety verifications, and other system services. The Common Language Runtime (CLR) environment is also referred to as a managed environment, because during the execution of a program it also controls the interaction with the Operating System.

Q. What is CTS?
CTS stands for Common Type System. The CTS makes available a common set of data types so that compiled code of one language could easily interoperate with compiled code of another language by understanding each others’ data types. If two languages (c# or or j# or vc++) want to communicate with each other, they have to convert into some common type (i.e. in COMMON LANGUAGE RUNTIME) . In C# we use int which is converted to Int32 of CLR to communicate with which uses Integer or vice versa.

Q. What is a CLS (Common Language Specification)?
CLS is a specification that defines the rules to support language integration. This is done in such a way, that programs written in any language (.NET compliant) can communicate with one another. This also can take full advantage of inheritance, polymorphism, exceptions, and other features. This is a subset of the CTS, which all .NET languages are expected to support.

Q. Difference between Abstract Classes and Interfaces.
Following are the differences between Abstract Classes and Interfaces:
a) When a derived class is inherited from an Abstract class, no other class can be extended then. Interface can be used in any scenario.
b) Abstract class contains abstract method, i.e. actual implementation logic. On the other hand, interfaces have no implementation logic.
c) Every method in an interface must be abstract. This is not necessary in case of abstract classes.

Q. What is an Assembly?
In the .NET framework, an assembly is a partially compiled code library for use in deployment, versioning and security. There are two types: process assemblies (EXE) and library assemblies (DLL). A process assembly represents a process which will use classes defined in library assemblies. .NET assemblies contain code in CIL, which is usually generated from a CLI language, and then compiled into machine language at runtime by the CLR just-in-time compiler.
An assembly can consist of one or more files. Code files are called modules. An assembly can contain more than one code module and since it is possible to use different languages to create code modules it is technically possible to use several different languages to create an assembly. Visual Studio however does not support using different languages in one assembly.

Q. What are the various objects in Dataset?
The DataSet class exists in the System.Data namespace.
The Classes contained in the DataSet class are:
a) DataTable
b) DataColumn
c) DataRow
d) Constraint
e) DataRelation

Q. What is a NameSpace?
Namespace is a group of classes, structures, interfaces, enumerations, and delegates, organized in a logical hierarchy by function, that enable you to access the core functionality you need in your applications.
Namespaces are the way that .NET avoids name clashes between classes. A Namespace is no more than a grouping of data types, but it has the effect that the names of all data types within a namespace automatically get prefixed with the name of the namespace. It is also possible to nest namespaces within each other.

Q. What is the difference between NameSpace and Assembly?
A Namespace is a logical naming scheme for types in which a simple type name, such as MyType, is preceded with a dot-separated hierarchical name. Such a naming scheme is completely under control of the developer. The .NET Framework uses a hierarchical naming scheme for grouping types into logical categories of related functionality, such as the ASP.NET application framework, or remoting functionality. Design tools can make use of namespaces to make it easier for developers to browse and reference types in their code.
The concept of a namespace is not related to that of an Assembly. A single assembly may contain types whose hierarchical names have different namespace roots, and a logical namespace root may span multiple assemblies. In the .NET Framework, a Namespace is a logical design-time naming convenience, whereas an Assembly establishes the name scope for types at run time.


Get Updates on Tech posts, Interview & Certification questions and training schedules