SlideShare a Scribd company logo
1 of 53
Download to read offline
Frequently Asked Interview Questions
PART 1
.NET is a general-purpose software development platform, similar to Java. At its core is a virtual
machine that turns intermediate language (IL) into machine code. High-level language compilers for C#,
VB.NET and C++ are provided to turn source code into IL. C# is a new programming language, very
similar to Java. An extensive class library is included, featuring all the functionality one might expect
from a contempory development platform - windows GUI development (Windows Form s), database
access (ADO.NET), web development (ASP.NET), web services, XML etc.
1.What is .NET?
.NET Framework is a complete environment that allows developers to develop, run, and deploy the
following applications: Console applications,Windows Forms applications,Windows Presentation
Foundation (WPF) applications,Web applications (ASP.NET applications),Web services,Windows
services,Service-oriented applications using Windows Communication Foundation (WCF),Workflow-
enabled applications using Windows Workflow Foundation (WF).
.NET Framework also enables a developer to create sharable components to be used in distributed
computing architecture. NET Framework supports the object-oriented programming model for multiple
languages, such as Visual Basic, Visual C#, and Visual C++. .NET Framework supports multiple
programming languages in a manner that allows language interoperability. This implies that each
language can use the code written in some other language.
2.What is .NET Framework?
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.
3.When was .NET announced?
.NET Framework provides 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:
.NET Framework Class Library
Common Language Runtime
Dynamic Language Runtimes (DLR)
Application Domains
Runtime Host
Common Type System
Metadata and Self-Describing Components
Cross-Language Interoperability
.NET Framework Security
Profiling
Side-by-Side Execution
4. What are the main components of .NET Framework?
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.
.NET 1.1 was released in April 2003 - it's mostly bug fixes for 1.0.
.NET 2.0 is expected in 2005.
5.What versions of .NET are there?
The following are the new features of .NET Framework 4.0:
Improved Application Compatibility and Deployment Support
Dynamic Language Runtime
Managed Extensibility Framework
Parallel Programming framework
Improved Security Model
Networking Improvements
Improved Core ASP.NET Services
Improvements in WPF 4
Improved Entity Framework (EF)
Integration between WCF and WF
6.List the new features added in .NET Framework 4.0.
The runtime supports Windows Server 2003, 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 XP and Windows 2000/2003. 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 .NET Compact Framework is a version of the .NET Framework for mobile
devices, running Windows CE or Windows Mobile.
The Mono project has a version of the .NET Framework that runs on
Linux.
7.What operating systems does the .NET Framework
run on?
Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common
Intermediate Language). All .NET source code is compiled to IL. IL is then converted to machine code at
the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.
8.What is an IL?
The CLI (Common Language Infrastructure) is the definition of the fundamentals of
the .NET framework - the Common Type System (CTS), metadata, the Virtual
Execution Environment (VES) and its use of intermediate language (IL), and the
support of multiple programming languages via the Common Language Specification
(CLS). The CLI is documented through ECMA - see
http://msdn.microsoft.com/net/ecma/ for more details.
The CLR (Common Language Runtime) is Microsoft's primary implementation of the
CLI. Microsoft also have a shared source implementation known as ROTOR, for
educational purposes, as well as the .NET Compact Framework for mobile devices.
Non-Microsoft CLI implementations include Mono and DotGNU Portable. NET.
9.What is the CLI? Is it the same as the CLR?
Assembly metadata is stored in Manifest. Manifest contains all the metadata needed to do the following
things
Version of assembly.
Security identity.
Scope of the assembly.
Resolve references to resources and classes.
The assembly manifest can be stored in a PE file either (an .exe or) .dll with Microsoft intermediate
language (MSIL code with Microsoft intermediate language (MSIL) code or in a stand-alone PE file, that
contains only assembly manifest information.
10.What is Manifest?
CTS = Common Type System. This is the full range of types that the .NET
runtime understands. Not all .NET languages support all the types in the
CTS.
CLS = Common Language Specification. This is a subset of the CTS which all
.NET languages are expected to support. The idea is that any program which
uses CLS-compliant types can interoperate with any .NET program written in
any language. This interop is very fine-grained - for example a VB.NET class
can inherit from a C# class.
11.What is the CTS, and how does it relate to the CLS?
Code contracts help you to express the code assumptions and statements stating the behavior of your
code in a language-neutral way. The contracts are included in the form of pre-conditions, post-conditions
and object-invariants. The contracts help you to improve-testing by enabling run-time checking, static
contract verification, and documentation generation. The System.Diagnostics.Contracts namespace
contains static classes that are used to express contracts in your code.
12.What are code contracts?
IL = Intermediate Language. Also known as MSIL (Microsoft Intermediate
Language) or CIL (Common Intermediate Language). All .NET source code
(of any language) is compiled to IL during development. The IL is then
converted to machine code at the point where the software is installed, or
(more commonly) at run-time by a Just-In-Time (JIT) compiler.
13.What is IL?
The following two new classes are introduced in the System.Numerics namespace:
BigInteger - Refers to a non-primitive integral type, which is used to hold a value of any size. It has no
lower and upper limit, making it possible for you to perform arithmetic calculations with very large
numbers, even with the numbers which cannot hold by double or long.
Complex - Represents complex numbers and enables different arithmetic operations with complex
numbers. A number represented in the form a + bi, where a is the real part, and b is the imaginary part,
is a complex number.
14.Name the classes that are introduced in the
System.Numerics namespace.
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.
Managed data: This is data that is allocated and freed by the .NET runtime's garbage collector.
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.
15.What does 'managed' mean in the .NET context?
Managed extensibility framework (MEF) is a new library that is introduced as a part of .NET 4.0 and Silverlight 4. It helps
in extending your application by providing greater reuse of applications and components. MEF provides a way for host
application to consume external extensions without any configuration requirement.
16.What is managed extensibility framework?
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.InvokeMember), or even create types dynamically at run-time
(see System.Reflection.Emit.TypeBuilder).
17.What is reflection?
Memory-mapped files (MMFs) allow you map the content of a file to the logical address of an application. These files
enable the multiple processes running on the same machine to share data with each Other. The
MemoryMappedFile.CreateFromFile() method is used to obtain a MemoryMappedFile object that represents a persisted
memory-mapped file from a file on disk. These files are included in the System.IO.MemoryMappedFiles namespace. This
namespace contains four classes and three enumerations to help you access and secure your file mappings.
18.Explain memory-mapped files?
An assembly is sometimes described as a logical .EXE or .DLL, and can be an
application (with a main entry point) or a library. An assembly consists of
one or more files (dlls, exes, html files etc), and represents a group of
resources, type definitions, and implementations of those types. An assembly
may also contain references to other assemblies. These resources, types and
references are described in a block of data called a manifest. The manifest is
part of the assembly, thus making the assembly self-describing.
19.What is an assembly?
CTS is the component of CLR through which .NET Framework provides support for multiple languages because it
contains a type system that is common across all the languages. Two CTS-compliant languages do not require type
conversion when calling the code written in one language from within the code written in another language. CTS provide a
base set of data types for all the languages supported by.NET Framework. This means that the size of integer and long
variables is same across all .NET-compliant programming languages. However, each language uses aliases for the base
data types provided by CTS. For example, CTS uses the data type system. int32 to represent a 4 byte integer value;
however, Visual Basic uses the alias integer for the same; whereas, C# uses the alias int. This is done for the sake of
clarity and simplicity.
20.What is Common Type System (CTS)?
The simplest way to produce an assembly is directly from a .NET compiler.
For example, the following C# program:
public class CTest
{
public CTest() { System.Console.WriteLine( "Hello from CTest" ); }
}
can be compiled into a library assembly (dll) like this:
csc /t:library ctest.cs
You can then view the contents of the assembly by running the "IL
Disassembler" tool that comes with the .NET SDK.
Alternatively you can compile your source into modules, and then combine
the modules into an assembly using the assembly linker (al.exe). For the C#
compiler, the /target:module switch is used to generate a module instead of
an assembly.
21.How can I produce an assembly?
Side-by-side execution enables you to run multiple versions of an application or
component and CLR on the same computer at the same time. As versioning is
applicable only to shared assemblies and not to private assemblies, two
applications, one using a private assembly and other using a shared assembly,
cannot be stated as side-by-side executables.
22.Give a brief introduction on side-by-side execution. Can two applications, one using
private assembly and the other using the shared assembly be stated as side-by-side
executables?
· Location and visibility: A private assembly is normally used by a
single application, and is stored in the application's directory, or a subdirectory
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.
· Versioning: The runtime enforces versioning constraints only on
shared assemblies, not on private assemblies.
23.What is the difference between a private assembly and a
shared assembly?
CLR uses the Dispose and Finalize methods to perform garbage collection of run-time objects of .NET applications. The
Finalize method is called automatically by the runtime. CLR has a garbage collector (GC), which periodically checks for
objects in heap that are no longer referenced by any object or program. It calls the Finalize method to free the memory
used by such objects. The Dispose method is called by the programmer. Dispose is another method to release the
memory used by an object. The Dispose method needs to be explicitly called in code to dereference an object from the
heap. The Dispose method can be invoked only by the classes that implement the IDisposable interface.
24.State the differences between the Dispose() and Finalize()?
By searching directory paths. There are several factors which can affect the path (such as the AppDomain host, and
application configuration files), but for private assemblies the search path is normally the application's directory
and its sub-directories. For shared assemblies, the search path is normally same as the private assembly path plus the
shared assembly cache.
25.How do assemblies find each other?
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.
26.What is code access security (CAS)?
Each assembly has a version number called the compatibility version. Also each reference to an assembly (from another
assembly) includes both the name and version of the referenced assembly. The version number has four numeric parts
(e.g. 5.5.2.33). Assemblies with either of the first two parts different are normally viewed as incompatible. If
the first two parts are the same, but the third is different, the assemblies are deemed as 'maybe compatible'. If only the
fourth part is different, the assemblies are deemed compatible. However, this is just the default
guideline -
it is the version policy that decides to what extent these rules are
enforced. The version policy can be specified via the application configuration
file.
Remember: versioning is only applied to shared assemblies, not private
assemblies.
27.How does assembly versioning work?
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.
28.Differentiate between managed and unmanaged code?
An AppDomain can be thought of as a lightweight process. Multiple AppDomains can exist inside a Win32 process. The
primary purpose of the AppDomain is to isolate applications from each other, and so it is particularly
useful in hosting scenarios such as ASP.NET. An AppDomain can be destroyed by the host without affecting other
AppDomains in the process.Win32 processes provide isolation by having distinct memory address spaces.
This is effective, but expensive. The .NET runtime enforces AppDomain isolation by keeping control over the use of
memory - all memory in the AppDomain is managed by the .NET runtime, so the runtime can ensure that
AppDomains do not access each other's memory. One non-obvious use of AppDomains is for unloading types. Currently
the only way to unload a .NET type is to destroy the AppDomain it is loaded into.
This is particularly useful if you create and destroy types on-the-fly via reflection.
29.What is an application domain?
Tuple is a fixed-size collection that can have elements of either same or different data types. Similar to arrays, a user
must have to specify the size of a tuple at the time of declaration. Tuples are allowed to hold up from 1 to 8 elements and
if there are more than 8 elements, then the 8th element can be defined as another tuple. Tuples can be specified as
parameter or return type of a method.
30.What are tuples?
Yes. For an example of how to do this, take a look at the source for the
dm.net moniker developed by Jason Whittington and Don Box. There is also
a code sample in the .NET SDK called CorHost.
31.Can I write my own .NET host?
YOU can use the Code Access Security Tool (Caspol.exe) to turn security on and off. To turn off
security, type the following command at the command prompt: caspol -security off To turn on security,
type the following command at the command prompt: caspol -security on In the .NET Framework 4.0, for
using Caspol.exe, you first need to set the <LegacyCasPolicy> element to true.
32.How can you turn-on and turn-off CAS?
Garbage collection is a heap-management strategy where a run-time
component takes responsibility for managing the lifetime of the memory used
by objects. This concept is not new to .NET - Java and many other
languages/runtimes have used garbage collection for some time.
33.What is garbage collection?
There are two key concepts of CAS security policy- code groups and permissions. A code group
contains assemblies in it in a manner that each .NET assembly is related to a particular code group and
some permissions are granted to each code group. For example, using the default security policy, a
control downloaded from a Web site belongs to the Zone, Internet code group, which adheres to the
permissions defined by the named permission set. (Normally, the named permission set represents a
very restrictive range of permissions.)
Assembly execution involves the following steps:
1. Evidences are gathered about assembly.
2. Depending on the gathered evidences, the assembly is assigned to a code group.
3. Security rights are allocated to the assembly, depending on the code group.
4. Assembly runs as per the rights assigned to it.
34.How does CAS works?
Yes. The garbage collector offers no guarantees about the time when an
object will be destroyed and its memory reclaimed.
There was an interesting thread on the DOTNET list, started by Chris Sells,
about the implications of non-deterministic destruction of objects in C#. In
October 2000, Microsoft's Brian Harry posted a lengthy analysis of the
problem. Chris Sells' response to Brian's posting is here.
35.Is it true that objects don't always get destroyed
immediately when the last reference goes away?
Following are the differences between namespace and assembly:
Assembly is physical grouping of logical units, Namespace, logically groups classes.
Namespace can span multiple assembly.
36.What is Difference between NameSpace and Assembly?
Because of the garbage collection algorithm. The .NET garbage collector works by periodically running
through a list of all the objects that are currently being referenced by an application. All the objects that it
doesn't find during this search are ready to be destroyed and the memory reclaimed.
The implication of this algorithm is that the runtime doesn't get notified immediately when the final
reference on an object goes away - it only finds out during the next 'sweep' of the heap.
Futher more, this type of algorithm works best by performing the garbage collection sweep as rarely as
possible. Normally heap exhaustion is the trigger for a collection sweep.
37.Why doesn't the .NET runtime offer deterministic
destruction?
A piece of managed code is executed as follows:
Choosing a language compiler
Compiling the code to MSIL
Compiling MSIL to native code
Executing the code.
38.Mention the execution process for managed code?
It's certainly an issue that affects component design. If you have objects that
maintain expensive or scarce resources (e.g. database locks), you need to
provide some way to tell the object to release the resource when it is done.
Microsoft recommend that you provide a method called Dispose() for this
purpose. However, this causes problems for distributed objects - in a
distributed system who calls the Dispose() method? Some form of referencecounting
or ownership-management mechanism is needed to handle
distributed objects - unfortunately the runtime offers no help with this.
39.Is the lack of deterministic destruction in .NET a problem?
The following are two ways to instantiate a tuple:
Using the new operator.
For example,
Tuple<String, int> t = new Tuple<String, int> ("Hellow", 2);
Using the Create factory method available in the Tuple class.
For example,
Tuple<int, int, int> t = Tuple.Create<int, int, int> (2, 4, 5);
40.How can you instantiate a tuple?
A little. For example the System.GC class exposes a Collect method, which
forces the garbage collector to collect all unreferenced objects immediately.
Also there is a gcConcurrent setting that can be specified via the application
configuration file. This specifies whether or not the garbage collector
performs some of its collection activities on a separate thread. The setting
only applies on multi-processor machines, and defaults to true.
41.Do I have any control over the garbage collection
algorithm?
The CAS mechanism in .NET is used to control and configure the ability of managed code. Earlier, as
this policy was applicable for only native applications, the security guarantee was limited. Therefore,
developers used to look for alternating solutions, such as operating system-level solutions. This problem
was solved in .NET Framework 4 by turning off the machine-wide security. The shared and hosted Web
applications can now run more securely. The security policy in .NET Framework 4 has been simplified
using the transparency model. This model allows you to run the Web applications without concerning
about the CAS policies.
As a result of security policy changes in .NET Framework 4.0, you may encounter compilation warnings
and runtime exceptions, if your try to use the obsolete CAS policy types and members either implicitly or
explicitly. However, you can avoid the warnings and errors by using the
<NetFx40_LegacySecurityPolicy> configuration element in the runtime settings schema to opt into the
obsolete CAS policy behavior.
42.What are the improvements made in CAS in .NET 4.0?
Lots of interesting statistics are exported from the .NET runtime via the '.NET
CLR xxx' performance counters. Use Performance Monitor to view them.
43.How can I find out what the garbage collector is doing?
The .NET Framework is shipped with compilers of all .NET programming languages to develop
programs. There are separate compilers for the Visual Basic, C#, and Visual C++ programming
languages in .NET Framework. Each .NET compiler produces an intermediate code after compiling the
source code. The intermediate code is common for all languages and is understandable only to .NET
environment. This intermediate code is known as MSIL.
44.What is Microsoft Intermediate Language (MSIL)?
Serialization is the process of converting an object into a stream of bytes.
Deserialization is the opposite process, i.e. creating an object from a stream
of bytes. Serialization/Deserialization is mostly used to transport objects
(e.g. during remoting), or to persist objects (e.g. to a file or database).
45.What is serialization?
Lazy initialization is a process by which an object is not initialized until it is first called in your code. The
.NET 4.0 introduces a new wrapper class, System.Lazy<T>, for executing the lazy initialization in your
application. Lazy initialization helps you to reduce the wastage of resources and memory requirements
to improve performance. It also supports thread-safety.
46.What is lazy initialization?
There are two separate mechanisms provided by the .NET class library -
XmlSerializer and SoapFormatter/BinaryFormatter. Microsoft uses
XmlSerializer for Web Services, and SoapFormatter/BinaryFormatter for
remoting. Both are available for use in your own code.
47.Does the .NET Framework have in-built support for
serialization?
Memory management in the CLR is divided into three generations that are build up by grouping memory
segments. Generations enhance the garbage collection performance. The following are the three types
of generations found in a garbage collector:
Generation 0 - When an object is initialized, it is said to be in generation 0.
Generation 1 - The objects that are under garbage collection process are considered to be in
generation1.
Generation 2 - Whenever new objects are created and added to the memory, they are added to
generation 0 and the old objects in generation 1 are considered to be in generation 2.
48.How many types of generations are there in a garbage collector?
Yes. XmlSerializer supports a range of attributes that can be used to
configure serialization for a particular class. For example, a field or property
can be marked with the [XmlIgnore] attribute to exclude it from serialization.
Another example is the [XmlElement] attribute, which can be used to specify
the XML element name to be used for a particular property or field.
Serialization via SoapFormatter/BinaryFormatter can also be controlled to
some extent by attributes. For example, the [NonSerialized] attribute is the
equivalent of XmlSerializer's [XmlIgnore] attribute. Ultimate control of the
serialization process can be acheived by implementing the the ISerializable
interface on the class whose instances are to be serialized.
49.Can I customise the serialization process?
CLS is a set of basic rules, which must be followed by each .NET language to be a .NET- compliant
language. It enables interoperability between two .NET-compliant languages. CLS is a subset of CTS;
therefore, the languages supported by CLS can use each other's class libraries similar to their own.
Application programming interfaces (APIs), which are designed by following the rules defined in CLS
can be used by all .NET-compliant languages.
50.What is Common Language Specification (CLS)?
To know more details on dot net click https://bigclasses.com/dot-net-online-
training.html and
call us:- +91 800 811 4040
For regular Updates on dot net please like our Facebook page:-
Facebook:- https://www.facebook.com/bigclasses/
Twitter:- https://twitter.com/bigclasses
LinkedIn:- https://www.linkedin.com/company/bigclasses
Google+: https://plus.google.com/+Bigclassesonline
DOT NET Course Page:- https://bigclasses.com/dot-net-online-training.html
Contact us: - India +91 800 811 4040
USA +1 732 325 1626
Email us at: - info@bigclasses.com
Dot net-interview-questions-and-answers part i

More Related Content

What's hot

Net Fundamentals
Net FundamentalsNet Fundamentals
Net FundamentalsAli Taki
 
Lesson 1 Understanding Dot Net Framework
Lesson 1   Understanding Dot Net FrameworkLesson 1   Understanding Dot Net Framework
Lesson 1 Understanding Dot Net Frameworknbaveja
 
Inside .net framework
Inside .net frameworkInside .net framework
Inside .net frameworkFaisal Aziz
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet frameworkNitu Pandey
 
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)citizenmatt
 
Dot Net Fundamentals
Dot Net FundamentalsDot Net Fundamentals
Dot Net FundamentalsLiquidHub
 
Dot net interview_questions
Dot net interview_questionsDot net interview_questions
Dot net interview_questions9292929292
 
Architecture of .net framework
Architecture of .net frameworkArchitecture of .net framework
Architecture of .net frameworkThen Murugeshwari
 
Dotnet Frameworks Version History
Dotnet Frameworks Version HistoryDotnet Frameworks Version History
Dotnet Frameworks Version Historyvoltaincx
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...yazad dumasia
 
Module 1: Introduction to .NET Framework 3.5 (Slides)
Module 1: Introduction to .NET Framework 3.5 (Slides)Module 1: Introduction to .NET Framework 3.5 (Slides)
Module 1: Introduction to .NET Framework 3.5 (Slides)Mohamed Saleh
 
.Net platform an understanding
.Net platform an understanding.Net platform an understanding
.Net platform an understandingBinu Bhasuran
 
Introduction to .NET Framework
Introduction to .NET FrameworkIntroduction to .NET Framework
Introduction to .NET FrameworkKamlesh Makvana
 

What's hot (19)

Net Fundamentals
Net FundamentalsNet Fundamentals
Net Fundamentals
 
Lesson 1 Understanding Dot Net Framework
Lesson 1   Understanding Dot Net FrameworkLesson 1   Understanding Dot Net Framework
Lesson 1 Understanding Dot Net Framework
 
Inside .net framework
Inside .net frameworkInside .net framework
Inside .net framework
 
Introduction to .net
Introduction to .netIntroduction to .net
Introduction to .net
 
Inside.Net
Inside.NetInside.Net
Inside.Net
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet framework
 
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
 
Dot Net Fundamentals
Dot Net FundamentalsDot Net Fundamentals
Dot Net Fundamentals
 
Net framework
Net frameworkNet framework
Net framework
 
Programming
Programming Programming
Programming
 
Dot net interview_questions
Dot net interview_questionsDot net interview_questions
Dot net interview_questions
 
Architecture of .net framework
Architecture of .net frameworkArchitecture of .net framework
Architecture of .net framework
 
