Wednesday, February 27, 2013

.NET INTERVIEW QUESTIONS AND ANSWERS


.NET INTERVIEW QUESTIONS AND ANSWERS

1. Advantages of Crystal Reports

Some of the major advantages of using Crystal Reports are: 

1. Rapid report development since the designer interface would ease the coding work for the programmer.

2. Can extend it to complicated reports with interactive charts and enhance the understanding of the business model

3. Exposes a report object model, can interact with other controls on the ASP.NET Web form

4. Can programmatically export the reports into widely used formats like .pdf, .doc, .xls, .html and .rtf

2. What is the Difference between Web.config and Machine.config?

Scope:
Web.config => For particular application in IIS.
Machine.config = > For All the applications in IIS
Created:
Web.config => Created when you create an application
Machine.config => Create when you install Visual Studio
Known as:
Web.config => is known as Application Level configuration file
Machine.config => is known as Machine level configuration file
Location:
Web.config => In your application Directory
Machine.config => …\Microsoft.NET\Framework\(Version)\ CONFIG



3. What is the Global.asax used for?


The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.

4. What does the "EnableViewState" property do? Why would I want it on or off?


It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate.

5. What is GC in NET Framework?
  1. The .NET Framework's garbage collector manages the allocation and release of memory for your application. 
  2. Each time you use the new operator to create an object, the runtime allocates memory for the object from the managed heap.
  3. As long as address space is available in the managed heap, the runtime continues to allocate space for new objects. However, memory is not infinite. 
  4. Eventually the garbage collector must perform a collection in order to free some memory. 
  5. The garbage collector's optimizing engine determines the best time to perform a collection, based upon the allocations being made.
  6. When the garbage collector performs a collection, it checks for objects in the managed heap that are no longer being used by the application and performs the necessary operations to reclaim their memory.


6. What is the common language runtime (CLR)?

The common language runtime (CLR) is major component in the .NET Framework and it is the execution engine for .NET Framework applications.

It is responsible for proving the number of services, including the following:

1. Code management (loading and execution)

2. Verification of type safety

3. Conversion of Microsoft Intermediate Language (MSIL) to native code

4. Access to metadata (enhanced type information)

5. Managing memory for managed objects

6. Enforcement of code access security (See what is code access security?)

7. Exception handling, including cross-language exceptions

8. Interoperation between managed code, COM objects, and pre-existing DLLs (unmanaged code and data)

9. Automation of object layout

10. Support for developer services (profiling, debugging, and so on)

7. What is the common type system (CTS)?

The common type system (CTS) is a rich type system, built into the common language runtime (CLR) that supports the types and operations found in most of .NET programming languages. The common type system supports the complete implementation of a wide range of programming languages.

8. What is the Microsoft Intermediate Language (MSIL)?


MSIL is the Machine independent Code into which .NET Framework programs are compiled. It contains instructions for loading, storing, initializing, and calling methods on objects. Combined with metadata and the common type system, MSIL allows for true cross language integration. Prior to execution, MSIL is converted to machine code via CLR’s Just-in-Time (JIT) compiler.

9. What is managed code and managed data?


We can describe this Manage code like, if a code running under the control CLR, then we can call it as Managed Code.

Managed code is code that is written to target the services of the common language runtime (see what is CLR?). In order to target these services, the code must provide a minimum level of information (metadata) to the runtime.

10. What is portable executable (PE)?

The file format defining the structure that all executable files (EXE) and Dynamic Link Libraries (DLL) must use to allow them to be loaded and executed by Windows. PE is derived from the Microsoft Common Object File Format (COFF). The EXE and DLL files created using the .NET Framework obey the PE/COFF formats and also add additional header and data sections to the files that are only used by the CLR.
11. What is Code Access Security (CAS)?

CAS is the part of the .NET security model that determines whether or not a piece of code is allowed to run, and what resources it can use when it is running. For example, it is CAS that will prevent a .NET web applet from formatting your hard disk.

12. Which namespace is the base class for .net Class library?


system.object

13. What is serialization in .NET?


Serialization is the process of converting an object into a stream of bytes.

14. What is Deserialization in .NET?


Deserialization is the opposite process of serialization, creating an object from a stream of bytes.

15. What is exception handling?

Exception handling is the process of responding to the occurrence, during computation, of exceptions – anomalous or exceptional events requiring special processing – often changing the normal flow of program execution. It is provided by specialized programming language constructs or computer hardware mechanisms.
Exceptions that occur during destructor execution are worth special mention. If an exception occurs during destructor execution, and that exception is not caught, then the execution of that destructor is terminated and the destructor of the base class (if any) is called. If there is no base class (as in the case of the object type) or if there is no base class destructor, then the exception is discarded.




16. What are the contents of assembly?

In general, a static assembly can consist of four elements:

• The assembly manifest, which contains assembly metadata.
• Type metadata.
• Microsoft intermediate language (MSIL) code that implements the types.
• A set of resources.

17. What are the different types of assemblies?


Private, Public/Shared, Satellite

18. What is the difference between a private assembly and a shared assembly?


1. Location and visibility: A private assembly is normally used by a single application, and is stored in the application's directory, or a sub-directory beneath. A shared assembly is normally stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime. Shared assemblies are usually libraries of code which many applications will find useful, e.g. the .NET framework classes.

2. Versioning: The runtime enforces versioning constraints only on shared assemblies, not on private assemblies

19. What is the difference between ref & out parameters?


An argument passed to a ref parameter must first be initialized. Compare this to an out parameter, whose argument does not have to be explicitly initialized before being passed to an out parameter.

20. What is the difference between Array and Arraylist?


As elements are added to an ArrayList, the capacity is automatically increased as required through reallocation. The capacity can be decreased by calling TrimToSize or by setting the Capacity property explicitly.

21. What is Jagged Arrays?


A jagged array is an array whose elements are arrays. The elements of a jagged array can be of different dimensions and sizes. A jagged array is sometimes called an "array-of-arrays."


22. What are indexers?


Indexers are similar to properties, except that the get and set accessors of indexers take parameters, while property accessors do not.

23. What is Interop Services?


The common language runtime(CLR) provides two mechanisms for interoperating with unmanaged code:

• Platform invoke, which enables managed code to call functions exported from an unmanaged library.

• COM interop, which enables managed code to interact with COM objects through interfaces.

Both platform invoke and COM interop use interop marshaling to accurately move method arguments between caller and callee and back, if required.

24. What is RCW?

RCW Means Runtime Callable Wrappers, The common language runtime(CLR) exposes COM objects through a proxy called the runtime callable wrapper (RCW). Although the RCW appears to be an ordinary object to .NET clients, its primary function is to marshal calls between a .NET client and a COM object.

25. What is CCW?


CCW Means COM Callable Wrapper, A proxy object generated by the common language runtime (CLR). so that existing COM applications can use managed classes, including .NET Framework classes, transparently.

No comments:

Post a Comment