Вы находитесь на странице: 1из 26

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 crosslanguage integration, type safety, and high performance code execution. The rules defined in
CTS can be used to define your own classes and values.
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 portable executable (PE)?
PE is 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.
What is an application domain?
Application domain is the boundary within which an application runs. A process can contain
multiple application domains. Application domains provide an isolated environment to
applications that is similar to the isolation provided by processes. An application running inside
one application domain cannot directly access the code running inside another application
domain. To access the code running in another application domain, an application needs to use a
proxy.
How does an AppDomain get created?
AppDomains are usually created by hosts. Examples of hosts are the Windows Shell, ASP.NET
and IE. When you run a .NET application from the command-line, the host is the Shell. The Shell
creates a new AppDomain for every application. AppDomains can also be explicitly created by
.NET applications.
What is an assembly?
An assembly is a collection of one or more .exe or dlls. An assembly is the fundamental unit for
application development and deployment in the .NET Framework. An assembly contains a
collection of types and resources that are built to work together and form a logical unit of
functionality. An assembly provides the CLR with the information it needs to be aware of type
implementations.
What are the contents of assembly?
A static assembly can consist of four elements:

Assembly manifest - Contains the assembly metadata. An assembly manifest contains the
information about the identity and version of the assembly. It also contains the information
required to resolve references to types and resources.

Type metadata - Binary information that describes a program.

Microsoft intermediate language (MSIL) code.

A set of resources.
What are the different types of assembly?
Assemblies can also be private or shared. A private assembly is installed in the installation
directory of an application and is accessible to that application only. On the other hand, a shared
assembly is shared by multiple applications. A shared assembly has a strong name and is
installed in the GAC.
We also have satellite assemblies that are often used to deploy language-specific resources for
an application.
What is a dynamic assembly?
A dynamic assembly is created dynamically at run time when an application requires the types
within these assemblies.
What is a strong name?
You need to assign a strong name to an assembly to place it in the GAC and make it globally
accessible. A strong name consists of a name that consists of an assembly's identity (text name,
version number, and culture information), a public key and a digital signature generated over the
assembly. The .NET Framework provides a tool called the Strong Name Tool (Sn.exe), which
allows verification and key pair and signature generation.
What is GAC? What are the steps to create an assembly and add it to the GAC?
The global assembly cache (GAC) is a machine-wide code cache that stores assemblies
specifically designated to be shared by several applications on the computer. You should share
assemblies by installing them into the global assembly cache only when you need to.
Steps
- Create a strong name using sn.exe tool eg: sn -k mykey.snk
- in AssemblyInfo.cs, add the strong name eg: [assembly: AssemblyKeyFile("mykey.snk")]

- recompile project, and then install it to GAC in two ways :

drag & drop it to assembly folder (C:\WINDOWS\assembly OR C:\WINNT\assembly)


(shfusion.dll tool)

gacutil -i abc.dll
What is the caspol.exe tool used for?
The caspol tool grants and modifies permissions to code groups at the user policy, machine
policy, and enterprise policy levels.
What is a garbage collector?
A garbage collector performs periodic checks on the managed heap to identify objects that are
no longer required by the program and removes them from memory.
What are generations and how are they used by the garbage collector?
Generations are the division of objects on the managed heap used by the garbage collector. This
mechanism allows the garbage collector to perform highly optimized garbage collection. The
unreachable objects are placed in generation 0, the reachable objects are placed in generation
1, and the objects that survive the collection process are promoted to higher generations.
What is Ilasm.exe used for?
Ilasm.exe is a tool that generates PE files from MSIL code. You can run the resulting executable
to determine whether the MSIL code performs as expected.
What is Ildasm.exe used for?
Ildasm.exe is a tool that takes a PE file containing the MSIL code as a parameter and creates a
text file that contains managed code.
What is the ResGen.exe tool used for?
ResGen.exe is a tool that is used to convert resource files in the form of .txt or .resx files to
common language runtime binary .resources files that can be compiled into satellite assemblies.
Intermediate Level
What is ASP.NET?
Microsoft ASP.NET is a server side technology that enables programmers to build dynamic Web
sites, web applications, and XML Web services. It is a part of the .NET based environment and is
built on the Common Language Runtime (CLR) . So programmers can write ASP.NET code using
any .NET compatible language.
What are the differences between ASP.NET 1.1 and ASP.NET 2.0?
A comparison chart containing the differences between ASP.NET 1.1 and ASP.NET 2.0 can be
found over here.
Which is the latest version of ASP.NET? What were the previous versions released?
The latest version of ASP.NET is 2.0. There have been 3 versions of ASP.NET released as of
date. They are as follows :
ASP.NET 1.0 Released on January 16, 2002.
ASP.NET 1.1 Released on April 24, 2003.
ASP.NET 2.0 Released on November 7, 2005.
Additionally, ASP.NET 3.5 is tentatively to be released by the end of the 2007.
Explain the Event Life cycle of ASP.NET 2.0?
The events occur in the following sequence. Its best to turn on tracing(<% @Page
Trace=true%>) and track the flow of events :
PreInit This event represents the entry point of the page life cycle. If you need to change the
Master page or theme programmatically, then this would be the event to do so. Dynamic controls
are created in this event.
Init Each control in the control collection is initialized.
Init Complete* - Page is initialized and the process is completed.
PreLoad* - This event is called before the loading of the page is completed.
Load This event is raised for the Page and then all child controls. The controls properties and
view state can be accessed at this stage. This event indicates that the controls have been fully
loaded.

LoadComplete* - This event signals indicates that the page has been loaded in the memory. It
also marks the beginning of the rendering stage.
PreRender If you need to make any final updates to the contents of the controls or the page,
then use this event. It first fires for the page and then for all the controls.
PreRenderComplete* - Is called to explicitly state that the PreRender phase is completed.
SaveStateComplete* - In this event, the current state of the control is completely saved to the
ViewState.
Unload This event is typically used for closing files and database connections. At times, it is
also used for logging some wrap-up tasks.
The events marked with * have been introduced in ASP.NET 2.0.
You have created an ASP.NET Application. How will you run it?
With ASP.NET 2.0, Visual Studio comes with an inbuilt ASP.NET Development Server to test your
pages. It functions as a local Web server. The only limitation is that remote machines cannot
access pages running on this local server. The second option is to deploy a Web application to a
computer running IIS version 5 or 6 or 7.
Explain the AutoPostBack feature in ASP.NET?
AutoPostBack allows a control to automatically postback when an event is fired. For eg: If we
have a Button control and want the event to be posted to the server for processing, we can set
AutoPostBack = True on the button.
How do you disable AutoPostBack?
Hence the AutoPostBack can be disabled on an ASP.NET page by disabling AutoPostBack on all
the controls of a page. AutoPostBack is caused by a control on the page.
What are the different code models available in ASP.NET 2.0?
There are 2 code models available in ASP.NET 2.0. One is the single-file page and the other one
is the code behind page.
Which base class does the web form inherit from?
Page class in the System.Web.UI namespace.
Which are the new special folders that are introduced in ASP.NET 2.0?
There are seven new folders introduced in ASP.NET 2.0 :
\App_Browsers folder Holds browser definitions(.brower) files which identify the browser and
their capabilities.
\App_Code folder Contains source code (.cs, .vb) files which are automatically compiled when
placed in this folder. Additionally placing web service files generates a proxy class(out of .wsdl)
and a typed dataset (out of .xsd).
\App_Data folder Contains data store files like .mdf (Sql Express files), .mdb, XML files etc.
This folder also stores the local db to maintain membership and role information.
\App_GlobalResources folder Contains assembly resource files (.resx) which when placed in
this folder are compiled automatically. In earlier versions, we were required to manually use the
resgen.exe tool to compile resource files. These files can be accessed globally in the application.
\App_LocalResources folder Contains assembly resource files (.resx) which can be used by a
specific page or control.
\App_Themes folder This folder contains .css and .skin files that define the appearance of web
pages and controls.
\App_WebReferences folder Replaces the previously used Web References folder. This folder
contains the .disco, .wsdl, .xsd files that get generated when accessing remote web services.
Explain the ViewState in ASP.NET?
Http is a stateless protocol. Hence the state of controls is not saved between postbacks.
Viewstate is the means of storing the state of server side controls between postbacks. The
information is stored in HTML hidden fields. In other words, it is a snapshot of the contents of a
page.
You can disable viewstate by a control by setting the EnableViewState property to false.
What does the EnableViewState property signify?
EnableViewState saves the state of an object in a page between postbacks. Objects are saved
in a Base64 encoded string. If you do not need to store the page, turn it off as it adds to the page
size.
There is an excellent article by Peter Bromberg to understand Viewstate in depth.

Explain the ASP.NET Page Directives?


Page directives configure the runtime environment that will execute the page. The complete list
of directives is as follows:
@ Assembly - Links an assembly to the current page or user control declaratively.
@ Control - Defines control-specific attributes used by the ASP.NET page parser and compiler
and can be included only in .ascx files (user controls).
@ Implements - Indicates that a page or user control implements a specified .NET Framework
interface declaratively.
@ Import - Imports a namespace into a page or user control explicitly.
@ Master - Identifies a page as a master page and defines attributes used by the ASP.NET page
parser and compiler and can be included only in .master files.
@ MasterType - Defines the class or virtual path used to type the Master property of a page.
@ OutputCache - Controls the output caching policies of a page or user control declaratively.
@ Page - Defines page-specific attributes used by the ASP.NET page parser and compiler and
can be included only in .aspx files.
@ PreviousPageType - Creates a strongly typed reference to the source page from the target of
a cross-page posting.
@ Reference - Links a page, user control, or COM control to the current page or user control
declaratively.
@ Register - Associates aliases with namespaces and classes, which allow user controls and
custom server controls to be rendered when included in a requested page or user control.
This list has been taken from here.
Explain the Validation Controls used in ASP.NET 2.0?
Validation controls allows you to validate a control against a set of rules. There are 6 different
validation controls used in ASP.NET 2.0.
RequiredFieldValidator Checks if the control is not empty when the form is submitted.
CompareValidator Compares the value of one control to another using a comparison operator
(equal, less than, greater than etc).
RangeValidator Checks whether a value falls within a given range of number, date or string.
RegularExpressionValidator Confirms that the value of a control matches a pattern defined by
a regular expression. Eg: Email validation.
CustomValidator Calls your own custom validation logic to perform validations that cannot be
handled by the built in validators.
ValidationSummary Show a summary of errors raised by each control on the page on a specific
spot or in a message box.
How do you indentify that the page is post back?
By checking the IsPostBack property. If IsPostBack is True, the page has been posted back.
What are Master Pages?
Master pages is a template that is used to create web pages with a consistent layout throughout
your application. Master Pages contains content placeholders to hold page specific content.
When a page is requested, the contents of a Master page are merged with the content page,
thereby giving a consistent layout.
How is a Master Page different from an ASP.NET page?
The MasterPage has a @Master top directive and contains ContentPlaceHolder server controls.
It is quiet similar to an ASP.NET page.
How do you attach an exisiting page to a Master page?
By using the MasterPageFile attribute in the @Page directive and removing some markup.
How do you set the title of an ASP.NET page that is attached to a Master Page?
By using the Title property of the @Page directive in the content page. Eg:
<@Page MasterPageFile="Sample.master" Title="I hold content" %>
What is a nested master page? How do you create them?
A Nested master page is a master page associated with another master page. To create a
nested master page, set the MasterPageFile attribute of the @Master directive to the name of
the .master file of the base master page.
What are Themes?
Themes are a collection of CSS files, .skin files, and images. They are text based style

definitions and are very similar to CSS, in that they provide a common look and feel throughout
the website.
What are skins?
A theme contains one or more skin files. A skin is simply a text file with a .skin extension and
contains definition of styles applied to server controls in an ASP.NET page. For eg:
<asp:button runat="server" BackColor="blue" BorderColor="Gray" Font-Bold ="true"
ForeColor="white"/>
Defines a skin that will be applied to all buttons throughout to give it a consistent look and feel.
What is the difference between Skins and Css files?
Css is applied to HTML controls whereas skins are applied to server controls.
What is a User Control?
User controls are reusable controls, similar to web pages. They cannot be accessed directly.
Explain briefly the steps in creating a user control?

Create a file with .ascx extension and place the @Control directive at top of the page.

Included the user control in a Web Forms page using a @Register directive
What is a Custom Control?
Custom controls are compiled components that run on the server and that encapsulate userinterface and other related functionality into reusable packages. They can include all the designtime features of standard ASP.NET server controls, including full support for Visual Studio design
features such as the Properties window, the visual designer, and the Toolbox.
What are the differences between user and custom controls?
User controls are easier to create in comparison to custom controls, however user controls can
be less convenient to use in advanced scenarios.
User controls have limited support for consumers who use a visual design tool whereas custom
controls have full visual design tool support for consumers.
A separate copy of the user control is required in each application that uses it whereas only a
single copy of the custom control is required, in the global assembly cache, which makes
maintenance easier.
A user control cannot be added to the Toolbox in Visual Studio whereas custom controls can be
added to the Toolbox in Visual Studio.
User controls are good for static layout whereas custom controls are good for dynamic layout.
Where do you store your connection string information?
The connection string can be stored in configuration files (web.config).
What is the difference between Web.config and Machine.config?
Web.config files are used to apply configuration settings to a particular web application whereas
machine.config file is used to apply configuration settings for all the websites on a web server.
Web.config files are located in the application's root directory or inside a folder situated in a lower
hierarchy. The machine.config is located in the Windows directory
Microsoft.Net\Framework\Version\CONFIG.
There can be multiple web.config files in an application nested at different hierarchies. However
there can be only one machine.config file on a web server.
What is the difference between Server.Transfer and Response.Redirect?
Response.Redirect involves a roundtrip to the server whereas Server.Transfer conserves server
resources by avoiding the roundtrip. It just changes the focus of the webserver to a different
page and transfers the page processing to a different page.
Response.Redirect can be used for both .aspx and html pages whereas Server.Transfer can be
used only for .aspx pages.
Response.Redirect can be used to redirect a user to an external websites. Server.Transfer can
be used only on sites running on the same server. You cannot use Server.Transfer to redirect the
user to a page running on a different server.
Response.Redirect changes the url in the browser. So they can be bookmarked. Whereas
Server.Transfer retains the original url in the browser. It just replaces the contents of the previous
page with the new one.
What method do you use to explicitly kill a users session?
Session.Abandon().
What is a webservice?

Web Services are applications delivered as a service on the Web. Web services allow for
programmatic access of business logic over the Web. Web services typically rely on XML-based
protocols, messages, and interface descriptions for communication and access. Web services
are designed to be used by other programs or applications rather than directly by end user.
Programs invoking a Web service are called clients. SOAP over HTTP is the most commonly
used protocol for invoking Web services.
General Question
What is a base class and derived class?
A class is a template for creating an object. The class from which other classes derive
fundamental functionality is called a base class. For e.g. If Class Y derives from Class X, then
Class X is a base class.
The class which derives functionality from a base class is called a derived class. If Class Y
derives from Class X, then Class Y is a derived class.
What is an extender class?
An extender class allows you to extend the functionality of an existing control. It is used in
Windows forms applications to add properties to controls.
A demonstration of extender classes can be found over here.
What is inheritance?
Inheritance represents the relationship between two classes where one type derives functionality
from a second type and then extends it by adding new methods, properties, events, fields and
constants.
C# support two types of inheritance:

Implementation inheritance

Interface inheritance
What is implementation and interface inheritance?
When a class (type) is derived from another class(type) such that it inherits all the members of
the base type it is Implementation Inheritance.
When a type (class or a struct) inherits only the signatures of the functions from another type it is
Interface Inheritance.
In general Classes can be derived from another class, hence support Implementation
inheritance. At the same time Classes can also be derived from one or more interfaces. Hence
they support Interface inheritance.
Source: Exforsys.
What is inheritance hierarchy?
The class which derives functionality from a base class is called a derived class. A derived class
can also act as a base class for another class. Thus it is possible to create a tree-like structure
that illustrates the relationship between all related classes. This structure is known as the
inheritance hierarchy.
How do you prevent a class from being inherited?
In VB.NET you use the NotInheritable modifier to prevent programmers from using the class as a
base class. In C#, use the sealed keyword.
When should you use inheritance?
Read this.
Define Overriding?
Overriding is a concept where a method in a derived class uses the same name, return type, and
arguments as a method in its base class. In other words, if the derived class contains its own
implementation of the method rather than using the method in the base class, the process is
called overriding.
Can you use multiple inheritance in .NET?
.NET supports only single inheritance. However the purpose is accomplished using multiple
interfaces.
Why dont we have multiple inheritance in .NET?

There are several reasons for this. In simple words, the efforts are more, benefits are less.
Different languages have different implementation requirements of multiple inheritance. So in
order to implement multiple inheritance, we need to study the implementation aspects of all the
languages that are CLR compliant and then implement a common methodology of implementing
it. This is too much of efforts. Moreover multiple interface inheritance very much covers the
benefits that multiple inheritance has.
What is an Interface?
An interface is a standard or contract that contains only the signatures of methods or events. The
implementation is done in the class that inherits from this interface. Interfaces are primarily used
to set a common standard or contract.
When should you use abstract class vs interface or What is the difference between an abstract
class and interface?
I would suggest you to read this. There is a good comparison given over here.
What are events and delegates?
An event is a message sent by a control to notify the occurrence of an action. However it is not
known which object receives the event. For this reason, .NET provides a special type called
Delegate which acts as an intermediary between the sender object and receiver object.
What is business logic?
It is the functionality which handles the exchange of information between database and a user
interface.
What is a component?
Component is a group of logically related classes and methods. A component is a class that
implements the IComponent interface or uses a class that implements IComponent interface.
What is a control?
A control is a component that provides user-interface (UI) capabilities.
What are the differences between a control and a component?
The differences can be studied over here.
What are design patterns?
Design patterns are common solutions to common design problems.
What is a connection pool?
A connection pool is a collection of connections which are shared between the clients
requesting one. Once the connection is closed, it returns back to the pool. This allows the
connections to be reused.
What is a flat file?
A flat file is the name given to text, which can be read or written only sequentially.
What are functional and non-functional requirements?
Functional requirements defines the behavior of a system whereas non-functional requirements
specify how the system should behave; in other words they specify the quality requirements and
judge the behavior of a system.
E.g.
Functional - Display a chart which shows the maximum number of products sold in a region.
Non-functional The data presented in the chart must be updated every 5 minutes.
What is the global assembly cache (GAC)?
GAC is a machine-wide cache of assemblies that allows .NET applications to share libraries.
GAC solves some of the problems associated with dlls (DLL Hell).
What is a stack? What is a heap? Give the differences between the two?
Stack is a place in the memory where value types are stored. Heap is a place in the memory
where the reference types are stored.
Check this link for the differences.
What is instrumentation?
It is the ability to monitor an application so that information about the applications progress,
performance and status can be captured and reported.
What is code review?
The process of examining the source code generally through a peer, to verify it against best
practices.

What is logging?
Logging is the process of persisting information about the status of an application.
What are mock-ups?
Mock-ups are a set of designs in the form of screens, diagrams, snapshots etc., that helps verify
the design and acquire feedback about the applications requirements and use cases, at an early
stage of the design process.
What is a Form?
A form is a representation of any window displayed in your application. Form can be used to
create standard, borderless, floating, modal windows.
What is a multiple-document interface(MDI)?
A user interface container that enables a user to work with more than one document at a time.
E.g. Microsoft Excel.
What is a single-document interface (SDI) ?
A user interface that is created to manage graphical user interfaces and controls into single
windows. E.g. Microsoft Word
What is BLOB ?
A BLOB (binary large object) is a large item such as an image or an exe represented in binary
form.
What is ClickOnce?
ClickOnce is a new deployment technology that allows you to create and publish self-updating
applications that can be installed and run with minimal user interaction.
What is object role modeling (ORM) ?
It is a logical model for designing and querying database models. There are various ORM tools in
the market like CaseTalk, Microsoft Visio for Enterprise Architects, Infagon etc.
What is a private assembly?
A private assembly is local to the installation directory of an application and is used only by that
application.
What is a shared assembly?
A shared assembly is kept in the global assembly cache (GAC) and can be used by one or more
applications on a machine.
What is the difference between user and custom controls?
User controls are easier to create whereas custom controls require extra effort.
User controls are used when the layout is static whereas custom controls are used in dynamic
layouts.
A user control cannot be added to the toolbox whereas a custom control can be.
A separate copy of a user control is required in every application that uses it whereas since
custom controls are stored in the GAC, only a single copy can be used by all applications.
Where do custom controls reside?
In the global assembly cache (GAC).
What is a third-party control ?
A third-party control is one that is not created by the owners of a project. They are usually used
to save time and resources and reuse the functionality developed by others (third-party).
What is a binary formatter?
Binary formatter is used to serialize and deserialize an object in binary format.
What is Boxing/Unboxing?
Boxing is used to convert value types to object.
E.g. int x = 1;
object obj = x ;
Unboxing is used to convert the object back to the value type.
E.g. int y = (int)obj;
Boxing/unboxing is quiet an expensive operation.
What is a COM Callable Wrapper (CCW)?
CCW is a wrapper created by the common language runtime(CLR) that enables COM
components to access .NET objects.
What is a Runtime Callable Wrapper (RCW)?
RCW is a wrapper created by the common language runtime(CLR) to enable .NET components

