.NET Framework Interview Questions and Answers (547) - Page 2

What is CLS?

CLS (Common Language Specification) is a set of constructs or constraints that serves as a guide for library writers and compiler writers.It allows libraries to be fully usable from any language supporting the CLS, and for those languages to integrate with each other. The CLS is a subset of common type system. The common language specifications is also important to application developers wh are writing code that will be used by other developers.
What is MSIL?

MSIL (Microsoft Intermediate Language) is a CPU-Independent instructions set into which .NET Framework programs are compiled. It contains instructions for loading, storing, initializing and calling methods on objects.
What is Satellite Assembly?

It is a often used to deploy language specific resources for an application. These assemblies work in side-by-side execution because the application has a separate product ID for each language & installed satellite assemblies in a language specific sub-directory.
When uninstalling, the application removes only the satellite assemblies associated within a give language & .NET Framework version.
What is RSS?

RSS (Really Simple Syndication/Rich Site Summary) is a light weight XML format for distributing news headlines or site summary & other contents of the website.
What is application domain?

The primary purpose of application domain is to isolate an application from other application. Win32 process provides isolation but in distinct memory address spaces. This is effective but it is expensive and doesn't scale well. The .NET runtime enforces app domain isolation by keeping control over the use of memory.

All memory in the app domain is managed by the .net runtime so the runtime can ensure that app domain do not access each other's memory. Objects in different application domains communicate either by transporting copies of objects across application domain boundries or by using a proxy to exchange messages.
What is Remoting in .NET?

.NET Remoting offers much more complex functionality including support for passing objects by values or by references, callbacks & multiple objects activation ^ life cycle management policy.

In order to use Remoting a client need to build using .NET.
What is Property?

A property is a method or pair of methods that are exposed to the outside world as if they are fields.
Can you assign GridView.DataSource = DataReader()?

NOTE: This is objective type question, Please click question title for correct answer.
Can a DataAdapter.Fill method take DataTable as parameter or it works only for DataSet?

It has 5 different overloads and of course it can take DataSet as well as DataTable as parameter to fill data in from database.
What is typed dataset ?

A typed dataset is very much similar to a normal dataset. But the only difference is that the sehema is already present for the same. Hence any mismatch in the column will generate compile time errors rather than runtime error as in the case of normal dataset. Also accessing the column value is much easier than the normal dataset as the column definition will be available in the schema.
Can you place two .dll files with the same name in GAC (Global Assembly Cache)?

Yes, provided both have different versions.

GAC is a Folder that contains .dll that have strong name. So we can keep myproject.dll and myproject.dll two files into GAC with different version like 1.0.0.0 and 1.0.0.1
What's the difference between private and shared assembly?

Private Assembly is used inside an application only and does not have to be identified by a strong name.

Shared Assembly can be used by multiple applications and has to have a strong name.
What is JIT (Just-in-time) Compiler ?

Just-in-time compiler is a compiler used to convert the Commmon Intermediate Language (CIL) code into native code (also called machine code) that is processed by machine.

A little description

While compiling of .NET program, its code is converted into Common Intermediate Language code that is done by Common Language Runtime.


But while executing the program this CIL code is converted into Machine code or Native code that is done by JIT Compiler.
What is Managed and Unmanaged code?

Managed Code is what Visual Basic .NET and C# compilers create. It compiles to Intermediate Language (IL), not to machine code that could run directly on your computer. The IL is kept in a file called an assembly, along with metadata that describes the classes, methods, and attributes (such as security requirements) of the code you've created. This assembly is the one-stop-shopping unit of deployment in the .NET world. You copy it to another server to deploy the assembly there—and often that copying is the only step required in the deployment.

Unmanaged code is what you use to make before Visual Studio .NET 2002 was released. Visual Basic 6, Visual C++ 6, heck, even that 15-year old C compiler you may still have kicking around on your hard drive all produced unmanaged code. It compiled directly to machine code that ran on the machine where you compiled it—and on other machines as long as they had the same chip, or nearly the same. It didn't get services such as security or memory management from an invisible runtime; it got them from the operating system. And importantly, it got them from the operating system explicitly, by asking for them, usually by calling an API provided in the Windows SDK. More recent unmanaged applications got operating system services through COM calls.

For more, see http://www.codeguru.com/columns/Kate/article.php/c4871/
What is the difference between Namespace and Assembly?

Namespace:
1. It is a Collection of names wherein each name is Unique.
2. They form the logical boundary for a Group of classes.
3. Namespace must be specified in Project-Properties.

Assembly:
1. It is an Output Unit. It is a unit of Deployment & a unit of versioning. Assemblies contain MSIL code.
2. Assemblies are Self-Describing. [e.g. metadata,manifest]
3. An assembly is the primary building block of a .NET Framework application. It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files). All managed types and resources are marked either as accessible only within their implementation unit, or by code outside that unit.
What is Manifest?

The manifest describes the assembly, providing the logical attributes shared by all the modules and all components in the assembly. The manifest contains the assembly name, version number, locale and an optional strong name that uniquely identifying the assembly.
What is Metadata?

Metadata is the complete way of describing what is in a .NET assembly. Digging into the metadata yields the types available in that assembly, viz. classes, interfaces, enums, structs, etc., and their containing namespaces, the name of each type, its visibility/scope, its base class, the interfaces it implemented, its methods and their scope, and each method’s parameters, type’s properties, and so on.
What is CODE Access security?

Code Access Security (CAS), in the Microsoft .NET framework, is Microsoft's solution to prevent untrusted code from performing privileged actions.

It performs following function

1. Defines permissions and permission sets that represent the right to access various system resources.
2. Enables administrators to configure security policy by associating sets of permissions with groups of code (code groups).
3. Enables code to request the permissions it requires in order to run, as well as the permissions that would be useful to have, and specifies which permissions the code must never have.
4. Grants permissions to each assembly that is loaded, based on the permissions requested by the code and on the operations permitted by security policy.
5. Enables code to demand that its callers have specific permissions.
6. Enables code to demand that its callers possess a digital signature, thus allowing only callers from a particular organization or site to call the protected code.
7. Enforces restrictions on code at run time by comparing the granted permissions of every caller on the call stack to the permissions that callers must have.
What’s difference between System.SystemException and System.ApplicationException?

The difference between ApplicationException and SystemException is that SystemExceptions are thrown by the CLR, and ApplicationExceptions are thrown by Applications.
Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories