Professional Documents
Culture Documents
4. What is an Assembly ?
Assemblies are the fundamental building block of .NET framework. They contains the type and
resources that are useful to make an application. Assembly enables code reuse, version control,
security and deployment. An assembly can have four parts : Manifest, Type metadata, MSIL and
Resource file
5. What is GAC ?
GAC (global assemble cache) Its an space (directory C:\winnt\assembely) on the server where all
the shared assemblies are registered and that can be used in the application for code reuse.
10. What are different types that a variable can be defined and their scopes?
Public- Can be accessed anywhere
Private- anywhere in the same class
Protected -within the class and the class that inherits this class
Friend- Members of the class within the assembly
Protected friend- member of assembly or inheriting class
COM+ : COM+ is an extension of Component Object Model (COM). COM+ is both an OOP
architecture and a set of operating system services.
DCOM an extension of the Component Object Model (COM) that allows COM components to
communicate across network boundaries. Traditional COM components can only perform
interprocess communication across process boundaries on the same machine. DCOM uses the
RPC mechanism to transparently send and receive information between COM components (i.e.,
clients and servers) on the same network.
Unmanaged code is what you use to make before Visual Studio .NET 2002 was released. Visual
Basic 6, Visual C++ 6, heck, even that 15-year old C compiler you may still have kicking around on
your hard drive all produced unmanaged code. It compiled directly to machine code that ran on the
machine where you compiled it—and on other machines as long as they had the same chip, or
nearly the same. It didn't get services such as security or memory management from an invisible
runtime; it got them from the operating system. And importantly, it got them from the operating
system explicitly, by asking for them, usually by calling an API provided in the Windows SDK. More
recent unmanaged applications got operating system services through COM calls.
Unlike the other Microsoft languages in Visual Studio, Visual C++ can create unmanaged
applications. When you create a project and select an application type whose name starts with
MFC, ATL, or Win32, you're creating an unmanaged application.
This can lead to some confusion: When you create a .Managed C++ application., the build product
is an assembly of IL with an .exe extension. When you create an MFC application, the build product
is a Windows executable file of native code, also with an .exe extension. The internal layout of the
two files is utterly different. You can use the Intermediate Language Disassembler, ildasm, to look
inside an assembly and see the metadata and IL. Try pointing ildasm at an unmanaged exe and
you'll be told it has no valid CLR (Common Language Runtime) header and can't be disassembled
—Same extension, completely different files.
Is goto statement supported in C#? How about Java? Gotos are supported in C#to the fullest. In Java goto is
a reserved keyword that provides absolutely no functionality.
Describe the compilation process for .NET code? Source code is compiled and run in the .NET Framework
using a two-stage process. First, source code is compiled to Microsoft intermediate language (MSIL) code
using a .NET Framework-compatible compiler, such as that for Visual Basic .NET or Visual C#. Second,
MSIL code is compiled to native code.
Name any 2 of the 4 .NET authentification methods. ASP.NET, in conjunction with Microsoft Internet
Information Services (IIS), can authenticate user credentials such as names and passwords using any of the
following authentication methods:
ASP.NET
1. What are the different types of caching ?
Output caching, Fragment Caching and Data caching.
.NET = its an Environment for developing Windows & Web applications, services and components using
multiple Programming Languages.
S.O.A. = service oriented applications => eg. Web Services
Apart from Windows OS ; .NET is already available on UNIX [Free BSD] & MAC ; & will be soon available on
Linux [Project Mono]
It is a Framework in which Windows applications may be developed and run.The Microsoft .NET Framework
is a platform for building, deploying, and running Web Services and applications. It provides a highly
productive, standards-based, multi-language environment for integrating existing investments with next-
generation applications and services as well as the agility to solve the challenges of deployment and
operation of Internet-scale applications. The .NET Framework consists of three main parts: the common
language runtime, a hierarchical set of unified class libraries, and a componentized version of Active Server
Pages called ASP.NET. The .NET Framework provides a new programming model and rich set of classes
designed to simplify application development for Windows, the Web, and mobile devices. It provides full
support for XML Web services, contains robust security features, and delivers new levels of programming
power. The .NET Framework is used by all Microsoft languages including Visual C#, Visual J#, and Visual
C++.
CLR is .NET equivalent of Java Virtual Machine (JVM). It is the runtime that converts a MSIL code into the
host machine language code, which is then executed appropriately.
The CLR is the execution engine for .NET Framework applications. It provides a number of services,
including:
· Thread management
· Verification of type safety
· Conversion of IL to native code.
· Access to metadata (enhanced type information)
· Managing memory for managed objects (memory management)
· Enforcement of code access security
· Exception handling, including cross-language exceptions
· Interoperation between managed code, COM objects, and pre-existing DLL's (unmanaged code and
data) i.e.
Robustness
· Automation of object layout
· Support for developer services (profiling, debugging, and so on).
Managed code is code that is written to target the services of the Common Language Runtime. In order to
target these services, the code must provide a minimum level of information (metadata) to the runtime. All
C#, Visual Basic .NET, and JScript .NET code is managed by default. Visual Studio .NET C++ code is not
managed by default, but the compiler can produce managed code by specifying a command-line switch
(/CLR).
Closely related to managed code is managed data--data that is allocated and de- allocated by the Common
Language Runtime's garbage collector. C#, Visual Basic, and JScript .NET data is managed by default. C#
data can, however, be marked as unmanaged through the use of special keywords. Visual Studio .NET C++
data is unmanaged by default (even when using the /CLR switch), but when using Managed Extensions for
C++, a class can be marked as managed using the __gc keyword. As the name suggests, this means that
the memory for instances of the class is managed by the garbage collector. In addition, the class becomes a
full participating member of the .NET Framework community, with the benefits and restrictions that it brings.
An example of a benefit is proper interoperability with classes written in other languages (for example, a
managed C++ class can inherit from a Visual Basic class). An example of a restriction is that a managed
class can only inherit from one base class.
CTS defines all of the basic types that can be used in the .NET Framework and the operations performed on
those type. All this time we have been talking about language interoperability, and .NET Class Framework.
None of this is possible without all the language sharing the same data types. What this means is that an int
should mean the same in VB, VC++, C# and all other .NET compliant languages. This is achieved through
introduction of Common Type System (CTS).
CLS = standards,guidelines for Compiler Vendors.
CTS = datatypes r defined by .NET framework NOT defined by languages.
Thread : a Unit of Execution; When its bare minimum no.of threads Active – i.e. 1 thread active ; Tats it :
then tat Thread is called Default thread.If there are more threads [2 or more] CLR comes/steps in place of
Operating System.dotNet supports MultiThreading !
Assembly => a software Output Unit;It’s a unit of Deployment & a unit of versioning.Assemblies contain
MSIL code.
Assemblies r Self-Describing. [metadata,manifest]
An assembly is the primary building block of a .NET Framework application. It is a collection of functionality
that is built, versioned, and deployed as a single implementation unit (as one or more files). All managed
types and resources are marked either as accessible only within their implementation unit, or as accessible
by code outside that unit.
.NET Assembly contains all the metadata about the modules, types, and other elements it contains in the
form of a “manifest.” The CLR loves assemblies because differing programming languages are just perfect
for creating certain kinds of applications. For example, COBOL stands for Common Business-Oriented
Language because it’s tailor-made for creating business apps. However, it’s not much good for creating
drafting programs. Regardless of what language you used to create your modules, they can all work
together within one Portable Executable Assembly.
There’s a hierarchy to the structure of .NET code. That hierarchy is “Assembly -> Module -> Type ->
Method."
Assemblies can be static or dynamic. Static assemblies can include .NET Framework types (interfaces and
classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). Static
assemblies are stored on disk in portable executable (PE) files. You can also use the .NET Framework to
create dynamic assemblies, which are run directly from memory and are not saved to disk before execution.
You can save dynamic assemblies to disk after they have executed.
Assemblies also allow Side-by-Side execution – 2 versions of same assembly being used @ same time.
References ALWAYS contain names – which r ASSEMBLY names of External Dependencies in ur Project.
code-construct for Attribute [attribute for assembly]
[Assembly: company name]
[Assembly: configuration]
MSIL is an Instruction-set.
MSIL by itself is a Programming Language.
MSIL faster/optimized w.r.t java-byte-code.
A .NET programming language (C#, VB.NET, J# etc.) does not compile into executable code; instead it
compiles into an intermediate code called Microsoft Intermediate Language (MSIL). As a programmer one
need not worry about the syntax of MSIL - since our source code in automatically converted to MSIL. The
MSIL code is then send to the CLR (Common Language Runtime) that converts the code to machine
language, which is, then run on the host machine. MSIL is similar to Java Byte code.
MSIL is the CPU-independent instruction set into which .NET Framework programs are compiled. It contains
instructions for loading, storing, initializing, and calling methods on objects.
Combined with metadata and the common type system, MSIL allows for true cross- language integration
Prior to execution, MSIL is converted to machine code. It is not interpreted.
METADATA =è
· Wats the name of Assembly ?
· Wat r Classes available ?
· Wat is Version no. ?
· Wat r Programming Languages used ?
Metadata is information about a PE. In COM, metadata is communicated through non-standardized type
libraries. In .NET, this data is contained in the header portion of a COFF-compliant PE and follows certain
guidelines; it contains information such as the assembly’s name, version, language (spoken, not computer—
a.k.a., “culture”), what external types are referenced, what internal types are exposed, methods, properties,
classes, and much more. The CLR uses metadata for a number of specific purposes. Security is managed
through a public key in the PE’s header. Information about classes, modules, and so forth allows the CLR to
know in advance what structures are necessary. The class loader component of the CLR uses metadata to
locate specific classes within assemblies, either locally or across networks. Just-in-time (JIT) compilers use
the metadata to turn IL into executable code. Other programs take advantage of metadata as well. A
common example is placing a Microsoft Word document on a Windows 2000 desktop. If the document file
has completed comments, author, title, or other Properties metadata, the text is displayed as a tool tip when
a user hovers the mouse over the document on the desktop. You can use the Ildasm.exe utility to view the
metadata in a PE. Literally, this tool is an IL disassembler.
.net interview questions 11
Module ---
Module is a Class whose all members are static/shared.
Advantages of VB.NET
1. First of all, VB.NET provides managed code execution that runs under the Common Language Runtime
(CLR), resulting in robust, stable and secure applications. All features of the .NET framework are readily
available in VB.NET.2. VB.NET is totally object oriented. This is a major addition that VB6 and other earlier
releases didn't have.3. The .NET framework comes with ADO.NET, which follows the disconnected
paradigm, i.e. once the required records are fetched the connection no longer exists. It also retrieves the
records that are expected to be accessed in the immediate future. This enhances Scalability of the
application to a great extent.4. VB.NET uses XML to transfer data between the various layers in the DNA
Architecture i.e. data are passed as simple text strings.5. Error handling has changed in VB.NET. A new Try-
Catch-Finally block has been introduced to handle errors and exceptions as a unit, allowing appropriate
action to be taken at the place the error occurred thus discouraging the use of ON ERROR GOTO
statement. This again credits to the maintainability of the code.6. Another great feature added to VB.NET is
free threading against the VB single-threaded apartment feature. In many situations developers need
spawning of a new thread to run as a background process and increase the usability of the application.
VB.NET allows developers to spawn threads wherever they feel like, hence giving freedom and better
control on the application.7. Security has become more robust in VB.NET. In addition to the role-based
security in VB6, VB.NET comes with a new security model, Code Access security. This security controls on
what the code can access. For example you can set the security to a component such that the component
cannot access the database. This type of security is important because it allows building components that
can be trusted to various degrees.8. The CLR takes care of garbage collection i.e. the CLR releases
resources as soon as an object is no more in use. This relieves the developer from thinking of ways to
manage memory. CLR does this for them.
'Struct, enum, property /no New keyword/ also Must create an instance
purpose of using an enum is Basically to make s.c. more readable ….
'Also can contain methods...
Member vars = Field vars => @ Class-level; [these represent the State of ur Class];
These member vars WILL NOT be DIRECTLY Exposed to end-user.
PROPERTIES r recommended over member-vars bcoz they provide
Data Validation.
------------------------------------------------------
ABSTRACTION
Providing the end user wihout showing the complexity of execution is called abstraction.
looking for what u want and eliminating the unnessary details
A process of filtering out unwanted details based on a given context & identify a programmable entity from a
RealWorld situation.
Its in the “mind” of the Developer. < ONLY taking relevant details for Design of appropriate class >
ENCAPSULATION
A tactic of bundling data & functions [tat act on tat data] together
aka - Data Hiding ; Classes, Properties & Methods use encapsulation.
INHERITANCE
A process of Specialized classes from Generic ones. [class_Manager is a special case of class_Employee]
: at a time ONLY 1 base class
Main Aim of Inheritance : - Specialization & in the process u can achieve Re-Use.
Multiple inheritance NOT supported in .NET
Interfaces ---
- a set of Property & Function signatures without any implementation.
- a class implementing an interface must provide implementation for ALL members.
these r like a Contract
- All members must be implemented
- Everything must be PUBLIC
- they provide templates for Classes
- Interfaces r developed prior-to/before Developing of Classes
'an Abstract Class contains at least 1 Abstract Method[with no body]
can have other/normal mtds too ………
'Interface is a pure abstract class; all mtds r abstract [only 1 parent class]
'b/w Classes ; b/w Interfaces =Inherits
'b/w Class and Interface =Implements
eg. Code
Class B
inherits A
implements I1,I2,I3 .................
.net interview questions 13
eg. Code
namespace Employee
public interface Iperson
{
DateTime D_O_B
{
get;
set;
}
void Eat();
}
Inherits Cemployee
Implements Iperson
Rule :- var of type Interface can point to Object of Class tat implements tat Interface
I N T E R F A C E -> Within the same Project, add Class [PTR] name ur class as “ all Interface names begin
with I ”
POLYMORPHISM
Multiple forms of the same entity
Eg. Door.Open() Book.Open() , Car.Run() Horse.Run() ……….
2 types –
P via Inheritance
P via Interfaces
-----------------------------------------------------
References ALWAYS contain names – which r ASSEMBLY names of External Dependencies in ur Project.
code-construct for Attribute [attribute for assembly]
[Assembly: company name]
[Assembly: configuration]
Module ---
Module is a Class whose all members are static/shared.
Modules r containers of Classes.
.net interview questions 15
only for .NET assemblies; when Assemblies r shared b/w 2 appcns thru a Cache called GAC !for this
purpose, we register a Shared Assembly in the GAC & not in Windows Registry
###
GAC => possible with same name & different versions; then the identification is by the Strong Name.SN
assembly is an assembly which has been encrypted with a pair [Public Key & Private Key]
###
AppDomain, creates an instance of an object inside it, and then executes one of the object's methods. Note
that you must name the executable 'appdomaintest.exe' for this code to work as-is.
· using System;
· using System.Runtime.Remoting;
·
· public class CAppDomainInfo : MarshalByRefObject
·{
· public string GetAppDomainInfo()
·{
· return "AppDomain = " + AppDomain.CurrentDomain.FriendlyName;
·}
·}
· public class App
·{
· public static int Main()
·{
· AppDomain ad = AppDomain.CreateDomain( "Andy's new domain", null, null );
· ObjectHandle oh = ad.CreateInstance( "appdomaintest", "CAppDomainInfo" );
· CAppDomainInfo adInfo = (CAppDomainInfo)(oh.Unwrap());
· string info = adInfo.GetAppDomainInfo();
· Console.WriteLine( "AppDomain info: " + info );
· return 0;
·}
}
Application Domain :
--------------------
The logical and physical boundary created around every .NET application
by the Common Language Runtime (CLR). The CLR can allow multiple .NET
applications to be run in a single process by loading them into separate
application domains. The CLR isolates each application domain from all
other application domains and prevents the configuration, security, or
stability of a running .NET applications from affecting other
applications. Objects can only be moved between application domains by the use
of remoting.
SQL Triggers ?
Ans.10
Specifics ---
ODBC - for DSN [Domain Server Name]; making any appcn which has Driver !
OLEDB - for RDBMS .
Remoting - is it -------
[Distributed Appcns over n/w] OR
[among Heterogenous OS] ???
Ans.12
· What is Remoting?
The process of communication between different operating system processes, regardless of whether they
.net interview questions 17
are on the same computer. The .NET remoting system is an architecture designed to simplify
communication between objects living in different application domains, whether on the same computer or
not, and between different contexts, whether in the same application domain or not.
Ans.15
When a user requests a Page from ur Website, Session starts;each user on ur website is given a
session.Session object is used to store info needed for a particular user-session.Variables persist for the
entire user-session.
HTTP [stateless]:Web Server treats each http request for a page as an independent request.
We can store values in the Session object;Info stored in the session object is available thruout the session &
.net interview questions 18
1 Namespace --- 1 dll ? OR this associativity [ 1 to 1 w.r.t Namespace-dll associativity ] is not necessary ???
Ans.21
No, Not Necessary !!!
50 .
Early & Late Binding:
---------------------
- Early binding is to know the type of an object at compile time. The
compiler have all the needed element at compile time to build the call
into the excutable code (resolution of calls at compile time)
- With late binding, the type of an object is known only at runtime. It
will need extra instructions to find out where is the method to be
called (if it exists) before calling it (resolution of calls at runtime)
***
Early binding is when the actual object behind the pointer is resolved at
compile time.
Late binding is when the actual object behind the pointer is resolved at run
time.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vaconEarlyLateBinding.asp
53. The difference between typed data set and untyped dataset:-
The difference between the two lies in the fact that a Typed DataSet
has a schema and an Untyped DataSet does not have one. It should be
noted that the Typed Datasets have more support in Visual studio.
i.e. w.r.t typed dataset-working; we know Field –Type ; we can use .separated & the Type automatically
appears ……….. >>
57. For Shadowing-purpose ; its OK if in the Base Class; we don’t write keyword : Overridable [MUST
WRITE for Overriding-purpose]
26.
Wats an Abstract Class ?
Wats an Interface ?
60. default Access Modifier for Vars/Method is Friend NOT public !!!
61. OOPS 4th feature – Abstraction --- Modelling --- concentrate on Modelling details !
??????????
65. vb.net < method/sub declrn > ; OPTIONAL keyword is the last parameter Written
66. Clone [vb.net object] ; Does it create a Shallow copy or Deep copy ?? – creates Shallow copy !
67. Databinding is relating Set of Controls to Dataset table-columns directly !!!
It simply means AAA querying => Anywhere, Anytime Anyhow sql-querying !!!!!!!
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 keyPair.snk
- with in AssemblyInfo.cs add the generated file name
eg: [assembly: AssemblyKeyFile("abc.snk")]
- recompile project, then install it to GAC by either
drag & drop it to assembly folder (C:\WINDOWS\assembly OR C:\WINNT\assembly) (shfusion.dll tool)
or
gacutil -i abc.dll
10) If you want to view a Assembly how to you go about it (: What is ILDASM ?)?
You can use the MSIL Disassembler (Ildasm.exe) to view Microsoft intermediate language (MSIL)
information in a file. If the file being examined is an assembly, this information can include the assembly's
attributes, as well as references to other modules and assemblies. This information can be helpful in
determining whether a file is an assembly or part of an assembly, and whether the file has references to
other modules or assemblies.
To view assembly contents
At the command prompt, type the following command:
Ildasm <assembly name>
In this command, assembly name is the name of the assembly to examine.
The following example opens the Hello.exe assembly.
Ildasm Hello.exe
11) What is Manifest?
Every assembly, whether static or dynamic, contains a collection of data that describes how the elements in
the assembly relate to each other. The assembly manifest contains this assembly metadata. An assembly
manifest contains all the metadata needed to specify the assembly's version requirements and security
identity, and all metadata needed to define the scope of the assembly and resolve references to resources
.net interview questions 23
and classes. The assembly manifest can be stored in either a PE file (an .exe or .dll) with Microsoft
intermediate language (MSIL) code or in a standalone PE file that contains only assembly manifest
information.
12) Where is version information stored of an assembly? The version number is stored in the assembly
manifest along with other identity information, including the assembly name and public key, as well as
information on relationships and identities of other assemblies connected with the application.
14) What is GAC (What are situations when you register .NET assembly in GAC?)?
Each computer where the common language runtime is installed has a machine-wide code cache called the
global assembly cache. The global assembly cache stores assemblies specifically designated to be shared
by several applications on the computer.
There are several ways to deploy an assembly into the global assembly cache: 1)Use an installer
designed to work with the global assembly cache. This is the preferred option for installing assemblies into
the global assembly cache. 2)Use a developer tool called the Global Assembly Cache tool
(Gacutil.exe) provided by the .NET Framework SDK. 3)
Use Windows Explorer to drag assemblies into the cache.
15) What is concept of strong names (How do we generate strong names or what is the process of
generating strong names, What is use of SN.EXE, How do we apply strong names to assembly? How do
you sign an assembly?)?
A strong name consists of the assembly's identity — its simple text name, version number, and culture
information (if provided) — plus a public key and a digital signature. It is generated from an assembly file
using the corresponding private key. (The assembly file contains the assembly manifest, which contains the
names and hashes of all the files that make up the assembly.)
There are two ways to sign an assembly with a strong name:
1) Using the Assembly Linker (Al.exe) provided by the .NET Framework SDK.
2) Using assembly attributes to insert the strong name information in your code. You can use either the
AssemblyKeyFileAttribute or the AssemblyKeyNameAttribute, depending on where the key file to be used is
located.
16) How to add and remove an assembly from GAC?
The gacutil.exe that ships with .NET can be used to add or remove a shared assembly from the GAC.
To add a shared assembly, from the command line enter:
gacutil.exe /i myassembly.dll To remove
from shared assembly: gacutil.exe /u myassembly.dll 17) What is Delay signing?
Delay signing allows a developer to add the public key token to an assembly, without having access to the
private key token.
18) What is garbage collector?
The garbage collector's job is to identify objects that are no longer in use and reclaim the memory. What
does it mean for an object to be in use?
programming languages that are based on the Microsoft® .NET Framework, and they are equally
powerful..."
25) What is CODE Access security? Code access security is a mechanism that helps limit the access code
has to protected resources and operations. In the .NET Framework
*Primitive : Data types that can be mapped directly to the .NET Framework Class Library
(FCL) types are called Primitive. For example, the type "int" is mapped to System.Int32, "short" is mapped to
System.Int16, and so on. In fact, all data types in .NET are derived from the System.Object class. The
following two classes are equivalent (in C#):
// Class implicitly derives from System.Object Class Car{};Class Car{};// Class explicitly derives from
System.Object Class Car: System.Object{};
NET Interoperability
3) How can we use .NET components in COM (What is CCW) (COM callable wrapper)? What caution needs
to be taken in order that .NET components are compatible with COM?
When a COM client calls a .NET object, the common language runtime creates the managed object and a
COM callable wrapper (CCW) for the object. Unable to reference a .NET object directly, COM clients use the
CCW as a proxy for the managed object.
4) How can we make Windows API calls in .NET?
Windows APIs are dynamic link libraries (DLLs) that are part of the Windows operating system. You use
them to perform tasks when it is difficult to write equivalent procedures of your own. For example, Windows
provides a function named FlashWindowEx that lets you make the title bar for an application alternate
between light and dark shades.
The advantage of using Windows APIs in your code is that they can save development time because they
contain dozens of useful functions that are already written and waiting to be used. The disadvantage is that
Windows APIs can be difficult to work with and unforgiving when things go wrong.
5) When we use windows API in .NET is it managed or unmanaged code?
6) What is COM?
COM is a platform-independent; object-oriented system for creating binary software components that can
interact with other COM-based components in the same process space or in other processes on remote
machines. COM is the foundation technology for many other Microsoft technologies, such as Active Server
Pages (ASP), Automation, ISAPI, and ActiveSync.
The DTC is a system service that is tightly integrated with COM+. To help make distributed transactions
work more seamlessly, COM+ directs the DTC on behalf of an application. This makes it possible to scale
transactions from one to many computers without adding special code.
The DTC proxy DLL (Msdtcprx.dll) implements the DTC interfaces. Applications call DTC interfaces to
initiate, commit, abort, and inquire about transactions
10) How many types of Transactions are there in COM + .NET?
11) How do you do object pooling in .NET?
12) What are types of compatibility in VB6?
ASP.NET
1) What’s the sequence in which ASP.NET events are processed?
a) Initialize: Initialize settings needed during the lifetime of the incoming Web request.
b) Load view state: At the end of this phase, the ViewState property of a control is automatically populated
c) Process postback data: Process incoming form data and update properties accordingly.
d) Load: Perform actions common to all requests, such as setting up a database query. At this point, server
controls in the tree are created and initialized, the state is restored, and form controls reflect client-side data.
e) Send postback change notifications: Raise change events in response to state changes between the
current and previous postbacks.
f) Handle postback events: Handle the client-side event that caused the postback and raise appropriate
events on the server.
g) Prerender: Perform any updates before the output is rendered. Any changes made to the state of the
control in the prerender phase can be saved, while changes made in the rendering phase are lost.
h) Save state: The ViewState property of a control is automatically persisted to a string object after this
stage. This string object is sent to the client and back as a hidden variable. For improving efficiency, a
control can override the SaveViewState method to modify the ViewState property.
i) Render: Generate output to be rendered to the client.
j) Dispose: Perform any final cleanup before the control is torn down. References to expensive resources
such as database connections must be released in this phase.
k) Unload: Perform any final cleanup before the control is torn down. Control authors generally perform
cleanup in Dispose and do not handle this event.
Initialization, Page Load, PreRendor, Page unload
2) In which event are the controls fully loaded?
3) How can we identify that the Page is PostBack? VB: Public Readonly
Property IsPostback as Boolean C#: Public bool IsPostBack {get;}
can only be applied at the machine.config level, as follows: <machineKey validation='3Des' />
8) @ Register directives?
Associates aliases with namespaces and class names for concise notation in custom server control syntax.
<%@ Register tagprefix="tagprefix" Namespace="namespace" Assembly="assembly %>
<%@ Register tagprefix="tagprefix" Tagname="tagname" Src="pathname" %>
25) What’s difference between Datagrid, Datalist and Repeater? From performance point of view how do
they rate?
The DataGrid Web control provides the greatest feature set of the three data Web controls, with its ability to
allow the end-user to sort, page, and edit its data. The DataGrid is also the simplest data Web control to get
started with, as using it requires nothing more than adding a DataGrid to the Web page and writing a few
lines of code. The ease of use and impressive features comes at a cost, though, namely that of
performance: the DataGrid is the least efficient of the three data Web controls, especially when placed within
a Web form.
With its templates, the DataList provides more control over the look and feel of the displayed data than the
DataGrid. Using templates, however, typically requires more development time than using the DataGrid's
column types. The DataList also supports inline editing of data, but requires a bit more work to implement
than the DataGrid. Unfortunately, providing paging and sorting support in the DataList is not a trivial
exercise. Making up for these lacking built-in features, the DataList offers better performance over the
DataGrid.
Finally, the Repeater control allows for complete and total control of the rendered HTML markup. With the
Repeater, the only HTML emitted are the values of the databinding statements in the templates along with
the HTML markup specified in the templates—no "extra" HTML is emitted, as with the DataGrid and
DataList. By requiring the developer to specify the complete generated HTML markup, the Repeater often
.net interview questions 28
requires the longest development time. Furthermore, the Repeater does not offer built-in editing, sorting, or
paging support. However, the Repeater does boast the best performance of the three data Web controls. Its
performance is comparable to the DataList's, but noticeably better than the DataGrid's.
26) What’s the method to customize columns in DataGrid?
You can control the order, behavior, and rendering of individual columns by directly manipulating the grid's
Columns collection. The standard column type -- BoundColumn -- renders the values in text labels. The grid
also supports other column types that render differently. Any of the column types can be used together with
the Columns collection of a DataGrid.
Note that you can use explicitly-declared columns together with auto-generated columns
(AutoGenerateColumns=true). When used together, the explicitly-declared columns in the Columns
collection are rendered first, and then the auto-generated columns are rendered. The auto-generated
columns are not added to the Columns collection.
Column Name Description
BoundColumn Lets you control the order and rendering of the columns.
HyperLinkColumn Presents the bound data in HyperLink controls.
ButtonColumn Bubbles a user command from within a row to an event handler on the grid.
TemplateColumn Lets you control which controls are rendered in the column.
EditCommandColumn Displays Edit, Update, and Cancel links in response to changes in the DataGrid
control's EditItemIndex property.
27) How can we format data inside DataGrid?
You can format items in the DataGrid Web server control to customize their appearance. You can Set the
color, font, borders, and spacing for the grid as a whole. Set the color, font, and alignment for each type of
grid item (row) individually, such as item, alternating item, selected item, header, and footer. Changing these
settings allows you to override the settings you make for the entire grid. Set the color, font, and alignment for
individual columns. This is particularly useful for setting the appearance of a special-purpose column such
as a button column.
To set the format for an individual item
1. In Design view, select the DataGrid control, then click the Property Builder link at the bottom of the
Properties window.
2. In the DataGrid Properties dialog box, click the Format tab, and under Objects do one of the following:
Select Header, Footer, or Pager.
-or- Expand the Items node and select the type of item to format.
3. Choose font, color, and alignment options for that item, and then choose Apply.
28) How will decide the design consideration to take a Datagrid, datalist or repeater?
30) What are major events in GLOBAL.ASAX file? What order they are triggered?
The global.asax file can be found in the root directory of an ASP.Net application. Here is the list of events
you can call. By calling them you are actually overriding the event that is exposed by the HttpApplication
base class. Application_Start: used to set up an application environment and only called when the
application first starts. Application_Init: This method occurs after _start
and is used for initializing code. Application_Disposed: This method is invoked before destroying an instance
of an application. Application_Error: This event is used to
handle all unhandled exceptions in the application.
Application_End: used to clean up variables and memory when an application ends.
Application_BeginRequest: This event is used when a client makes a request to any
page in the application. It can be useful for redirecting or validating a page request.
Application_EndRequest: After a request for a page has been made, this is the last event
that is called. Application_PreRequestHandlerExecute: This event occurs just before
ASP.Net begins executing a handler such as a page or a web service. At this point, the session state is
available. Application_PostRequestHandlerExecute: This event occurs when the ASP.Net
handler finishes execution. Application_PreSendRequestHeaders: This event occurs just
before ASP.Net sends HTTP Headers to the client. This can be useful if you want to modify a header
Application_PreSendRequestContent: This event occurs just before ASP.Net
sends content to the client. Application_AcquireRequestState: This event occurs when
ASP.Net acquires the current state (eg: Session state) associated with the current request.
Application_ReleaseRequestState: This event occurs after ASP.NET finishes executing all request handlers
and causes state modules to save the current state data.
Application_AuthenticateRequest: This event occurs when the identity of the current user has been
established as valid by the security module. Application_AuthorizeRequest: This event occurs when the user
has been authorized to access the resources of the security module. Session_Start: this event is
.net interview questions 29
triggered when any new user accesses the web site. Session_End: this event is triggered when a user's
session times out or ends. Note this can be 20 mins (the default session timeout value) after the user
actually leaves the site.
2005
1.What is the difference between user controls and custom controls?
2.what are the 3 types of session state modes?
3. what are the 6 types of validation controls in ASP.NET?
4.What are the 3 types of caching in ASP.NET?
5.How to Manage state in ASP.NET?
6.What is the difference between overloading and shadowing?
7.what is the difference between overloading and overriding?
8.what is the difference between Manifest and Metadata?
9.What is Boxing and Unboxing?
10.what are the method parameter in c#?
11.what are value types and reference types?
12.what are the two activation modes for .NET Remoting?
13.what's singlecall Activation mode used for ?
14.what's the singleton Activation mode used for?
15.what are the channels and Formatters?
16.What are the two Authentication modes for SQL server connection?
17.What is typed dataset?
18What is DataReader?
19)Difference between Dataset and Recordset?
20)What is Global Assembly cache?
21What is an Assembly, Private Assembly and Shared Assembly? What are the ways to deploy an
assembly?
22.what is an Delegate?
23.what are webservices?
24.Define Automatic memory Management:
25.Define Threading:
26Difference Between XML AND HTML?
27.What is XSLT and what is it's use?
28.What is Diffgram/?
29.what is the Role of XSL?
30.What is SAX?
31.What is Safecode and unsafe code?
32.Give a few examples of types of applications that can benefit from using XML.
33.When constructing an XML DTD, how do you create an external entity reference in an attribute value?
34.Give some examples of XML DTDs or schemas that you have worked with.
35.What is SOAP and how does it relate to XML?
36.Explain the concepts of Dataset?
37.Explain the consideration involved in choosing between ADO& ADO.NET?
Value Types inherit from the System.ValueType class, which inturn from System.Object.The value type
properties are
1. They are stored in stacks
2. They are accessed directly ie No need to use new operators
There is another difference between structs and classes, and this is also the most important to understand.
Structs are value types, while classes are reference types, and they are dealt with in different ways. When
.net interview questions 30
a value-type object is created, C# allocates a single space in memory, and puts the contents of the object
into it. Primitive types such as int, float, bool or char are also value types, and they are instantiated in the
same way. When the runtime deals with a value type, it's dealing directly with its underlying data and this
can be very efficient, particularly with primitive types.With reference types, however, an object is created in
memory, and then handled through a separate reference – rather like a pointer. Suppose Point is a struct,
and Form is a class
A variable of a value type always contains a value of that type. The assignment to a variable of a value type
creates a copy of the assigned value, while the assignment to a variable of a reference type creates a copy
of the reference but not of the referenced object.
All value types are derived implicitly from the Object class.
Unlike reference types, it is not possible to derive a new type from a value type. However, like reference
types, structs can implement interfaces.
Unlike reference types, it is not possible for a value type to contain the null value.
Each value type has an implicit default constructor that initializes the default value of that type.
Reference Types
Variables of reference types, referred to as objects, store references to the actual data.