Dotnet Frameworks Version History
Dotnet Frameworks Version HistoryDotnet Frameworks Version History
Dotnet Frameworks Version History
 
Dot net
Dot netDot net
Dot net
 
.Net framework
.Net framework.Net framework
.Net framework
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
 
Module 1: Introduction to .NET Framework 3.5 (Slides)
Module 1: Introduction to .NET Framework 3.5 (Slides)Module 1: Introduction to .NET Framework 3.5 (Slides)
Module 1: Introduction to .NET Framework 3.5 (Slides)
 
.Net platform an understanding
.Net platform an understanding.Net platform an understanding
.Net platform an understanding
 
Introduction to .NET Framework
Introduction to .NET FrameworkIntroduction to .NET Framework
Introduction to .NET Framework
 

Similar to Dot net-interview-questions-and-answers part i

Similar to Dot net-interview-questions-and-answers part i (20)

Unit I- Introduction to .NET Framework.pdf
Unit I- Introduction to .NET Framework.pdfUnit I- Introduction to .NET Framework.pdf
Unit I- Introduction to .NET Framework.pdf
 
Chapter1
Chapter1Chapter1
Chapter1
 
c#.pptx
c#.pptxc#.pptx
c#.pptx
 
.Net framework
.Net framework.Net framework
.Net framework
 