to call COM components.


What is a digital signature?
A digital signature is an electronic signature used to verify/gurantee the identity of the individual
who is sending the message.
What is garbage collection?
Garbage collection is the process of managing the allocation and release of memory in your
applications. Read this article for more information.
What is globalization?
Globalization is the process of customizing applications that support multiple cultures and
regions.
What is localization?
Localization is the process of customizing applications that support a given culture and regions.
What is MIME?
The definition of MIME or Multipurpose Internet Mail Extensions as stated in MSDN is MIME is a
standard that can be used to include content of various types in a single message. MIME
extends the Simple Mail Transfer Protocol (SMTP) format of mail messages to include multiple
content, both textual and non-textual. Parts of the message may be images, audio, or text in
different character sets. The MIME standard derives from RFCs such as 2821 and 2822. Quoted
from here.
What is Ajax?
The term Ajax was coined by Jesse James Garrett and is a short form for "Asynchronous
Javascript and XML". Ajax represents a set of commonly used techniques, like HTML/XHTML,
CSS, Document Object Model(DOM), XML/XSLT, Javascript and the XMLHttpRequest object, to
create RIA's (Rich Internet Applications).
Ajax gives the user, the ability to dynamically and asynchronously interact with a web server,
without using a plug-in or without compromising on the users ability to interact with the page.
This is possible due to an object found in browsers called the XMLHttpRequest object.
What is ASP.NET AJAX?
ASP.NET AJAX is a terminology coined by Microsoft for their implementation of AJAX, which is
a set of extensions to ASP.NET. These components allow you to build rich AJAX enabled web
applications, which consists of both server side and client side libraries.
Which is the current version of ASP.NET AJAX Control Toolkit?
As of this writing, the toolkit version is Version 1.0.20229 (if you are targeting Framework 2.0,
ASP.NET AJAX 1.0 and Visual Studio 2005) and Version 3.0.20229 (if targeting .NET Framework
3.5 and Visual Studio 2008).
What role does the ScriptManager play?
The ScriptManager manages all ASP.NET AJAX resources on a page and renders the links for
the ASP.NET AJAX client libraries, which lets you use AJAX functionality like PageMethods,
UpdatePanels etc. It creates the PageRequestManager and Application objects, which are
prominent in raising events during the client life cycle of an ASP.NET AJAX Web page. It also
helps you create proxies to call web services asynchronously.
Can we use multiple ScriptManager on a page?
No. You can use only one ScriptManager on a page.
What is the role of a ScriptManagerProxy?
A page can contain only one ScriptManager control. If you have a Master-Content page scenario
in your application and the MasterPage contains a ScriptManager control, then you can use the
ScriptManagerProxy control to add scripts to content pages.
Also, if you come across a scenario where only a few pages in your application need to register
to a script or a web service, then its best to remove them from the ScriptManager control and
add them to individual pages, by using the ScriptManagerProxy control. That is because if you
added the scripts using the ScriptManager on the Master Page, then these items will be
downloaded on each page that derives from the MasterPage, even if they are not needed, which
would lead to a waste of resources.
What are the requirements to run ASP.NET AJAX applications on a server?

