Pages

100 [Latest] .Net Interview Questions with Answers pdf


.Net Job Interview Questions and Answers


·         What Is The Microsoft.net?
.NET is a set of technologies designed to transform the internet into a full scale distributed platform. It provides new ways of connecting systems, information and devices through a collection of web services.It also provides a language independent, consistent programming model across all tiers of an application.
The goal of the .NET platform is to simplify web development by providing all of the tools and technologies that one needs to build distributed web applications
·         What Is The .net Framework?
The .NET Framework is set of technologies that form an integral part of the .NET Platform. It is Microsoft's managed code programming model for building applications that have visually stunning user experiences, seamless and secure communication, and the ability to model a range of business processes.
The .NET Framework has two main components: the common language runtime (CLR) and .NET Framework class library. The CLR is the foundation of the .NET framework and provides a common set of services for projects that act as building blocks to build up applications across all tiers. It simplifies development and provides a robust and simplified environment which provides common services to build application. The .NET framework class library is a collection of reusable types and exposes features of the runtime. It contains of a set of classes that is used to access common functionality
·         What Is Clr?
The .NET Framework provides a runtime environment called the Common Language Runtime or CLR. The CLR can be compared to the Java Virtual Machine or JVM in Java. CLR handles the execution of code and provides useful services for the implementation of the program. In addition to executing code, CLR provides services such as memory management, thread management, security management, code verification, compilation, and other system services. It enforces rules that in turn provide a robust and secure execution environment for .NET applications
·         What Is Cts?
Common Type System (CTS) describes the datatypes that can be used by managed code. CTS defines how these types are declared, used and managed in the runtime. It facilitates cross-language integration, type safety, and high performance code execution. The rules defined in CTS can be used to define your own classes and values.
.Net Top Interview Questions

·         What Is Cls?
Common Language Specification (CLS) defines the rules and standards to which languages must adhere to in order to be compatible with other .NET languages. This enables C# developers to inherit from classes defined in VB.NET or other .NET compatible languages
·         What Is Managed Code?
The .NET Framework provides a run-time environment called the Common Language Runtime, which manages the execution of code and provides services that make the development process easier. Compilers and tools expose the runtime's functionality and enable you to write code that benefits from this managed execution environment. The code that runs within the common language runtime is called managed code
·         What Is Msil?
When the code is compiled, the compiler translates your code into Microsoft intermediate language (MSIL). The common language runtime includes a JIT compiler for converting this MSIL then to native code.
MSIL contains metadata that is the key to cross language interoperability. Since this metadata is standardized across all .NET languages, a program written in one language can understand the metadata and execute code, written in a different language.MSIL includes instructions for loading, storing,initializing, and calling methods on objects,as well as instructions for arithmetic and logical operations,control flow,direct memory access, exception handling, and other operations
·         What Is Jit?
JIT is a compiler that converts MSIL to native code. The native code consists of hardware specific instructions that can be executed by the CPU.

