.Net Framework Related
Interview Questions-1
1. What are the main components of .NET
Framework?
Microsoft has started .NET
Framework to provide enormous advantages to software developers in comparison
to the advantages provided by other platforms. Microsoft has united various
modern as well as existing technologies of software development in .NET
Framework. These technologies are used by developers to develop highly
efficient applications for modern as well as future business needs.
The following are the key
components of .NET Framework:
- Common Language Specification(CLS)
- Common Type System
- NET Framework Class Library ( Formally known as BCL-Base class library)
- Common Language Runtime(CLR) or(Virtual Execution System)
2. What is an IL code?
Intermediate Language code is
also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language).the source code written in any
application using any .net compatible language(such as c.net#,Vb.net etc.) is first compiled and convert into IL code format only.
IL is then converted to Machine code or Native code with the help of CLR’s Just-In-Time
(JIT) compiler by targeting client machine.
3. What Is CLR?
CLR is the execution engine of
.net framework where all .net applications run under the supervision of CLR.applications
that run under the CLR are provide with the following benefits.
- Security
- Portability
- Automatic memory management
4. What CLR internally contains?
- CLR Internally contains the following things in it.
- Security Manager
- Class Ladder
- JIT( Just In Time) compiler
- Garbage Collector
5. What is Security Manager?
Security manager is responsible for
taking care of the security of applications .i.e. it will not allow
applications to interact directly with the Operating system Or Operating System
to interact directly with the application.
6. What is Class Ladder?
Class Ladder is responsible for
loading required libraries that are consumed under the applications, from base
class libraries in the runtime for the execution of applications.
7. What is JIT compiler?
Just in time compiler is
responsible for the conversion of CIL Code into native code adopting a process
known as “Conversion gradually during the program execution”.
8. What is Garbage Collector?
Garbage collection prevents
memory leaks during execution of programs. Garbage collector is a low-priority
process that manages the allocation and deallocation of memory for your
application. It checks for the unreferenced variables and objects. If GC finds
any object that is no longer used by the application, it frees up the memory
from that object. GC has changed a bit with the introduction of .NET 4.0. In
.NET 4.0, the GC.Collect() method contains the following overloaded
methods: GC.Collect(int) GC.Collect(int, GCCollectionMode) Another new feature
introduced in .NET is to notify you when the GC.Collect() method is
invoked and completed successfully by using different methods. The .NET 4.0
supports a new background garbage collection that replaces the concurrent
garbage collection used in earlier versions. This concurrent GC allocates
memory while running and uses current segment (which is 16 MB on a workstation)
for that. After that, all threads are suspended. In case of background GC, a
separate ephemeral GC - gen0 and gen1 can be started, while the full GC - gen0,
1, and 2 - is already running.
9. What is code access security (CAS)?
Code access security (CAS) is part of the .NET
security model that prevents unauthorized access of resources and operations,
and restricts the code to perform particular tasks.
10.
Differentiate between managed and unmanaged code?
Managed code is the code that is executed
directly by the CLR instead of the operating system. The code compiler first
compiles the managed code to intermediate language (IL) code, also called as
MSIL code. This code doesn't depend on machine configurations and can be
executed on different machines. Unmanaged code is the code that is executed
directly by the operating system outside the CLR environment. It is directly
compiled to native machine code which depends on the machine configuration. In
the managed code, since the execution of the code is governed by CLR, the
runtime provides different services, such as garbage collection, type checking,
exception handling, and security support. These services help provide
uniformity in platform and language-independent behavior of managed code
applications. In the unmanaged code, the allocation of memory, type safety, and
security is required to be taken care of by the developer. If the unmanaged
code is not properly handled, it may result in memory leak. Examples of
unmanaged code are ActiveX components and Win32 APIs that execute beyond the
scope of native CLR.
No comments:
Post a Comment