.Net introduction by Quontra Solutions
.Net introduction by Quontra Solutions.Net introduction by Quontra Solutions
.Net introduction by Quontra Solutions
 
dotNET frameworks
dotNET frameworksdotNET frameworks
dotNET frameworks
 
dot NET Framework
dot NET Frameworkdot NET Framework
dot NET Framework
 
Dot net interview_questions
Dot net interview_questionsDot net interview_questions
Dot net interview_questions
 
Dot net interview_questions
Dot net interview_questionsDot net interview_questions
Dot net interview_questions
 
Introduction of .net framework
Introduction of .net frameworkIntroduction of .net framework
Introduction of .net framework
 
Dotnet Basics Presentation
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics Presentation
 
1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)
 
C# chap 2
C# chap 2C# chap 2
C# chap 2
 
Chapter1_Part1.pptx
Chapter1_Part1.pptxChapter1_Part1.pptx
Chapter1_Part1.pptx
 
Online lg prodect
Online lg prodectOnline lg prodect
Online lg prodect
 
Net framework
Net frameworkNet framework
Net framework
 
Dot Net PPt.pptx
Dot Net PPt.pptxDot Net PPt.pptx
Dot Net PPt.pptx
 
The Seven Pillars Of Asp.Net
The Seven Pillars Of Asp.NetThe Seven Pillars Of Asp.Net
The Seven Pillars Of Asp.Net
 
Net framework
Net frameworkNet framework
Net framework
 
The seven pillars of aspnet
The seven pillars of aspnetThe seven pillars of aspnet
The seven pillars of aspnet
 

Recently uploaded

ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 

Recently uploaded (20)

ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 