Rather than converting the entire MSIL (in a portable executable[PE]file) to native code, the JIT converts the MSIL as it is needed during execution. This converted native code is stored so that it is accessible for subsequent calls.
·         What Is Reflection?
All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection. The System.Reflection namespace contains classes that can be used to interrogate the types for a module/assembly.
Using reflection to access .NET metadata is very similar to using ITypeLib/ITypeInfo to access type library data in COM, and it is used for similar purposes - e.g. determining data type sizes for marshaling data across context/process/machine boundaries. Reflection can also be used to dynamically invoke methods (see System.Type.Invoke Member), or even create types dynamically at run-time. (see System. Reflection. Emit.Type Builder).
·         What Does 'managed' Mean In The .net Context?
The term 'managed' is the cause of much confusion. It is used in various places within .NET, meaning slightly different things.Managed code: The .NET framework provides several core run-time services to the programs that run within it - for example exception handling and security. 
For these services to work, the code must provide a minimum level of information to the runtime.
Such code is called managed code. All C# and Visual Basic.NET code is managed by default. VS7 C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/com+).
Managed data: This is data that is allocated and de-allocated by the .NET runtime's garbage collector. C# and VB.NET data is always managed. VS7 C++ data is unmanaged by default, even when using the /com+ switch, but it can be marked as managed using the __gc keyword.Managed classes: This is usually referred to in the context of Managed Extensions (ME) for C++. When using ME C++, a class can be marked with the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector, but it also means more than that. The class becomes a fully paid-up member of the .NET community with the benefits and restrictions that brings. An example of a benefit is proper interop with classes written in other languages - for example, a managed C++ class can inherit from a VB class. An example of a restriction is that a managed class can only inherit from one base class.
·         What Platforms Does The .net Framework Run On?
The runtime supports Windows XP, Windows 2000, NT4 SP6a and Windows ME/98. Windows 95 is not supported. Some parts of the framework do not work on all platforms - for example, ASP.NET is only supported on Windows XP and Windows 2000. Windows 98/ME cannot be used for development.
IIS is not supported on Windows XP Home Edition, and so cannot be used to host ASP.NET. However, the ASP.NET Web Matrix web server does run on XP Home.
The Mono project is attempting to implement the .NET framework on Linux.
·         When Was The First Version Of .net Released?
The final version of the 1.0 SDK and runtime was made publicly available around 6pm PST on 15-Jan-2002. At the same time, the final version of Visual Studio.NET was made available to MSDN subscribers.
·         When Was .net Announced?
Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET technology, and delegates were given CDs containing a pre-release version of the .NET framework/SDK and Visual Studio.NET.
·         What Is .net Remoting?
Netremoting replaces DCOM. Web Services that uses remoting can run in anyApplication type i.e. Console Application, Windows Form Applications,Window Services etc. In CLR Object Remoting we can call objectsacross network.
·         How Do You Generate A Strong Name?
.NET provides an utility called strong name tool. You can run this toolfrom the VS.NET command prompt to generate a strong name with an option "-k" and providing the strong key file name. i.e. sn- -k < file-name >
·         What Is The Gac? What Problem Does It Solve?
Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies that are to be shared by several applications on the computer. This area is typically the folder under windows or winnt in the machine.
All the assemblies that need to be shared across applications need to be done through the Global assembly Cache only. However it is not necessary to install assemblies into the global assembly cache to make them accessible to COM interop or unmanaged code.
There are several ways to deploy an assembly into the global assembly cache:
o     Use an installer designed to work with the global assembly cache. This is the preferred option for installing assemblies into the global assembly cache.
o     Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the .NET Framework SDK.
o     Use Windows Explorer to drag assemblies into the cache.
o    GAC solves the problem of DLL Hell and DLL versioning. Unlike earlier situations, GAC can hold two assemblies of the same name but different version. This ensures that the applications which access a particular assembly continue to access the same assembly even if another version of that assembly is installed on that machine.
·         What Is Strong-typing Versus Weak-typing? Which Is Preferred? Why?
Strong typing implies that the types of variables involved in operations are associated to the variable, checked at compile-time, and require explicit conversion; weak typing implies that they are associated to the value, checked at run-time, and are implicitly converted as required. (Which is preferred is a disputable point, but I personally prefer strong typing because I like my errors to be found as soon as possible.)
·         What Is The Difference Between An Exe And A Dll?
o    You can create an objects of Dll but not of the EXE.
o    Dll is an In-Process Component whereas EXE is an OUt-Process Component.
o    Exe is for single use whereas you can use Dll for multiple use.
o    Exe can be started as standalone where dll cannot be.
·         Describe The Advantages Of Writing A Managed Code Application Instead Of Unmanaged One. What's Involved In Certain Piece Of Code Being Managed?
"Advantage includes automatic garbage collection,memory management,security,type checking,versioning Managed code is compiled for the .NET run-time environment. It runs in the Common Language Runtime (CLR), which is the heart of the .NET Framework. The CLR provides services such as security,memory management, and cross-language integration. Managed applications written to take advantage of the features of the CLR perform more efficiently and safely, and take better advantage of developers existing expertise in languages that support the .NET Framework.
Unmanaged code includes all code written before the .NET Framework was introduced-this includes code written to use COM, native Win32, and Visual Basic 6. Because it does not run inside the .NET environment, unmanaged code cannot make use of any .NET managed facilities."
·         What Is Public Or Shared Assemblies ?
These are static assemblies that must have a unique shared name and can be used by any application.
An application uses a private assembly by referring to the assembly using a static path or through an XML-based application configuration file. While the CLR doesn't enforce versioning policies-checking whether the correct version is used-for private assemblies, it ensures that an application uses the correct shared assemblies with which the application was built. Thus, an application uses a specific shared assembly by referring to the specific shared assembly, and the CLR ensures that the correct version is loaded at runtime.
·         What Is Metadata?
Metadata is machine-readable information about a resource, or ""data about data."" Such information might include details on content, format, size, or other characteristics of a data source. In .NET, metadata includes type definitions, version information, external assembly references, and other standardized information.
·         What Are The Mobile Devices Supported By .net Platform
The Microsoft .NET Compact Framework is designed to run on mobile devices such as mobile phones, Personal Digital Assistants (PDAs), and embedded devices. The easiest way to develop and test a Smart Device Application is to use an emulator.
These devices are divided into two main divisions:
1) Those that are directly supported by .NET (Pocket PCs, i-Mode phones, and WAP devices)
2) Those that are not (Palm OS and J2ME-powered devices).
·         Can You Declare The Override Method Static While The Original Method Is Non-static?
No, you can't, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.
·         What Is Boxing And Unboxing ?
Boxing:
The conversion of a value type instance to an object, which implies that the instance will carry full type information at run time and will be allocated in the heap. The Microsoft intermediate language (MSIL) instruction set's box instruction converts a value type to an object by making a copy of the value type and embedding it in a newly allocated object.
Un-Boxing:
The conversion of an object instance to a value type.
·         What Is The Difference Between An Application Domain And A Process?
An application domain is lighter than a process. Application domains are appropriate for scenarios that require isolation without the heavy cost associated with running an application within a process. A process runs exactly one application. In contrast, the CLR allows multiple applications to be run in a single process by loading them into separate application domains. Additionally, the CLR verifies that user code in an application domain is type safe.
·         What Is A Clr Host?
The Windows operating system does not provide support for running a CLR application. That support is provided by a CLR host. A CLR host is an application that is responsible for loading the CLR into a process, creating application domains within the process, and executing user code within the application domains. Examples of hosts that ship with the .NET Framework include:
ASP.NET. An ISAPI filter that ships with ASP.NET loads the CLR and does the initialization necessary to handle web requests.
Internet Explorer. A MIME filter hooks into Internet Explorer versions 5.01 and higher to execute managed controls referenced from HTML pages.
Shell Executables. When a managed application is launched from a shell, a small piece of unmanaged code loads the CLR and transitions control of the application to the CLR.
·         Can We Maintain State In Webservice?
Yes. Webservice don't have any mechanism.So, It can maintain state. By default, webservice class is derived for state maintenance.
·         Difference Between Authentication And Authorization?
Authentication is a process of identifying a user based on their credentials(means user id and password).
Authorization is process of determining whether an authenticated user is allowed to access a specific resource or not.
·         What Is The Purpose Of Enumerable Class In .net?
It contains various extension methods like Where(), OrderBy() etc. for the IList classes.
Inorder to get access for those methods, simply we have to include the System.Linq namespace.
·         In The Page Load Event I Assigned Dropdownlist's Datasource Property To A Valid List. On The Submit Button Click.. The Same Datasource Property Is Coming As Null. Why?
As ViewState is not storing the DataSource property.
We have to use Items property of DropDownList to get the items back.
·         What Is Data Adapter?
Data adapter are objects that connect one or more command objects to a dataset object. They provide logic that gets the data from the data store and populates the tables in the dataset, or pushes the changes in the dataset back into the data store.
·         What Is Replication?
Replication is way of keeping data synchronized in multiple databases. SQL server replication has two important aspects publisher and subscriber.
Publisher: Database server that makes data available for replication is called as publisher.
Subscriber: Database servers that get data from the publishers is called as subscribers.
·         What Are The Different Types Of Remote Object Creation Mode In .net?
There are two types of remote object creation mode. They are,
1.SAO(server activated objects)
2.CAO(client activated objects)
·         What Is Application Domain?
In application domains multiple application can run in the same process with out influencing each othere. If one of the application domains throws error it does not affect the other application domains.
·         What Is Thread.sleep()?
Thread's execution can be paused by calling the thread.sleep method. This method takes an integer value that determines how long the thread should sleep.
Eg: Thread.CurrentThread.Sleep(2000)
·         What Is Addressof Operator?
Addressof operator creates a delegate object to a method.
example:
Dim pthread1 as new thread(AddressOf thread1)
Here thread1 is a method. pthread1 is a delegate object.
·         What Is Multi-threading?
Multi-threading forms subset of multi-tasking instead of having to switch between programs this feature switches between different parts of the same program. For example, we can write in word and at the same time word is doing a spell check in background.
·         What Is Dcom?
DCOM is a distributed extension of COM. It differs from COM in that it allows for creating objects distributed across a network, a protocol for invoking that object's methods, and secure to the object. DCOM provides a wrapper around COM, hence it is a backward compatible extension.
·         How To Install Or Uninstall A Windows Service?
For Install:-
1)Go to visual Studio command prompt
(Start => All programs => Microsoft Visual Studio 2005 => Visual Studio Tools => Visual Studio 2005 Command Prompt)
2)installutil <Path of your Service>
(e.g installutil C:\MyService.exe)
For UN Install:-
3)Go to visual Studio command prompt
(Start => All programs => Microsoft Visual Studio 2005 => Visual Studio Tools => Visual Studio 2005 Command Prompt)
4)installutil -U <Path of your Service>
(e.g installutil -U C:\MyService.exe)
·         What Is Jit? What Are The Different Types Of Jit?
JIT stands for Just-in-time compiler.It is a part of the runtime execution environment. It compiles the intermediate language and execute them. There are three types of JIT. They are,
1. Pre-JIT : compiles complete source code into native code in a single compilation cycle. This is done by at the time of deployment of the application.
2. Econo-JIT : compiles only those methods that they are called at runtime. However, These compiled methods are removed when they are not required.
3. Normal-JIT : compiles only those methods that they are called at runtime. These methods are compiled the first time they are called and then they are stored in cache. When the same methods are called again, the compiled code from cache is used for execution.
·         What Is Delay Signing?
During development process we have to sign strong name with our application. But it is not good practice in the security point of view. For that, we can sign it later. It is called delay signing.
·         What Is Strong Name?
Strong name helps GAC(Global assembly cache) to differentiate between two versions.It is only needed when we deploy the assembly with GAC. It uses public key cryptocrophy to ensure that no one spoof it.
·         What Is Code Verification?
Code verification ensure that proper code execution and type safety while the code runs. It does not allow to perform illegal operation such as invalid memory location.
·         What Is Code Access Security?
Code access security grant rights to the program depends on security configuration of the machine. For example, Program can have access to create or edit a file but security configuration of the machine does not allow to delete a file.
·         What Is Il?
IL stands for Intermediate language. All .Net code is converted into IL. Then IL is converted into native code at run time by JIT(just in time) compiler and executed by them.
·         What Is Class Library In .net
class library is a collection of prewritten, ready-made software routines that act as templates for programmers to use in writing object-oriented application programs
·         How To Block A Class From Being Inherited Further?
Use sealed keyword.
Eg: public sealed class TheClass
{
}
·         How To Find The Current Application File Path While Runtime?
System.Reflection.Assembly.GetExecutingAssembly().Location
·         What Is The Base Class Of All Classes In C#?
It is object (Sytem.Object)
Latest .Net Interview Questions and Answers pdf

No comments:

Post a Comment