You would need to install ASP.NET AJAX Extensions on your server. If you are using the
ASP.NET AJAX Control toolkit, then you would also need to add the AjaxControlToolkit.dll in
the /Bin folder.
Note: ASP.NET AJAX 1.0 was available as a separate downloadable add-on for ASP.NET 2.0.
With ASP.NET 3.5, the AJAX components have been integrated into ASP.NET.
Explain the UpdatePanel?
The UpdatePanel enables you to add AJAX functionality to existing ASP.NET applications. It can
be used to update content in a page by using Partial-page rendering. By using Partial-page
rendering, you can refresh only a selected part of the page instead of refreshing the whole page
with a postback.
Can I use ASP.NET AJAX with any other technology apart from ASP.NET?
To answer this question, check out this example of using ASP.NET AJAX with PHP, to
demonstrate running ASP.NET AJAX outside of ASP.NET. Client-Side ASP.NET AJAX framework
can be used with PHP and Coldfusion.
How can you cancel an Asynchronous postback?
Yes you can. Read my article over here.
Difference between Server-Side AJAX framework and Client-side AJAX framework?
ASP.NET AJAX contains both a server-side Ajax framework and a client-side Ajax framework.
The server-side framework provides developers with an easy way to implement Ajax
functionality, without having to possess much knowledge of JavaScript. The framework includes
server controls and components and the drag and drop functionality. This framework is usually
preferred when you need to quickly ajaxify an asp.net application. The disadvantage is that you
still need a round trip to the server to perform a client-side action.
The Client-Side Framework allows you to build web applications with rich user-interactivity as
that of a desktop application. It contains a set of JavaScript libraries, which is independent from
ASP.NET. The library is getting rich in functionality with every new build released.
How can you debug ASP.NET AJAX applications?
Explain about two tools useful for debugging: Fiddler for IE and Firebug for Mozilla.
Can we call Server-Side code (C# or VB.NET code) from javascript?
Yes. You can do so using PageMethods in ASP.NET AJAX or using webservices.
Can you nest UpdatePanel within each other?
Yes, you can do that. You would want to nest update panels to basically have more control over
the Page Refresh.
How can you to add JavaScript to a page when performing an asynchronous postback?
Use the ScriptManager class. This class contains several methods like the
RegisterStartupScript(), RegisterClientScriptBlock(), RegisterClientScriptInclude(),
RegisterArrayDeclaration(),RegisterClientScriptResource(), RegisterExpandoAttribute(),
RegisterOnSubmitStatement() which helps to add javascript while performing an asynchronous
postback.
Explain differences between the page execution lifecycle of an ASP.NET page and an ASP.NET
AJAX page?
In an asynchronous model, all the server side events occur, as they do in a synchronous model.
The Microsoft AJAX Library also raises client side events. However when the page is rendered,
asynchronous postback renders only the contents of the update panel, where as in a
synchronous postback, the entire page is recreated and sent back to the browser.
Explain the AJAX Client life-cycle events
Heres a good article about the same.
Is the ASP.NET AJAX Control Toolkit(AjaxControlToolkit.dll) installed in the Global
Assembly Cache?
No. You must copy the AjaxControlToolkit.dll assembly to the /Bin folder in your application.
Those were some frequently asked questions you should have knowledge about. In one of the
coming articles, we will cover some more ASP.NET AJAX FAQs which were not covered in this
article. I hope this article was useful and I thank you for viewing it.
Q. What are the major improvements provided by the common language runtime and the
base class libraries?

Ans. Brief about the Improvements Diagnostics and Performance - Starting with the .NET Framework 4, you can get processor
usage and memory usage estimates per application domain.
Garbage Collection - This feature replaces concurrent garbage collection in previous versions
and provides better performance.
Code Contracts - Code contracts let you specify contractual information that is not represented
by a method's or type's signature alone. The new System.Diagnostics.Contracts namespace
contains classes that provide a language-neutral way to express coding assumptions in the form
of preconditions, postconditions, and object invariants.
Design-Time-Only Interop Assemblies - You no longer have to ship primary interop assemblies
(PIAs) to deploy applications that interoperate with COM objects. In the .NET Framework 4,
compilers can embed type information from interop assemblies, selecting only the types that an
application (for example, an add-in) actually uses.
Dynamic Language Runtime - The dynamic language runtime (DLR) is a new runtime
environment that adds a set of services for dynamic languages to the CLR. The DLR makes it
easier to develop dynamic languages to run on the .NET Framework and to add dynamic
features to statically typed languages. To support the DLR, the new System.Dynamic namespace
is added to the .NET Framework.
Covariance and Contravariance - Several generic interfaces and delegates now support
covariance and contravariance.
BigInteger and Complex Numbers - The new System.Numerics.BigInteger structure is an integer
data type that can store fairly large number as it has no upper and lower bound values.Complex
types represents a complex number of form a + bi. IT supports arithmetic and trigonometric
operations with complex numbers.
Tuples - The .NET Framework 4 provides the System..::.Tuple class for creating tuple objects
that contain structured data.
File System Enumeration Improvements - You can now enumerate directories and files by using
methods that return an enumerable collection of strings of their names.ou can also use methods
that return an enumerable collection of DirectoryInfo, FileInfo, or FileSystemInfo objects.
Memory-Mapped Files - A memory-mapped file contains the contents of a file in virtual memory
and is an applications logical address space. So You can use memory-mapped files to edit very
large files and to create shared memory for interprocess communication.
64-Bit Operating Systems and Processes - You can identify 64-bit operating systems and
processes with the Environment.Is64BitOperatingSystem and Environment.Is64BitProcess
properties.
Q. How would you Deploy your old applications with .Net Framework 4.0? Are the Old
applications compatible?
Ans. .NET Framework 4 is highly compatible with applications that are built with earlier .NET
Framework versions. Though Some Changes have been made to improve security, standards
compliance, correctness, reliability, and performance.
To run older applications with .NET Framework 4, you will have to re-compile your applications

with the target .NET Framework version specified in the properties for your project in Visual
Studio Or you can specify the supported runtime with the Element in an application configuration
file. .Net Framework 4 does not automatically use its version of the common language runtime to
run applications that are built with earlier versions of the .NET Framework.
Q. Whts is Parallel Computing?
Ans. To take advantage of multiple cores (that is, CPUs or processors) you can parallelize your
code so that it will be distributed across multiple processors. In the past, parallelization required
low-level manipulation of threads and locks, but Visual Studio 2010 and the .NET Framework 4
enhances the support for parallel programming by providing a new runtime, new class library
types, and new diagnostic tools. These features simplify parallel development so that you can
write efficient, fine-grained, and scalable parallel code in a natural idiom without having to work
directly with threads or the thread pool.
The new System.Threading.Tasks namespace and other related types support this new model.
Q. What is BigInteger and When would you use that?
Ans. BigInteger, which is a part of System.Numerics Namespace is a great enhancement over
Byte and Int32 datatypes. It is a nonprimitive integral type that supports arbitrarily large signed
integers. Unlike Byte and Int32 types, BigInteger does not include a Minvalue and MaxValue
property, so can be used to store large integer values.
Q. What other than BigInteger has been introduced in System.Numerics Namespace?
Ans. Complex types,which represents a complex number has been Introduced. a complex
number is a number in the form a + bi, where a is the real part, and b is the imaginary part.
Q. How do you assign a Value to a Complex Number.
Ans. You can assign a value to a complex number in few different ways.
1. By passing two Double values to its constructor. The first value represents the real part of the
complex number, and the second value represents its imaginary part.
2. By assigning a Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Single, or Double value
to a Complex object. The value becomes the real part of the complex number, and its imaginary
part equals 0.
E.g Complex c1 = new Complex(12, 6);
Console.WriteLine(c1);
OutPut - (12, 6)
Q. How has exception hand changed in .Net Framework 4.0
Ans. A New Namespace System.Runtime.ExceptionServices has been introduced which provides
classes for advanced exception handling. It has introduced the following classes
1. HandleProcessCorruptedStateExceptionsAttribute Class - Enables managed code to handle
exceptions that indicate a corrupted process state.So,If you want to compile an application in
the .NET Framework 4 and handle corrupted state exceptions, you can apply this attribute to the
method that handles the corrupted state exception.
2.FirstChanceExceptionEventArgs Class -Provides data for the notification event that is raised

when a managed exception first occurs, before the common language runtime begins searching
for event handlers.
Agile Project Management Tips, Agile Software Development Tips
Free e-Book on Asp.Net Architecture, Performance & Scalability
I found a Free E-Book on Asp.Net Web Application Architecture, written by .Net Experts from
Microsoft. An essential reading for every .NET Developer & Architect.
This free e-Book provides deep Guidelines about
* How to Design Scalable, High Performance .Net & Asp.Net Web Applications
* To help integrate performance engineering throughout your application life cycle
* To provide deep performance-related technical guidance on the .NET Framework.
* How to Scale Database with SQL Server.
I found it Very Nice for ASP.Net Web Application Architects.
You can download it at
---------------------------------------------------------------------------ASP.NET Architecture Best Practices: Download Free E-Book
--------------------------------------------------------------------------5 comments
Tags: ASP.NET Architecture, Asp.Net Performance Tips
ASP.NET 3.5 with VS 2008
I found a good presentation on new features in Asp.NET 3.5 with VS 2008 and journey from Asp,
Asp.NET 1.1 to Asp.NET 3.5 with Visual studio 2008.
Visual studio 2008 completely replaces VS 2005. It provides new features like JavaScript
intellisense, JavaScript debugging and new CSS editor, and also Unit test automation tools
.NET 3.5 built on top of 2.0 and 3.0. In it, Membership, Role, and Personalization framework
exposed as web services.
Language Integrated Querying (LINQ), Native support for latest web protocols (RSS, JSON, etc)
are some exciting features. Here is complete presentation.
5 comments
Tags: ASP.NET 3.5
Difference between DataList and Repeater controls
Asp.Net Interview Question
What is the difference between DataList and Repeater data binding controls?
Answer: The DataList control is similar to the Repeater control. However, it has some additional

properties and templates that you can use to display its data in a diverse fashion. The Repeater
control does not have any built-in layout or style. We are forced to specify all formatting-related
HTML elements and style tags. On the other hand, a DataList control provides more flexibility to
display data in a desired layout. It also provides data selection and editing capabilities. How does
it do it? Well, in addition to the five templates (Item Template, AlternatingItem Template,
Separator Template, Header Template, Footer Template that a repeater has, the DataList control
has two more templates: SelectedItemTemplate, and EditItemTemplate. These templates are
useful for allowing data selection and data editing functionalities.
Furthermore, the RepeatDirection and RepeatColumns properties of a DataList control can be
exploited to lay out the data in horizontal or vertical fashions.
11 comments
Tags: ASP.NET Controls, Interview Question Answer
Aggregate Functions in SQL SERVER 2008
What are Aggregate functions? Explain Aggregate functions in SQL SERVER 2008 with example.
Aggregate functions are applied to a group of data values from a column. Aggregate functions
always return a single value.
SQL SERVER 2008 / Transact-SQL supports following aggregate functions:
AVG: Calculates the arithmetic mean (average) of the data values contained within a column.
The column must contain numeric values.
MAX and MIN: Calculate the maximum and minimum data value of the column, respectively. The
column can contain numeric, string, and date/time values.
SUM: Calculates the total of all data values in a column. The column must contain numeric
values.
COUNT: Calculates the number of (non-null) data values in a column. The only aggregate
function not being applied to columns is COUNT(*). This function returns the number of rows
(whether or not particular columns have NULL values).
COUNT_BIG: New and Analogous to COUNT, the only difference being that COUNT_BIG returns
a value of the BIGINT data type.
Aggregate function Example:
SELECT ProjectName, SUM(budget) TotalBudget FROM Project_Tbl GROUP BY ProjectName;
More Questions? Ask in comments.
1 comments
Tags: Microsoft SQL Server 2008, sql query
SQL Server Basic Databases
SQL Server Interview Question. Name the Basic or Default Databases of SQL SERVER and
What are their functions and use.?

Microsoft SQL SERVER Provides 4 default databases


The Master database holds information for all databases located on the SQL Server instance and
is the glue that holds the engine together. Because SQL Server cannot start without a functioning
master database, you must administer this database with care.
The tempdb holds temporary objects such as global and local temporary tables and stored
procedures. The model is essentially a template database used in the creation of any new user
database created in the instance.
The msdb database stores information regarding database backups, SQL Agent information, DTS
packages, SQL Server jobs, and some replication information such as for log shipping.
More Database Questions? Please post in comments.
6 comments
Tags: Database, Microsoft SQL Server
SQL Server 2008 advantages for Developers
Microsoft has released a new version of its popular Database management system (SQL Server).
It is Microsoft SQL Server 2008. So what are the benefits of SQL SERVER 2008 for Developers
& Programmers.
SQL Management Studio improvements including IntelliSense.
New Data Types for just dates or times (no more storing time when you only need the date).
New Hierarchical data support .IsDescendent(), that can automatically pull a hierarchical view of
data (no more custom recursive queries).
New Grouping Sets statement which enables you to automatically group dimensions in a query
for easy aggregation and reporting.
New Merge statement which provides automatic insert/update semantics for keeping multiple
data sources in sync.
New data types and support for Geodata and geometry.
New support for optimizing "empty" or row/column tables using the sparse keyword.
New FileStream attribute that enables you to include files that are stored in the server file
system, but can be managed by SQL Server.
See SQL SERVER 2008 faqs at
Microsoft SQL SERVER 2008 question answers
2 comments

Tags: Microsoft SQL Server 2008


Value types VS Reference types C#
What is difference between Value types and Reference types in VB.NET or C# (Value types VS
Reference types)
C# provides two typesclass and struct, class is a reference type while the other is a value type.
Here is difference between Value types and Reference types.
Value types directly contain their data which are either allocated on the stack or allocated in-line
in a structure. Reference types store a reference to the value's memory address, and are
allocated on the heap. With reference types, an object is created in memory, and then handled
through a separate referencerather like a pointer.
Reference types can be self-describing types, pointer types, or interface types. Primitive types
such as int, float, bool and char are value types.
Variables that are value types each have their own copy of the data, and therefore operations on
one variable do not affect other variables. Variables that are reference types can refer to the
same object; therefore, operations on one variable can affect the same object referred to by
another variable.
Value types have a default implied constructor that initializes the default value. Reference types
default to a null reference in memory.
Value types derive from System.ValueType. Reference types derive from System.Object.
Value types cannot derive a new type from an existing value type, except for structs. Reference
types can derive a new type from an existing reference type as well as being able to implement
interfaces.
1 comments
Tags: C#, Microsoft .NET Framework
Now you can ask interview question
A new portal for developer community has been launched. Where you can ask any tech question
and get answer from tech experts. You can also discuss on any tech topic.
See ASP.Net interview questions discussion at
http://www.techbaba.com/faqs/asp.net+interview+question+answers.aspx
6 comments
Tags: Interview Question Answer
All type .Net faqs, interview questions & answers
http://www.dotnetinterviewfaqs.com/ is a new .Net website having all Microsoft related faqs,
interview questions & answers

To visit click http://www.dotnetinterviewfaqs.com/


4 comments
Tags: Interview Question Answer
Multiple - Language Development in .NET Framework
.NET Framework encourages cross-language development using multiple programming
languages. To become a .NET language, any language should have a compiler that translates
the source code written in different languages into Microsoft Intermediate Language (MSIL).
MSIL code is called as Managed Code. Managed code runs in .NET environment.
In .Net framework the Common Runtime Language (CLR) contains a couple of just-in-time
compilers (JIT) which can understand IL Code (managed Code), and can convert IL to native
code (binary code targeted at a specific machine processor).
Hence any language with IL Code generating compiler can become a .Net language
3 comments
Tags: Microsoft .NET Framework
Explain the delegates in C#.
Delegates in C# are objects which points towards a function which matches its signature.
Delegates are reference type used to encapsulate a method with a specific signature. Delegates
are similar to function pointers in C++; however, delegates are type-safe and secure.
Here are some features of delegates:
* A delegate represents a class.
* A delegate is type-safe.
* We can use delegates both for static and instance methods
* We can combine multiple delegates into a single delegate.
* Delegates are often used in event-based programming, such as publish/subscribe.
* We can use delegates in asynchronous-style programming.
* We can define delegates inside or outside of classes.
Syntax of using delegates
//Declaring delegate
delegate void SampleDelegate(string message);
// declare method with same signature:
static void SampleDelegateMethod(string message) { Console.WriteLine(message); }
// create delegate object
SampleDelegate d1 = SampleDelegateMethod;
// Invoke method with delegate
d1("my program");
3 comments
Tags: C#, Object Oriented Programming

What is the purpose of connection pooling in ADO.NET?


Connection pooling enables an application to use a connection from a pool of connections that
do not need to be re-established for each use. Once a connection has been created and placed
in a connection pool, an application can reuse that connection without performing the complete
connection creation process.
By default, the connection pool is created when the first connection with a unique connection
string connects to the database. The pool is populated with connections up to the minimum pool
size. Additional connections can be added until the pool reaches the maximum pool size.
When a user request a connection, it is returned from the pool rather than establishing new
connection and, when a user releases a connection, it is returned to the pool rather than being
released. But be sure than your connections use the same connection string each time. Here is
the Syntax
conn.ConnectionString = "integrated Security=SSPI; SERVER=192.168.0.123;
DATABASE=MY_DB; Min Pool Size=4;Max Pool Size=40;Connect Timeout=14;";
1 comments
Tags: ADO.NET
What is the difference between classes and structs in Microsoft.Net?
* A struct is a value type, while a class is a reference type.
* When we instantiate a class, memory will be allocated on the heap. When struct gets
initiated, it gets memory on the stack.
* Classes can have explicit parameter less constructors. But structs cannot have this.
* Classes support inheritance. But there is no inheritance for structs. A struct cannot inherit
from another struct or class, and it cannot be the base of a class. Like classes, structures can
implement interfaces.
* We can assign null variable to class. But we cannot assign null to a struct variable, since
structs are value type.
* We can declare a destructor in class but can not in struct.
3 comments
Tags: Object Oriented Programming
What is a Strong Name in Microsoft.Net?
In Microsoft.Net a strong name consists of the assembly's identity. The strong name guarantees
the integrity of the assembly. Strong Name includes the name of the .net assembly, version
number, culture identity, and a public key token. It is generated from an assembly file using the
corresponding private key.
Steps to create strong named assembly:
To create a strong named assembly you need to have a key pair (public key and a private key)
file. Use sn -k KeyFile.snk
Open the dot net project to be complied as a strong named assembly. Open AssembyInfo.cs/
AssembyInfo.vb file. Add the following lines to AssemblyInfo file.
[Assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("..\\..\\KeyFile.snk")]

Compile the application, we have created a strong named assembly.


2 comments
Tags: Microsoft .NET Framework
What is the use of XSLT?
XSLT stands for Extensible Stylesheet Language Transformations. This language used in XSL
style sheets to transform XML documents into other XML documents.
XSLT is based on template rules which specify how XML documents should be processed. An
XSLT processor reads both an XML document and an XSLT style sheet. Based on the
instructions the processor finds in the XSLT style sheet, it produce a new XML document. With
XSLT we can also produce HTML or XHTML from XML document. With XSLT we can
add/remove elements and attributes, rearrange and sort elements, hide and display elements
from the output file. Converting XML to HTML for display is probably the most common
application of XSLT today.
3 comments
Tags: XML
Explain ACID properties of the database?
All Database systems which include transaction support implement ACID properties to ensure
the integrity of the database. ACID stands for Atomicity, Consistency, Isolation and Durability
* Atomicity: Each transaction is said to be atomic. If one part of the transaction fails, the
entire transaction fails. Modifications on the data in the database either fail or succeed.
* Consistency: This property ensures that only valid data will be written to the database. If, for
some reason, a transaction is executed that violates the databases consistency rules, the entire
transaction will be rolled back and the database will be restored to a state consistent with those
rules.
* Isolation: It requires that multiple transactions occurring at the same time not impact each
others execution.
* Durability: It ensures that any transaction committed to the database will not be lost.
5 comments
Tags: Database
What is the basic functionality of Garbage Collector in Microsft.Net?
The Common Language Runtime (CLR) requires that you create objects in the managed heap,
but you do not have to bother with cleaning up the memory once the object goes out of the scope
or is no longer needed. The Microsoft .NET Framework Garbage Collector provides memory
management capabilities for managed resources. The Garbage Collector frees objects that are
not referenced and reclaims their memory. You should set your references to Nothing(null) as
soon as you are done with them to ensure your objects are eligible for collection as soon as
possible.
Here are the list of some tasks performed by the Garbage collector:
* Garbage collector reserves a piece of memory as the application starts for the managed
heap.
* Garbage collector controls the managed heap memory currently used and available to an

application.
* Garbage collector allocates memory for new objects within the application.
* The Garbage Collector attempts to reclaim the memory of objects that are not referenced.
1 comments
Tags: ASP.NET Architecture, Interview Question Answer, Microsoft .NET Framework
What is a static class?
We can declare a static class. We use static class when there is no data or behavior in the class
that depends on object identity. A static class can have only static members. We can not create
instances of a static class using the new keyword. .NET Framework common language runtime
(CLR) loads Static classes automatically when the program or namespace containing the class is
loaded.
Here are some more features of static class
* Static classes only contain static members.
* Static classes can not be instantiated. They cannot contain Instance Constructors
* Static classes are sealed.
2 comments
Tags: Object Oriented Programming
What is static member of class?
A static member belongs to the class rather than to the instances of the class. In C# data fields,
member functions, properties and events can be declared static. When any instances of the
class are created, they cannot be used to access the static member.
To access a static class member, use the name of the class instead of an instance variable
Static methods and Static properties can only access static fields and static events.
Like: int i = Car.GetWheels;
Here Car is class name and GetWheels is static property.
Static members are often used to represent data or calculations that do not change in response
to object state.
0 comments
Tags: Object Oriented Programming
What is the purpose of Server.MapPath method in Asp.Net?
In Asp.Net Server.MapPath method maps the specified relative or virtual path to the
corresponding physical path on the server. Server.MapPath takes a path as a parameter and
returns the physical location on the hard drive. Syntax
Suppose your Text files are located at D:\project\MyProject\Files\TextFiles
If the root project directory is MyProject and the aspx file is located at root then to get the same
path use code
//Physical path of TextFiles

string TextFilePath=Server.MapPath("Files/TextFiles");
OOP////////////////////////////////////////////////////////////////////////////
1) What is meant by Object Oriented Programming?
OOP is a method of programming in which programs are organised as cooperative collections
of objects. Each object is an instance of a class and each class belong to a hierarchy.
2) What is a Class?
Class is a template for a set of objects that share a common structure and a common
behaviour.
3) What is an Object?
Object is an instance of a class. It has state,behaviour and identity. It is also called as an
instance of a class.
4) What is an Instance?
An instance has state, behaviour and identity. The structure and behaviour of similar classes
are defined in their common class. An instance is also called as an object.
5) What are the core OOPs concepts?
Abstraction, Encapsulation,Inheritance and Polymorphism are the core OOPs concepts.
6) What is meant by abstraction?
Abstraction defines the essential characteristics of an object that distinguish it from all other
kinds of objects. Abstraction provides crisply-defined conceptual boundaries relative to the
perspective of the viewer. Its the process of focussing on the essential characteristics of an
object. Abstraction is one of the fundamental elements of the object model.
7) What is meant by Encapsulation?
Encapsulation is the process of compartmentalising the elements of an abtraction that defines
the structure and behaviour. Encapsulation helps to separate the contractual interface of an
abstraction and implementation.
8) What is meant by Inheritance?
Inheritance is a relationship among classes, wherein one class shares the structure or
behaviour defined in another class. This is called Single Inheritance. If a class shares the
structure or behaviour from multiple classes, then it is called Multiple Inheritance. Inheritance
defines is-a hierarchy among classes in which one subclass inherits from one or more
generalised superclasses.
9) What is meant by Polymorphism?
Polymorphism literally means taking more than one form. Polymorphism is a characteristic of
being able to assign a different behavior or value in a subclass, to something that was declared
in a parent class.
10) What is an Abstract Class?
Abstract class is a class that has no instances. An abstract class is written with the
expectation that its concrete subclasses will add to its structure and behaviour, typically by
implementing its abstract operations.
11) What is an Interface?
Interface is an outside view of a class or object which emphaizes its abstraction while hiding
its structure and secrets of its behaviour.
12) What is a base class?
Base class is the most generalised class in a class structure. Most applications have such
root classes. In Java, Object is the base class for all classes.
13) What is a subclass?
Subclass is a class that inherits from one or more classes
14) What is a superclass?
superclass is a class from which another class inherits.