Dot net-interview-questions-and-answers part i

  • 1. Frequently Asked Interview Questions PART 1
  • 2. .NET is a general-purpose software development platform, similar to Java. At its core is a virtual machine that turns intermediate language (IL) into machine code. High-level language compilers for C#, VB.NET and C++ are provided to turn source code into IL. C# is a new programming language, very similar to Java. An extensive class library is included, featuring all the functionality one might expect from a contempory development platform - windows GUI development (Windows Form s), database access (ADO.NET), web development (ASP.NET), web services, XML etc. 1.What is .NET?
  • 3. .NET Framework is a complete environment that allows developers to develop, run, and deploy the following applications: Console applications,Windows Forms applications,Windows Presentation Foundation (WPF) applications,Web applications (ASP.NET applications),Web services,Windows services,Service-oriented applications using Windows Communication Foundation (WCF),Workflow- enabled applications using Windows Workflow Foundation (WF). .NET Framework also enables a developer to create sharable components to be used in distributed computing architecture. NET Framework supports the object-oriented programming model for multiple languages, such as Visual Basic, Visual C#, and Visual C++. .NET Framework supports multiple programming languages in a manner that allows language interoperability. This implies that each language can use the code written in some other language. 2.What is .NET Framework?
  • 4. 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. 3.When was .NET announced?
  • 5. .NET Framework provides 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: .NET Framework Class Library Common Language Runtime Dynamic Language Runtimes (DLR) Application Domains Runtime Host Common Type System Metadata and Self-Describing Components Cross-Language Interoperability .NET Framework Security Profiling Side-by-Side Execution 4. What are the main components of .NET Framework?
  • 6. 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. .NET 1.1 was released in April 2003 - it's mostly bug fixes for 1.0. .NET 2.0 is expected in 2005. 5.What versions of .NET are there?
  • 7. The following are the new features of .NET Framework 4.0: Improved Application Compatibility and Deployment Support Dynamic Language Runtime Managed Extensibility Framework Parallel Programming framework Improved Security Model Networking Improvements Improved Core ASP.NET Services Improvements in WPF 4 Improved Entity Framework (EF) Integration between WCF and WF 6.List the new features added in .NET Framework 4.0.
  • 8. The runtime supports Windows Server 2003, 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 XP and Windows 2000/2003. 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 .NET Compact Framework is a version of the .NET Framework for mobile devices, running Windows CE or Windows Mobile. The Mono project has a version of the .NET Framework that runs on Linux. 7.What operating systems does the .NET Framework run on?
  • 9. Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler. 8.What is an IL?
  • 10. The CLI (Common Language Infrastructure) is the definition of the fundamentals of the .NET framework - the Common Type System (CTS), metadata, the Virtual Execution Environment (VES) and its use of intermediate language (IL), and the support of multiple programming languages via the Common Language Specification (CLS). The CLI is documented through ECMA - see http://msdn.microsoft.com/net/ecma/ for more details. The CLR (Common Language Runtime) is Microsoft's primary implementation of the CLI. Microsoft also have a shared source implementation known as ROTOR, for educational purposes, as well as the .NET Compact Framework for mobile devices. Non-Microsoft CLI implementations include Mono and DotGNU Portable. NET. 9.What is the CLI? Is it the same as the CLR?
  • 11. Assembly metadata is stored in Manifest. Manifest contains all the metadata needed to do the following things Version of assembly. Security identity. Scope of the assembly. Resolve references to resources and classes. The assembly manifest can be stored in a PE file either (an .exe or) .dll with Microsoft intermediate language (MSIL code with Microsoft intermediate language (MSIL) code or in a stand-alone PE file, that contains only assembly manifest information. 10.What is Manifest?
  • 12. CTS = Common Type System. This is the full range of types that the .NET runtime understands. Not all .NET languages support all the types in the CTS. CLS = Common Language Specification. This is a subset of the CTS which all .NET languages are expected to support. The idea is that any program which uses CLS-compliant types can interoperate with any .NET program written in any language. This interop is very fine-grained - for example a VB.NET class can inherit from a C# class. 11.What is the CTS, and how does it relate to the CLS?
  • 13. Code contracts help you to express the code assumptions and statements stating the behavior of your code in a language-neutral way. The contracts are included in the form of pre-conditions, post-conditions and object-invariants. The contracts help you to improve-testing by enabling run-time checking, static contract verification, and documentation generation. The System.Diagnostics.Contracts namespace contains static classes that are used to express contracts in your code. 12.What are code contracts?
  • 14. IL = Intermediate Language. Also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code (of any language) is compiled to IL during development. The IL is then converted to machine code at the point where the software is installed, or (more commonly) at run-time by a Just-In-Time (JIT) compiler. 13.What is IL?
  • 15. The following two new classes are introduced in the System.Numerics namespace: BigInteger - Refers to a non-primitive integral type, which is used to hold a value of any size. It has no lower and upper limit, making it possible for you to perform arithmetic calculations with very large numbers, even with the numbers which cannot hold by double or long. Complex - Represents complex numbers and enables different arithmetic operations with complex numbers. A number represented in the form a + bi, where a is the real part, and b is the imaginary part, is a complex number. 14.Name the classes that are introduced in the System.Numerics namespace.
  • 16. 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. Managed data: This is data that is allocated and freed by the .NET runtime's garbage collector. 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. 15.What does 'managed' mean in the .NET context?
  • 17. Managed extensibility framework (MEF) is a new library that is introduced as a part of .NET 4.0 and Silverlight 4. It helps in extending your application by providing greater reuse of applications and components. MEF provides a way for host application to consume external extensions without any configuration requirement. 16.What is managed extensibility framework?
  • 18. 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.InvokeMember), or even create types dynamically at run-time (see System.Reflection.Emit.TypeBuilder). 17.What is reflection?
  • 19. Memory-mapped files (MMFs) allow you map the content of a file to the logical address of an application. These files enable the multiple processes running on the same machine to share data with each Other. The MemoryMappedFile.CreateFromFile() method is used to obtain a MemoryMappedFile object that represents a persisted memory-mapped file from a file on disk. These files are included in the System.IO.MemoryMappedFiles namespace. This namespace contains four classes and three enumerations to help you access and secure your file mappings. 18.Explain memory-mapped files?
  • 20. An assembly is sometimes described as a logical .EXE or .DLL, and can be an application (with a main entry point) or a library. An assembly consists of one or more files (dlls, exes, html files etc), and represents a group of resources, type definitions, and implementations of those types. An assembly may also contain references to other assemblies. These resources, types and references are described in a block of data called a manifest. The manifest is part of the assembly, thus making the assembly self-describing. 19.What is an assembly?
  • 21. CTS is the component of CLR through which .NET Framework provides support for multiple languages because it contains a type system that is common across all the languages. Two CTS-compliant languages do not require type conversion when calling the code written in one language from within the code written in another language. CTS provide a base set of data types for all the languages supported by.NET Framework. This means that the size of integer and long variables is same across all .NET-compliant programming languages. However, each language uses aliases for the base data types provided by CTS. For example, CTS uses the data type system. int32 to represent a 4 byte integer value; however, Visual Basic uses the alias integer for the same; whereas, C# uses the alias int. This is done for the sake of clarity and simplicity. 20.What is Common Type System (CTS)?
  • 22. The simplest way to produce an assembly is directly from a .NET compiler. For example, the following C# program: public class CTest { public CTest() { System.Console.WriteLine( "Hello from CTest" ); } } can be compiled into a library assembly (dll) like this: csc /t:library ctest.cs You can then view the contents of the assembly by running the "IL Disassembler" tool that comes with the .NET SDK. Alternatively you can compile your source into modules, and then combine the modules into an assembly using the assembly linker (al.exe). For the C# compiler, the /target:module switch is used to generate a module instead of an assembly. 21.How can I produce an assembly?
  • 23. Side-by-side execution enables you to run multiple versions of an application or component and CLR on the same computer at the same time. As versioning is applicable only to shared assemblies and not to private assemblies, two applications, one using a private assembly and other using a shared assembly, cannot be stated as side-by-side executables. 22.Give a brief introduction on side-by-side execution. Can two applications, one using private assembly and the other using the shared assembly be stated as side-by-side executables?
  • 24. · Location and visibility: A private assembly is normally used by a single application, and is stored in the application's directory, or a subdirectory 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. · Versioning: The runtime enforces versioning constraints only on shared assemblies, not on private assemblies. 23.What is the difference between a private assembly and a shared assembly?
  • 25. CLR uses the Dispose and Finalize methods to perform garbage collection of run-time objects of .NET applications. The Finalize method is called automatically by the runtime. CLR has a garbage collector (GC), which periodically checks for objects in heap that are no longer referenced by any object or program. It calls the Finalize method to free the memory used by such objects. The Dispose method is called by the programmer. Dispose is another method to release the memory used by an object. The Dispose method needs to be explicitly called in code to dereference an object from the heap. The Dispose method can be invoked only by the classes that implement the IDisposable interface. 24.State the differences between the Dispose() and Finalize()?
  • 26. By searching directory paths. There are several factors which can affect the path (such as the AppDomain host, and application configuration files), but for private assemblies the search path is normally the application's directory and its sub-directories. For shared assemblies, the search path is normally same as the private assembly path plus the shared assembly cache. 25.How do assemblies find each other?
  • 27. 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. 26.What is code access security (CAS)?
  • 28. Each assembly has a version number called the compatibility version. Also each reference to an assembly (from another assembly) includes both the name and version of the referenced assembly. The version number has four numeric parts (e.g. 5.5.2.33). Assemblies with either of the first two parts different are normally viewed as incompatible. If the first two parts are the same, but the third is different, the assemblies are deemed as 'maybe compatible'. If only the fourth part is different, the assemblies are deemed compatible. However, this is just the default guideline - it is the version policy that decides to what extent these rules are enforced. The version policy can be specified via the application configuration file. Remember: versioning is only applied to shared assemblies, not private assemblies. 27.How does assembly versioning work?
  • 29. 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. 28.Differentiate between managed and unmanaged code?
  • 30. An AppDomain can be thought of as a lightweight process. Multiple AppDomains can exist inside a Win32 process. The primary purpose of the AppDomain is to isolate applications from each other, and so it is particularly useful in hosting scenarios such as ASP.NET. An AppDomain can be destroyed by the host without affecting other AppDomains in the process.Win32 processes provide isolation by having distinct memory address spaces. This is effective, but expensive. The .NET runtime enforces AppDomain isolation by keeping control over the use of memory - all memory in the AppDomain is managed by the .NET runtime, so the runtime can ensure that AppDomains do not access each other's memory. One non-obvious use of AppDomains is for unloading types. Currently the only way to unload a .NET type is to destroy the AppDomain it is loaded into. This is particularly useful if you create and destroy types on-the-fly via reflection. 29.What is an application domain?
  • 31. Tuple is a fixed-size collection that can have elements of either same or different data types. Similar to arrays, a user must have to specify the size of a tuple at the time of declaration. Tuples are allowed to hold up from 1 to 8 elements and if there are more than 8 elements, then the 8th element can be defined as another tuple. Tuples can be specified as parameter or return type of a method. 30.What are tuples?
  • 32. Yes. For an example of how to do this, take a look at the source for the dm.net moniker developed by Jason Whittington and Don Box. There is also a code sample in the .NET SDK called CorHost. 31.Can I write my own .NET host?
  • 33. YOU can use the Code Access Security Tool (Caspol.exe) to turn security on and off. To turn off security, type the following command at the command prompt: caspol -security off To turn on security, type the following command at the command prompt: caspol -security on In the .NET Framework 4.0, for using Caspol.exe, you first need to set the <LegacyCasPolicy> element to true. 32.How can you turn-on and turn-off CAS?
  • 34. Garbage collection is a heap-management strategy where a run-time component takes responsibility for managing the lifetime of the memory used by objects. This concept is not new to .NET - Java and many other languages/runtimes have used garbage collection for some time. 33.What is garbage collection?
  • 35. There are two key concepts of CAS security policy- code groups and permissions. A code group contains assemblies in it in a manner that each .NET assembly is related to a particular code group and some permissions are granted to each code group. For example, using the default security policy, a control downloaded from a Web site belongs to the Zone, Internet code group, which adheres to the permissions defined by the named permission set. (Normally, the named permission set represents a very restrictive range of permissions.) Assembly execution involves the following steps: 1. Evidences are gathered about assembly. 2. Depending on the gathered evidences, the assembly is assigned to a code group. 3. Security rights are allocated to the assembly, depending on the code group. 4. Assembly runs as per the rights assigned to it. 34.How does CAS works?
  • 36. Yes. The garbage collector offers no guarantees about the time when an object will be destroyed and its memory reclaimed. There was an interesting thread on the DOTNET list, started by Chris Sells, about the implications of non-deterministic destruction of objects in C#. In October 2000, Microsoft's Brian Harry posted a lengthy analysis of the problem. Chris Sells' response to Brian's posting is here. 35.Is it true that objects don't always get destroyed immediately when the last reference goes away?
  • 37. Following are the differences between namespace and assembly: Assembly is physical grouping of logical units, Namespace, logically groups classes. Namespace can span multiple assembly. 36.What is Difference between NameSpace and Assembly?
  • 38. Because of the garbage collection algorithm. The .NET garbage collector works by periodically running through a list of all the objects that are currently being referenced by an application. All the objects that it doesn't find during this search are ready to be destroyed and the memory reclaimed. The implication of this algorithm is that the runtime doesn't get notified immediately when the final reference on an object goes away - it only finds out during the next 'sweep' of the heap. Futher more, this type of algorithm works best by performing the garbage collection sweep as rarely as possible. Normally heap exhaustion is the trigger for a collection sweep. 37.Why doesn't the .NET runtime offer deterministic destruction?
  • 39. A piece of managed code is executed as follows: Choosing a language compiler Compiling the code to MSIL Compiling MSIL to native code Executing the code. 38.Mention the execution process for managed code?
  • 40. It's certainly an issue that affects component design. If you have objects that maintain expensive or scarce resources (e.g. database locks), you need to provide some way to tell the object to release the resource when it is done. Microsoft recommend that you provide a method called Dispose() for this purpose. However, this causes problems for distributed objects - in a distributed system who calls the Dispose() method? Some form of referencecounting or ownership-management mechanism is needed to handle distributed objects - unfortunately the runtime offers no help with this. 39.Is the lack of deterministic destruction in .NET a problem?
  • 41. The following are two ways to instantiate a tuple: Using the new operator. For example, Tuple<String, int> t = new Tuple<String, int> ("Hellow", 2); Using the Create factory method available in the Tuple class. For example, Tuple<int, int, int> t = Tuple.Create<int, int, int> (2, 4, 5); 40.How can you instantiate a tuple?
  • 42. A little. For example the System.GC class exposes a Collect method, which forces the garbage collector to collect all unreferenced objects immediately. Also there is a gcConcurrent setting that can be specified via the application configuration file. This specifies whether or not the garbage collector performs some of its collection activities on a separate thread. The setting only applies on multi-processor machines, and defaults to true. 41.Do I have any control over the garbage collection algorithm?
  • 43. The CAS mechanism in .NET is used to control and configure the ability of managed code. Earlier, as this policy was applicable for only native applications, the security guarantee was limited. Therefore, developers used to look for alternating solutions, such as operating system-level solutions. This problem was solved in .NET Framework 4 by turning off the machine-wide security. The shared and hosted Web applications can now run more securely. The security policy in .NET Framework 4 has been simplified using the transparency model. This model allows you to run the Web applications without concerning about the CAS policies. As a result of security policy changes in .NET Framework 4.0, you may encounter compilation warnings and runtime exceptions, if your try to use the obsolete CAS policy types and members either implicitly or explicitly. However, you can avoid the warnings and errors by using the <NetFx40_LegacySecurityPolicy> configuration element in the runtime settings schema to opt into the obsolete CAS policy behavior. 42.What are the improvements made in CAS in .NET 4.0?
  • 44. Lots of interesting statistics are exported from the .NET runtime via the '.NET CLR xxx' performance counters. Use Performance Monitor to view them. 43.How can I find out what the garbage collector is doing?
  • 45. The .NET Framework is shipped with compilers of all .NET programming languages to develop programs. There are separate compilers for the Visual Basic, C#, and Visual C++ programming languages in .NET Framework. Each .NET compiler produces an intermediate code after compiling the source code. The intermediate code is common for all languages and is understandable only to .NET environment. This intermediate code is known as MSIL. 44.What is Microsoft Intermediate Language (MSIL)?
  • 46. Serialization is the process of converting an object into a stream of bytes. Deserialization is the opposite process, i.e. creating an object from a stream of bytes. Serialization/Deserialization is mostly used to transport objects (e.g. during remoting), or to persist objects (e.g. to a file or database). 45.What is serialization?
  • 47. Lazy initialization is a process by which an object is not initialized until it is first called in your code. The .NET 4.0 introduces a new wrapper class, System.Lazy<T>, for executing the lazy initialization in your application. Lazy initialization helps you to reduce the wastage of resources and memory requirements to improve performance. It also supports thread-safety. 46.What is lazy initialization?
  • 48. There are two separate mechanisms provided by the .NET class library - XmlSerializer and SoapFormatter/BinaryFormatter. Microsoft uses XmlSerializer for Web Services, and SoapFormatter/BinaryFormatter for remoting. Both are available for use in your own code. 47.Does the .NET Framework have in-built support for serialization?
  • 49. Memory management in the CLR is divided into three generations that are build up by grouping memory segments. Generations enhance the garbage collection performance. The following are the three types of generations found in a garbage collector: Generation 0 - When an object is initialized, it is said to be in generation 0. Generation 1 - The objects that are under garbage collection process are considered to be in generation1. Generation 2 - Whenever new objects are created and added to the memory, they are added to generation 0 and the old objects in generation 1 are considered to be in generation 2. 48.How many types of generations are there in a garbage collector?
  • 50. Yes. XmlSerializer supports a range of attributes that can be used to configure serialization for a particular class. For example, a field or property can be marked with the [XmlIgnore] attribute to exclude it from serialization. Another example is the [XmlElement] attribute, which can be used to specify the XML element name to be used for a particular property or field. Serialization via SoapFormatter/BinaryFormatter can also be controlled to some extent by attributes. For example, the [NonSerialized] attribute is the equivalent of XmlSerializer's [XmlIgnore] attribute. Ultimate control of the serialization process can be acheived by implementing the the ISerializable interface on the class whose instances are to be serialized. 49.Can I customise the serialization process?
  • 51. CLS is a set of basic rules, which must be followed by each .NET language to be a .NET- compliant language. It enables interoperability between two .NET-compliant languages. CLS is a subset of CTS; therefore, the languages supported by CLS can use each other's class libraries similar to their own. Application programming interfaces (APIs), which are designed by following the rules defined in CLS can be used by all .NET-compliant languages. 50.What is Common Language Specification (CLS)?
  • 52. To know more details on dot net click https://bigclasses.com/dot-net-online- training.html and call us:- +91 800 811 4040 For regular Updates on dot net please like our Facebook page:- Facebook:- https://www.facebook.com/bigclasses/ Twitter:- https://twitter.com/bigclasses LinkedIn:- https://www.linkedin.com/company/bigclasses Google+: https://plus.google.com/+Bigclassesonline DOT NET Course Page:- https://bigclasses.com/dot-net-online-training.html Contact us: - India +91 800 811 4040 USA +1 732 325 1626 Email us at: - info@bigclasses.com