15) What is a constructor?


Constructor is an operation that creates an object and/or initialises its state.
16) What is a destructor?
Destructor is an operation that frees the state of an object and/or destroys the object itself. In
Java, there is no concept of destructors. Its taken care by the JVM.
17) What is meant by Binding?
Binding denotes association of a name with a class.
18) What is meant by static binding?
Static binding is a binding in which the class association is made during compile time. This is
also called as Early binding.
19) What is meant by Dynamic binding?
Dynamic binding is a binding in which the class association is not made until the object is
created at execution time. It is also called as Late binding.
20) Define Modularity?
Modularity is the property of a system that has been decomposed into a set of cohesive and
loosely coupled modules.
21) What is meant by Persistence?
Persistence is the property of an object by which its existence transcends space and time.
22) What is colloboration?
Colloboration is a process whereby several objects cooperate to provide some higher level
behaviour.
23) In Java, How to make an object completely encapsulated?
All the instance variables should be declared as private and public getter and setter methods
should be provided for accessing the instance variables.
24) How is polymorphism acheived in java?
Inheritance, Overloading and Overriding are used to acheive Polymorphism in java.
Question : Can we call a base class method without creating instance?
Answer:
Yep. But ..
Its possible If its a static method.
Its possible by inheriting from that class also.
Its possible from derived classes using base keyword.
Question : In which cases you use override and new base?
Answer:
Use the new modifier to explicitly hide a member inherited from a base class. To hide an
inherited member, declare it in the derived class using the same name, and modify it with the
new modifier.
Question : What is a private constructor? Where will you use it?
Answer:
When you declare a Constructor with Private access modifier then it is called Private
Constructor. We can use the private constructor in singleton pattern.
If you declare a Constructor as private then it doesnt allow to create object for its derived class,
i.e you loose inherent facility for that class.
Example:

Class A
{
// some code
Private Void A()
{
//Private Constructor
}
}

Class B:A
{
//code
}

B obj = new B();// will give Compilation Error

Because Class A constructor declared as private hence its accessibility limit is to that class only,
Class B can't access. When we create an object for Class B that constructor will call constructor
A but class B have no rights to access the Class A constructor hence we will get compilation
error.
Question : Can we declare private class in a Namespace?
Answer:
No. If you try to create a private class in a Namespace, Compiler will throw a compile time error
Namespace elements cannot be explicitly declared as private, protected, or protected internal.
Reason: The message says it all. Classes can only be declared as private, protected or
protected internal when declared as nested classes, other than that, it doesn't make sense to
declare a class with a visibility that makes it unusable, even in the same module. Top level
classes cannot be private, they are "internal" by default, and you can just make them public to
make them visible from outside your DLL.
Question : What is Polymorphism?
Answer:
In OPPS, polymorphism(Greek meaning having multiple forms) is the ablity of being able to
assign a different meaning or usage to something in different contexts - specifically, to allow an
entity such as a a function, or an object to have more than one forms.
In C# :
Parent classes may define and implement virtual methods(Which is done using the virtual
keyword), and derived classes can override them(using the override keyword), which means

they provide their own definition and implementation.At run-time, when users code calls the
method, the CLR looks up the run-time type of the object, and invokes that override of the virtual
method. Thus in your source code when a method of the base class is called it executes the
overriden method.
Question : What is pure virtual function in OOP?
Answer:
When you define only function prototype in a base class without and do the complete
implementation in derived class. This base class is called abstract class and client wont able to
instantiate an object using this base class.
A pure virtual function is a function that must be overridden in a derived class and need not be
defined. A virtual function is declared to be "pure" using the curious "=0"
syntax:
class Base {
public:
void f1(); // not virtual
virtual void f2(); // virtual, not pure
virtual void f3() = 0; // pure virtual
};
Question : When to use Interface over abstract class?
Answer:
Abstract Classes: Classes which cannot be instantiated. This means one cannot make a object of
this class or in other way cannot create object by saying ClassAbs abs = new ClassAbs(); where
ClassAbs is abstract class.
Abstract classes contains have one or more abstarct methods, ie method body only no
implementation.
Interfaces: These are same as abstract classes only difference is we can only define method
definition and no implementation.
When to use wot depends on various reasons. One being design choice.
One reason for using abstarct classes is we can code common
functionality and force our developer to use it. I can have a complete
class but I can still mark the class as abstract.
Developing by interface helps in object based communication.
Question : What is Sealed modifiers?
Answer:
Sealed types cannot be inherited & are concrete.
Sealed modifiers can also be applied to instance methods, properties, events & indexes. It can't
be applied to static members.
Sealed members are allowed in sealed and non-sealed classes.
Question : What is Protected Internal access modifier in C#?
Answer:
Protected Internal is a access modifiers for the members (methods or functions) ie. you can't
declare a class as protected internal explicitly. The members access is limited to the current
assembly or types derived from the containing class.
Protected Internal means the method is accessible by anything that can access the protected
method UNION with anything that can access the internal method.
Question : What is pure virtual function in OOP?
Answer:
When you define only function prototype in a base class without and do the complete

implementation in derived class. This base class is called abstract class and client wont able to
instantiate an object using this base class.
A pure virtual function is a function that must be overridden in a derived class and need not be
defined. A virtual function is declared to be "pure" using the curious "=0"
syntax:
class Base {
public:
void f1(); // not virtual
virtual void f2(); // virtual, not pure
virtual void f3() = 0; // pure virtual
};

Вам также может понравиться