Monday, June 29, 2009

OOPS Introduction

Introduction
.NET is fully object oriented platform that allow languages to take full advantage of these OO features. The features include:
Namespace
Classes
Objects
Encapsulation
Overloading
Inheritance
Overriding
Interfaces
Polymorphism
Abstraction
Let's take a quick look at what each of this term means.

Object-oriented programming (OOP) is a programming language model organized around "objects" rather than "actions" and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data.
Namespace
Even though namespace is not really an OOPs feature, .NET use it extensively. Namespace is nothing but a

logical container for various classes. Under given namespace class names must be unique. Namespace server two purposes - they provide logical organization of classes and they also avoid ambiguity.
Classes
Class is nothing but a template or blue-print for an entity. For example you may have a class that represents real life entity - Employee. The class will provide properties (Name, Age...) as well as actions (CalculateSalary, GoOnLeave...) of the entity.`

, a class is a template definition of the methods and variables in a particular kind of object . Thus, an object is a specific instance of a class; it contains real values instead of variables.
Objects
Instances of classes are called as objects. For example there might be three instances of the Employee class mentioned above. They might represent individual employees - John, Bob and Tom.

An object doesn't exist until an instance of the class has been created; the class is just a definition. When the object is physically created, space for that object is allocated in RAM. It is possible to have multiple objects created from one class.

Encapsulation
Each object typically deals with some kind of data or the other. Not all the data needs to be exposed to external systems. This can be controlled via data encapsulation.
Overloading
Overloading refers to the methods or functions having same name but varying parameters. The parameters should vary with respect to data types and order.
Inheritance
Inheritance refers to extending functionality of existing class. Inheritance is useful when developing "object models" for your system. .NET supports only single inheritance.
Overriding
Overriding refers to the methods in the child class having the same signature (name as well as parameters) as of the parent class methods.
Interfaces
Interfaces are models of class properties and methods without any implementation. The class implements the interface. Once a class implements any interface it must implement all the properties and methods (although the implementation can be empty or null implementation).

All interfaces should be declared with the keyword interface. You can implement any number of interfaces in a single derived class, but you should provide signatures to all method definitions of the corresponding interfaces.
Polymorphism
Polymorphism refers to the ability of the system to call correct implementation of methods with the same name. For example, Clerk as well as Manager class might have a method called CalculateSalary(). However, at runtime depending on whether the underlying object is of type Clerk or Manager correct version of the method is called.

Structure

 Definition  Normally, a structure is a light-weight class used to create user-defined types containing only public fields and no properties. A structure is considered a value type. .NET structures support access modifiers, constructors, indexers, methods, nested types, operators, and properties. Unlike classes, structures do not support custom constructors, destructors, inheritance, or compile-time initialization of instance fields. Performance suffers when using structures in situations where reference types are expected due to Boxing and Unboxing.
Creating classes
Creating classes is similar to creating namespaces.
[VB.NET]
Public Class Class1
...
End Class

[C#]
public class Class1
{
...
}
Generally classes will be part of some of the namespace.
Creating Properties
Properties encapsulate data members of your class. Properties can be read-write, read only or write only. Here is how you create read-write properties:
[VB.NET]
Public Class Employee

private strName As String

Public Property Name As String
Get
return strName;
End Get

Set(value As String)
strName=value;
End Set
End Property
End Class

[C#]
public class Class1
{
public string Name
{
string strName;
get
{
return strName;
}
set
{
strName=value;
}
}
}
Here,
VB.NET uses Property keyword to declare properties. C# does not have this keyword
Property definition consists of two parts Get and Set. The get part returns the property value and set par sets some private variable.
The value in Set routine is received via implicit variable called value in C#. VB.NET allows you to change this.
Creating methods
Methods represent actions performed by the object. In VB.NET functions and sub routines are collectively called as methods. In C# everything is function.
[VB.NET]
Public Sub CalculateSalary()
...
End Sub

[C#]
public void CalculateSalary()
{
...
}
Method overloading
Method overloading refers to methods with same name but different types or order of parameters. Following example make it clear:
[VB.NET]
Public Sub CalculateSalary()
...
End Sub

Public Sub CalculateSalary(month as Integer)
...
End Sub

[C#]
public void CalculateSalary()
{
...
}

public void CalculateSalary(int month)
{
...
}
In VB.NET you can also use optional parameters to achieve similar functionality. However, it is recommended to use overloading instead to make your code consistent across languages.
Inheritance
Inheritance is the ability to extend existing class further. Unlike languages like C++ that allow multiple inheritance .NET allows only single inheritance. This means that at a time you can inherit from a single class.
[VB.NET]
Public Class Manager
Inherits Employee
...
End Class

[C#]
public class Manager : Employee
{
...
}
In the above example, we create a class called Manager that inherits from Employee class. As you can guess Manager is specific implementation of generic Employee class. VB.NET uses Inherits keyword to indicate the parent class where as C# uses : operator to indicate that.
Method Overriding
In order to override method in child class they need to be marked as Overridable (VB.NET) or virtual (C#) in the parent class.
[VB.NET]
Public Overridable Function CalculateSalary() As Integer
...
End Function

[C#]
public virtual int CalculateSalary()
{
...
}
Then in the child class you can create a method with the same signature and specify that it overrides the base class method.
[VB.NET]
Public Overrides Function CalculateSalary() As Integer
...
End Function

[C#]
public override int CalculateSalary()
{
...
}

Note that if you do not provide the Overrides (VB.NET) or override (C#) keywords in the child class the compiler issues a warning that you are hiding a base class member. In this case you can either put the above keywords or use Shadows (VB.NET) or new (C#) keywords. Using these keywords ,however, will hide the base class members.
Creating Interfaces
Just like classes are templates for real life entities, interfaces can be thought of as templates for classes. They bring uniformity in your object model.
[VB.NET]
Public Interface IEmployee
Property EmployeeID() As Integer
Property Name() As String
Property Age() As Integer
Function CalculateSalary() As Integer
End Interface

[C#]
public interface IEmployee
{
int EmployeeID
{
get;
}

string Name
{
get;
set;
}

int Age
{
get;
set;
}

int CalculateSalary();
}
As you can see VB.NET uses Interface keyword to define an interface. Similarly, C# uses interface keyword. Note, how they contain only property and method signatures and no code at all.
Implementing Interfaces
The main difference between inheritance based programming and interfaces based programming is that - interfaces just specify signatures of properties and methods for a class. Your class "implements" the interface by providing implementation for various properties and methods. Unlike inheritance there is no "code" inherited from interfaces. Your class can implement one or more interfaces.
[VB.NET]
Public Class Manager
Implements IEmployee
...
Public Function CalculateSalary()
As Integer Implements IEmployee.CalculateSalary
...
End Function
End Class

[C#]
public class Manager : IEmployee
{
...
public int CalculateSalary()
{
...
}

}
Above example shows how VB.NET uses Implements keyword to implement an interface. Note how VB.NET also requires the use of Implements keyword for each property and method. You must have guessed from this that in VB.NET you can give different name to the implemented member than the interface. This feature is not available in C#. C# do not have a special keyword and uses the same : operator to implement the interface.

Abstract Classes

Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods.
Polymorphism
Consider following lines of code:
[VB.NET]
Dim emp As Employee
emp = New Clerk()
Console.WriteLine
("Clerk Salary :{0}", emp.CalculateSalary())
emp = New Manager()
Console.WriteLine
("Manager Salary :{0}", emp.CalculateSalary())

[C#]
Employee emp;
emp=new Clerk();
Console.WriteLine
("Clerk Salary :{0}",emp.CalculateSalary());
emp=new Manager();
Console.WriteLine
("Manager Salary :{0}",emp.CalculateSalary());
Here, we have declared a variable of type Employee. A variable of parent class type can point to instance of any of its children. First, we point it to an instance of Clerk class. Then we point it to an instance of Manager class. Even though the variable is of type Employee, depending on which child type it is pointing to it calls the correct implementation of CalculateSalary() method. The underlying system does this via inheritance polymorphism. Similar thing can also be achieved in interface polymorphism.
[VB.NET]
Dim emp As IEmployee
emp = New Clerk()
Console.WriteLine
("Clerk Salary :{0}", emp.CalculateSalary())
emp = New Manager()
Console.WriteLine
("Manager Salary :{0}", emp.CalculateSalary())

[C#]
IEmployee emp;
emp=new Clerk();
Console.WriteLine
("Clerk Salary :{0}",emp.CalculateSalary());
emp=new Manager();
Console.WriteLine
("Manager Salary :{0}",emp.CalculateSalary());
Summary
In this article we saw many OO features of VB.NET and C#. You must have got idea how VB.NET as well as C# provide closely matching features and keywords in this area

C# - Language


Access Modifiers:

Public: Allows access to the class member from any other class.
Private: Allows access to the class member only in the same class.
Protected: Allows access to the class member only within the same class and from inherited classes.
Internal: Allows access to the class member only in the same assembly.
Protected internal: Allows access to the class member only within the same class, from inherited classes, and other classes in the same assembly.
Static: Indicates that the member can be called without first instantiating the class.

Parameters:

Ref and out Parameters:
When we pass a parameter as ref to a method, the method refers to the same variable and changes made will affect the actual variable.Even the variable passed as out parameter is similar to ref, but there are few implementation differences when you use it in C#.
Argument passed as ref must be initialized before it is passed to the method, where as in case of  out its is not necessary,but after a call to the method as an out parameter the variable must be initialized
When to use ref and out parameter. out parameter can be used when we want to return more than one value from a method
Interfaces:
This C# Tutorial deals with interfaces in C# .Net. An Interface is a reference type and it contains only abstract members. Interface's members can be Events, Methods, Properties and Indexers. But the interface contains only declaration for its members. Any implementation must be placed in class that realizes them. The interface can't contain constants, data fields, constructors, destructors and static members. All the member declarations inside interface are implicitly public
public interface IDrivable
{
  void GoForward(int Speed);
}
public class Truck : IDrivable
{
  public void GoForward(int Speed)
  {
     // Implementation omitted
  }
}
public class Aircraft : IDrivable
{
  public void GoForward(int Speed)
  {
     // Implementation omitted
  }
}
public class Train : IDrivable
{
  public void GoForward(int Speed)
  {
     // Implementation omitted
  }
}

Detail Url : http://www.codersource.net/csharp_tutorial_interface.html

Delegates and Events

A Delegate holds reference/s of one or more functions, which can be called or invoked as and when needed.Using a delegate allows the programmer to encapsulate a reference to a method inside a delegate object. The delegate object can then be passed to code which can call the referenced method, without having to know at compile time which method will be invoked.
An interesting and useful property of a delegate is that it does not know or care about the class of the object that it references. Any object will do; all that matters is that the method's argument types and return type match the delegate's. This makes delegates perfectly suited for "anonymous" invocation.
http://www.akadia.com/services/dotnet_delegates_and_events.html

Structs:

In C#, structs are value types, classes are reference types. There are two ways you can create value types, in C#, using the enum keyword and the struct keyword. Using a value type instead of a reference type will result in fewer objects on the managed heap, which results in lesser load on the garbage collector (GC), less frequent GC cycles, and consequently better performance.
structs cannot derive from any other class/struct, nor can they be derived from. However, a struct can implement any number of interfaces. Be aware, though, that when you treat the struct as an interface, it gets implicitly boxed, as interfaces operate only on reference types.
Detail Url: http://www.codeproject.com/csharp/structs_in_csharp.asp
Detail Url : http://www.c-sharpcorner.com/Language/StructuresInCSRVS.asp

Abstract classes
abstract class has methods that are NOT implemented, but just declared, the deriving class should implement them.
The classes, which we can't initialize, are known as abstract classes. They provide only partial implementations. But another class can inherit from an abstract class and can create their instances.
An abstract class can contain abstract and non-abstract methods. When a class inherits from an abstract, the derived class must implement all the abstract methods declared in the base class.
An abstract method is a method without any method body. They are implicitly virtual in C#.
DetailUrl:http://www.csharpcorner.com/Language/AbstractClassesNMethodsRVS.asp
Method Overriding
Overriding refers to the methods in the child class having the same signature (name as well as parameters) as of the parent class methods
Note that for one method to override another, the overridden method must not be static, and it must be declared as either 'virtual', 'abstract' or 'override'. Furthermore, the access modifiers for each method must be the same.

Enums

A enumeration is a distinct type that consists of a set of named constants called the enumetor list. Every enumeration type has an underlying type which can be all integral times except that of a char type.

Tuesday, February 3, 2009

Dot Net interview questions

1.What is the difference between user controls and custom controls?
CUSTOM CONTROLS are DLL'S.It can be placed in the toolbox .Drag and drop controls.
USER CONTROLS: are pages (.ascx).It can not be placed in the tool box.

2.what are the 3 types of session state modes?
a.Inproc-session kept as live object in the web server(aspnet_wp.exe)
b.Stateserver-Session serialized and stored in memory in a seperate process(aspnet_state.exe),we can use for webform architecture.
c.SQLServer-Session serialized and stored in sql server.

3. what are the 6 types of validation controls in ASP.NET?
1.Required Field validator.2.Range validator.3.Regular Expression validator.4.compare validator.5custom validator.
6.validation summary.

4.What are the 3 types of caching in ASP.NET?
1. Output Caching(Page Caching)- stores the responses from an asp.net page(aspx) or user control(.ascx).
2. Fragment Caching(Partial Caching)- Only stores the portion of a page.
3. Data Caching is the programmatic way to your objects to a managed cache.
//Add item
Cache["TopProducts"] = objTopProductsDataset;
//Retrieve item
objDataset = Cache["TopProducts"];

5.How to Manage state in ASP.NET?
We can manage the state in two ways:
Client based techniques are Viewstate, Query strings and Cookies.
Server based techniques are Application and Session

6.What is the difference between overloading and shadowing?
Overloading ----------- A Member has the name, but something else in the signature is different.
Shadowing --------- A member shadows another member if the derived member replaces the base member

7.what is the difference between overloading and overriding?
Overloading : Method name remains the same with different signatures.
Overriding : Method name and Signatures must be the same.

8.what is the difference between Manifest and Metadata?
Manifest: Manifest describes assembly itself.
Assembly Name, version number, culture, strong name, list of all all files, Type references, and referenced assemblies.
MetaData: Metadata describes contents in an assembly classes, interfaces, enums, structs, etc.,
and their containing namespaces, the name of each type, its visibility/scope, its base class,
the interfaces it implemented, its methods and their scope, and each method’s parameters, type’s properties, and so on.

9.What is Boxing and Unboxing?
Boxing is an implicit conversion of a value type to the type object
int i = 123; // A value type
Object box = i // Boxing
CASTING : casting is the process of converting a variable from one type to another (from a string to an integer )
Unboxing is an explicit conversion from the type object to a value type
int i = 123; // A value type
object box = i; // Boxing
int j = (int)box; // Unboxing

10.what are the method parameter in c#?
C# is having 4 parameter types which are
1.Value Parameter. default parameter type. Only Input
2. Reference (ref) Parameter. Input\Output
3. Output (out) Parameter.
4.Parameter (params) Arrays

11.what are value types and reference types?
Value type: bool, byte, chat, decimal, double, enum , float, int, long, sbyte, short, strut, uint, ulong, ushort
Value types are stored in the Stack
Reference type class, delegate, interface, object, string
Reference types are stored in the Heap

12.what are the two activation modes for .NET Remoting?
1. Singleton 2. Singlecall
Net Remoting
When we want different applications to communicate with each other though they r available on the same computer, or on different computers or on different networks, then we can go for .Net Remoting.
Why not Dcom?
    We can use Dcom for interprocess communication, but it works well when the applications r available on computers of same type and on same network. Dcom relies on binary protocol which is not supported by all object models.Also Dcom communicates on ports that r blocked by the firewalls.
Where as .Net supports different transport protocol formats and different communication protocols i.e.,  .Net remoting can be used across any protocol.
 When a client call a method of remote object, that method's parameters and other details regarding the call should be transported(sent) to the remote object.This will be done by channels.
Channels:
Remote objects are accessed thru channels. Channels physically transport messages to and from Remote objects.There r 2 types of channels for remoting
TCP Channel
HTTP Channel
TCP Channel uses Binary Formatter for making stream and the transmission protocol it uses is TCP.This will make it as a binary standard. Therefore, we can use TCP Channel when the client & server r using same OS.
HTTP Channel uses SOAP Formatter.The stream prepared will be in the form of
XML representation because of which it can travel between different OS.
   Binary Formatter & SOAP Formatter r the 2 formatters provided by Microsoft to perform serialization and Deserialization.
There r 2 Activation Modes provided by .Net Remoting.They come under the ‘MarshallByReference’ category.
1.  Server Activated
2.  Client Activated.
1.  Server Activated:
       The server creates an object and maintains it in the remoting registry to provide services to different clients. Server activation is used when remote objects are not required to maintain any state between method calls. And when multiple clients call methods on the same object instance and the object maintains state between function calls. The object Mode for server activation can be single call or single Ton.
a) Single Call:
    When a request is made by client, a copy of the object from the remoting registry will be created, execution will be done and response will be sent to the client.Then the object will be destroyed.Therefore, it is going to be stateless implementation.
b) Single Ton:
     Here also a copy of the object will be created from the remoting registry with client’s request, execution takes place and reposne will be sent back to the client. But here, the obj will not be destroyed. It will be maintained on server machine with the lifetime of 5 mins. Therefore, it maintains the state.
  2.  Client Activated :
   When u want to create unique object to each client request, then we should go for Client ctivated object.

Eg for Single Ton :
  Server Application Program:
Steps:
Open a class library project
       Name: RemoteInterface

' Write a interface in this class library
Public Interface Imessage
     Sub Write(str as string)
     Function Read() as string    
End Interface

'Now Build the interface

Now open a Console Application
    Name : MessageServer
Now we shd add reference to the dll which is having the interface so that we can implement the interface
    Go to Solution Explorer
       Click on  
                  RemoteInterfaceSolution
                        Select MessageServer
                                And in   Refrerences tab
                                           Add Reference
                                                    under .Net Tab select system.Runtime.Remoting
                                                    under .Projectt Tab select RemoteInterface

Now add the following code in ur Console application

Imports system.Runtime.Remoting
Imports system.Runtime.Remoting.Channels.TCP
Imports system.Runtime.Remoting.Channels

class MessageC
          Inherits MarshallByRefObject
          implements RemoteInterface.Imessage
         Private data as string
         Sub new()
              Console.WriteLine("Object created" & DateAndTime.TimeString)
         End Sub
       Public Function  Read() as string
                implements RemoteInterface.Imessage.Read
              Return data
     End Function

     Public Sub write(str as string) implements Imessage.Write
        Data=str
    End Sub
End Class

Module Module1
       Sub Main()
             Dim T as new TCPChannel(2002)
            ChannelServices.RegisterChannel(1)
            RemotingConfiguration.RegisterWellKnownServiceType(GetType  
                      (Message),"Messagecobj.Rem",wellknownobjectMode.SingleTon)
            Console.WriteLine("Server Started")
            Console.Read()
       End Sub
End Module

' Now build the application
Set the startup project to MessageServer          --- console Application
Now run the application




Client Application:

Open a windows Application
         Name: MessageClient
         
Place 2 textboxes t1 and t2 and 2 buttons Wrte and Read
Add Reference to the application
       Select the path in which RemoteInterface.Dll is stored and refer it to this application

' Now add the following code to ur client application


Imports RemoteInterface
Public Class form1
         inherits.........
      dim i as IMessage
   ' in form_load() add the following code
         dim URL as string
         URL="TCP://UrServerName/MessagecOBJ.Rem"
         I=Activator.GetObject(GetType(Imessage),URL)
      End Sub
      Private sub Read_Click()
            t2.text=I.read
      End Sub
       Private sub Write_Click()
               I.Write(t1.text)
       End Sub
 End Class

Now build the application
Run MessageServer.Exe
Then Run MessageClient.Exe
Don't forget running the server first followed by Client    

13.what's singlecall Activation mode used for ?
The Server Object is instantiated for responding to just one single request

14.what's the singleton Activation mode used for?
The server object is instantiated for responding number of clients

15.what are the channels and Formatters?
Channels
HTTP and TCP
Binary Over TCP is most efficient
SOAP over HTTP is most interoperable
Formatters
Binary and SOAP

16.What are the two Authentication modes for SQL server connection?
1. Trusted Connection - Windows Authentication
2. Non trusted Connection - Sql Server Authentication(its preferable for webservices)

17.What is typed dataset?
Data Access is normally done using indexes on collectionsin object model.
In ADO.NET it is possible to create a variation on a Dataset that does support
such syntax.Such Dataset is called "Typed Dataset".
Errors in the syntax are detected during compile time rather than runtime.
Advantages of Typed Dataset:
1.The data designer tool generates typed Datasets.
2.When we type the name of a dataset while writing a code,
we get a list of all available tables in the dataset.No need to remember the table names.
For (eg) instead of typing myDataset.Tables("products") we can type  myDataset.products.

18.what is DataReader?

DataReader is a read only stream of data returned from the database as the query executes.
It contains one row of data in memory at a time and is restricted to navigating forward only in the results one record at a time.
Datareader supports access to multiple result sets but only one at a time and in the order retrieved.
In ADO data is no longer available through the Datareaderoncethe connection to the datasource is closed
which means a Datareader requires a connection to the Database throughout its usage.
o/p parameters or return values are only available through the Datareader once the connection is closed.

19.Difference between Dataset and Recordset?
The Recordset was not XML-based and could not be serialized to XML easily or flexibly.
Finally, a Recordset was not independent of a data store because it tracked a Connection object and through its methods
could send queries to the data source to populate, update, and refresh its data.
To that end, the Recordset contained functionality found in the ADO.NET DataSet, data reader, and data adapter objects.
Similar to the DataSet, a Recordset could be disconnected from its data store and therefore act as an in-memory cache of data.
Of course, it could also be used in a connected model depending on the cursor options that were set.
Although the Recordset object stored multiple versions of each column for each of its rows, it was not by nature able to
represent multiple tables without the use of the Data Shape Provider.

21.What is an Assembly, Private Assembly and SharedAssembly,Strong Name?
Assembly:  Assemblies are basically the compiled code in .Net which contains the code in Microsoft Intermediate Langauge
and one more thing that assembiles do for us as compared to dlls is they can maintain versioning with the help of the manifest.
You dont need to register the assemblies after compiling like we needed in dlls. you can put the assemblies in the
bin folder and refer the namespaces from there.
In short find the assembly description as :
Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment,
version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources
that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime
with the information it needs to be aware of type implementations. To the runtime, a type does not exist outside the
context of an assembly.

Private assembly is used inside an application only and does not have to be identified by a strong name
Shared assembly can be used by multiple applications and has to have a strong name.
Strong Name :A strong name includes the name of the assembly, version number, culture identity, and a public key token.

22.what is an Delegate?
A strongly typed function pointer. A delegate object encapsulates a reference to a method.

23.what are webservices?
A Web Service is an application that delivers a service across the Internet using the standards and technologies defined
in the Web Services architecture in a platform-independent and language-neutral fashion.
Web Services rely on several XML protocols based on open standards that are collectively known as the Web Services architecture

24.Define Automatic memory Management:
c# Provides Automatic memory Management.
Automatic memory Management increases code quality and enhances developer productivity without negatively impacting
either expressivenessor perfromance.Developers are freed from this burdensome task.

25.Define Threading:
It's a process of creating applications that can perform multiple tasks independently.

26Difference Between XML AND HTML?
XML:
User definable tags.
Content driven
End tags required for well formed documents
Quotes required around attributes values
Slash required in empty tags
HTML :
Defined set of tags designed for web display
Format driven
End tags not required
Quotes not required
Slash not required

27.What is XSLTand what is it's use?
XSL Transformations (XSLT) is yet another popular W3C specification that defines XML-based syntax, used to transform XML documents to any other text format, such as HTML, text, XML, etc. XSLT stylesheets can be applied on the source XML document to transform XML into some other XML, or text, HTML, or any other text format.

28.What is Diffgram?
It's an XML format.
It'sone of the two xml formats that uses to render Dataset object contents to XML.
For reading database data to an XML file to be sent to a webservice.

29.what is the Role of XSL?
Querying a database and then formatting the result set so that it can be validated as an XML document allows developers to translate the data into an HTML table using XSLT rules. Consequently, the format of the resulting HTML table can be modified without changing the database query or application code since the document rendering logic is isolated to the XSLT rules

30.What is SAX?
Simple API for XML Processing (SAX) is an alternative to DOM, and can be used to parse XML documents. SAX is based on streaming model. The SAX parser reads input XML stream and generates various parsing events that an application can handle. With each parsing event, the parser sends sufficient information about the node being parsed. Unlike DOM, SAX does not build an in-memory representation of the source XML document, and hence it is an excellent alternative when parsing large XML documents, as SAX does not require that much memory (and resources). Unlike DOM, SAX is not defined/controlled by W3C. See http://www.saxproject.org/ for details.


32.Give a few examples of types of applications that can benefit from using XML.
XML allows content management systems to store documents independently of their format, which thereby reduces
data redundancy. Another answer relates to B2B exchanges or supply chain management systems. In these instances,
XML provides a mechanism for multiple companies to exchange data according to an agreed upon set of rules.
A third common response involves wireless applications that require WML to render data on hand held devices.

33.When constructing an XML DTD, how do you create an external entity reference in an attribute value?
when using SGML, XML DTDs don't support defining external entity references in attribute values.

34.Give some examples of XML DTDs or schemas that you have worked with.
Although XML does not require data to be validated against a DTD, many of the benefits of using the technology are derived from being able to validate XML documents against business or technical architecture rules. Polling for the list of DTDs that developers have worked with provides insight to their general exposure to the technology.commonly used DTDs such as FpML, DocBook, HRML, and RDF, as well as experience designing a custom DTD for a particular project
35.What is SOAP and how does it relate to XML?
The Simple Object Access Protocol (SOAP) uses XML to define a protocol for the exchange of information in distributed computing environments. SOAP consists of three components: an envelope, a set of encoding rules, and a convention for representing remote procedure calls. Unless experience with SOAP is a direct requirement for the open position, knowing the specifics of the protocol, or how it can be used in conjunction with HTTP, is not as important as identifying it as a natural application of XML.

36.What is WSDL?
Another key standard in the Web Services architecture is the Web Services Description Language, or WSDL for short. Whereas SOAP is responsible for providing a platform-neutral protocol for transporting data types and interapplication messaging, WSDL is an XML grammar responsible for exposing the methods, arguments, and return parameters exposed by a particular Web Service.

37.What’s the difference between authentication and authorization? Authentication happens first. You verify user’s identity based on credentials. Authorization is making sure the user only gets access to the resources he has credentials for.

38.Explain loosely coupled events. Loosely coupled events enable an object (publisher) to publish an event. Other objects (subscribers) can subscribe to an event. COM+ does not require publishers or subscribers to know about each other. Therefore, loosely coupled events greatly simplify the programming model for distributed applications.

39.Define scalability.
The application meets its requirement for efficiency even if the number of users increases.

40.Define reliability.
The application generates correct and consistent information all the time.

41.Define availability.
Users can depend on using the application when needed.

42.Define security.
The application is never disrupted or compromised by the efforts of malicious or ignorant users

43.Define manageability.
Deployment and maintenance of the application is as efficient and painless as possible
44.Explain durability.
Make sure that the system can return to its original state in case of a failure.

45.Explain integrity.
Ensure data integrity by protecting concurrent transactions from seeing or being adversely affected by each other’s partial and uncommitted results.

46.Explain consistency.
We must ensure that the system is always left at the correct state in case of the failure or success of a transaction.

47.Explain JIT activation.
The objective of JIT activation is to minimize the amount of time for which an object lives and consumes resources on the server. With JIT activation, the client can hold a reference to an object on the server for a long time, but the server creates the object only when the client calls a method on the object. After the method call is completed, the object is freed and its memory is reclaimed. JIT activation enables applications to scale up as the number of users increases

48.Define Constructors and destructors
The create and destroy methods - often called constructors and destructors - are usually implemented for any abstract data type.
Occasionally, the data type's use or semantics are such that there is only ever one object of that type in a program. In that case,
it is possible to hide even the object's `handle' from the user. However, even in these cases, constructor and destructor methods are
often provided. Of course, specific applications may call for additional methods, e.g. we may need to join two collections
(form a union in set terminology) - or may not need all of these.




1)How do u do exception management
Exception Management
Guidance on managing exceptions
 
An exception is something you do not expect to happen in your application, there are two types of exception fatal and nonfatal. Fatal exceptions is anything that you did not define or not based from the ApplicationException class.
 
Your applications should always define at least one or more ApplicationException types so you can inform the application of broken business rules, non fatal exceptions are not warnings they are unexpected events, to tell the caller something went wrong.


2) If u are using components in ur application , how can u handle exceptions raised in a  document.

3) can we throw exception from catch block? Yes,We can throw exception from catch block.


4) what is the differences b/w value type and reference type
We all know the difference between passing value types byval and byref, if the variable is passed byval any change to the variable value in the called function is not reflected back in the callee because a copy of the variable is passed, whereas passing it byref means that the changes will be reflected back because the same variable is passed.

5)is string reference/value type
System.String is a reference type and not a value type, which means each string is allocated on the heap and not the stack. System.String is peculiar in that it has a shortcut keyword associated with it (string), which is a common practice with primitive value types - System.Int32 (int), System.Char (char) etc. String references also do not require the new keyword to allocate an instance, the following line of code will allocate space on the heap, fill it with string data and assign the reference to the variable:

string aString = "This is a literal string";

Strings are immutable, meaning that once an instance of System.String is created the contents of the object cannot be changed and is read-only. Immutable strings enable string references to be copied throughout an application without the need for thread synchronization. A large number of string copies in an application require minimal overhead because only references to original string objects are copied and not the data itself. Immutable strings come with a price, concatenation of multiple string references using the + operator generates temporary string allocations for each concatenation operation

6) what is the web.config and how many web.config files can we allowed to use in an application.
What is Web.Config File?

Web.config file as it sounds like is a configuration file for the Asp.net web application. There is one web.config file for one asp.net application which configures the particular application. Web.config file is written in XML with specific tags having specific meanings.

What is Machine.config File?
As web.config file is used to configure one asp.net web application, same way Machine.config file is used to configure the application according to a particular machine. Meaning that configuration done in machine.config file is affected on any application that runs on a particular machine. Usually, this file is not altered and only web.config is used which configuring applications.

What can be stored in Web.config file?
There are number of important settings that can be stored in the configuration file. Here are some of the most important configurations.

1) Database connections

2) Session States

3) Error Handling

4) Security

Database Connections:
The most important thing to store in the web.config file is the database connection string. The reason of storing connection string in the web.config file makes sense since if later we ever want to change the location of our database we just have to change the connection string in the web.config file and thats it. This will certainly save us a lot of alteration in different files where we used the old connection.

Lets see a small example of the connection string which is stored in the web.config file.






value="server=localhost;uid=sa;pwd=;database=DBPerson" />





As you can see its really simple to store the connection string in the web.config file. The connection string is referenced by a key which in this case is "ConnectionString". The value attribute of the configuration file denotes the information about the database. Here we can see that if has database name, userid and password. You can define more options if you want.

There is a very good website that deals with all sorts of connection strings. Its called www.connectionstrings.com , in the website you will find the connection strings of all sorts of databases.

lets see how we access the connection string from our Asp.net web application.

using System.Configuration;

string connectionString = (string )ConfigurationSettings.AppSettings["ConnectionString"];

As you see its very simple to get the connection String out from the web.config and than use it in your application.

Session States:
Session in Asp.net web application is very important. As we know that HTTP is a stateless protocol and we needs session to keep the state alive. Asp.net stores the sessions in different ways. By default the session is stored in the asp.net process. You can always configure the application so that the session will be stored in one of the following ways.

1) Session State Service

There are two main advantages of using the State Service. First the state service is not running in the same process as the asp.net application. So even if the asp.net application crashes the sessions will not be destroyed. Any advantage is sharing the state information across a Web garden (Multiple processors for the same computer).

Lets see a small example of the Session State Service.


/>

The attributes are self explanatory but I will go over them.

mode: This can be StateServer or SqlServer. Since we are using StateServer we set the mode to StateServer.

stateConnectionString: connectionString that is used to locate the State Service.

sqlConnectionString: The connection String of the sql server database.

cookieless: Cookieless equal to false means that we will be using cookies to store the session on the client side.



2) SQL Server

The final choice to save the session information is using the Sql Server 2000 database. To use Sql Server for storing session state you need to do the following:

1) Run the InstallSqlState.sql script on the Microsoft SQL Server where you intend to store the session.

You web.config settings will look something like this:


/>

SQL Server lets you share session state among the processors in a Web garden or the servers in a Web farm. Apart from that you also get additional space to store the session. And after that you can take various actions on the session stored.

The downside is SQL Server is slow as compared to storing session in the state in process. And also SQL Server cost too much for a small company.




7) what are the asynchronuos call backs
When a client makes a method call, its blocked until the call returns. That is, the client cant execute any code while its waiting. This is known as synchronous processing. By using asynchronous processing, you can free the client to do other things while its waiting.
In asynchronous processing, the method call that starts a task returns instantly, without supplying a result. The client goes about its business, while the component works on the task. When the task is complete, the component notifies the client that the result is ready.
Asynchronous processing is also useful when clients need to be notified of interesting occurrences — for example, changes in database values, or the arrival of messages. A client tells a component it wants to be notified when certain things happen, and the component sends notifications when those things occur.
Both of these scenarios depend on asynchronous notifications. The client application is minding its own business, when out of the blue comes a notification that an asynchronous request is complete, or that something of interest has occurred.

8)how to write unmanaged code and how to identify

P-Invoke is a service that permits managed code to call unmanaged functions that are implemented in DLLs. In the .Net documentation this is referred to as consuming unmanaged DLLs. Let's take a look at how this is done.
Identifying the DLL Function
Before your managed code can call a DLL function, it must know the name of the function and where it is located — in other words, in which DLL. You do this with the DllImport keyword. This is in the System.Runtime.InteropServices namespace. For an example, I will use the Windows Beep() function, which has the following declaration (in C):
BOOL Beep(
DWORD dwFreq,
// Frequency

DWORD dwDuration
//Duration in milliseconds

};
To make this function accessible in your managed code, you would write the DllImport statement like this:
[DllImport("Kernel32.dll")]
static extern Boolean Beep(
UInt32 frequency, UInt32 duration);
Don't worry about the data types for now; I'll get to them soon. But with this DllImport statement in your managed code, you can call the Beep function like any other function:
Beep(1000, 1500);
As is often the case, the return value of Windows API functions is ignored, because it does not provide any useful information. (DllImport has optional parameters that are needed in some situations. You can learn about these in the .Net online documentation.)
Before you can use functions in a DLL, you must know about them. Where can you get this information? For the Windows API, I recommend one of the several reference books that are available. These books provide information about using each API function including its arguments and return type and the DLL it is contained in (The Windows API is contained in a small set of DLLs that are part of the Windows installation). For third party DLLs, the product documentation should contain this information.
As I mentioned, Windows DLLs are part of the Windows installation and are found by the program without any special effort on your part. Nor do you have to include the DLL files in your distribution package. For third party DLLs, it's best to put them in the application folder where they will be found by the DllImport service. In this case, you do have to include the DLLs in any distribution package you may create.
9)whether code is managed/unmanaged
What Is Managed Code?
Managed Code is what Visual Basic .NET and C# compilers create. It compiles to Intermediate Language (IL), not to machine code that could run directly on your computer. The IL is kept in a file called an assembly, along with metadata that describes the classes, methods, and attributes (such as security requirements) of the code you've created. This assembly is the one-stop-shopping unit of deployment in the .NET world. You copy it to another server to deploy the assembly there—and often that copying is the only step required in the deployment.
Managed code runs in the Common Language Runtime. The runtime offers a wide variety of services to your running code. In the usual course of events, it first loads and verifies the assembly to make sure the IL is okay. Then, just in time, as methods are called, the runtime arranges for them to be compiled to machine code suitable for the machine the assembly is running on, and caches this machine code to be used the next time the method is called. (This is called Just In Time, or JIT compiling, or often just Jitting.)
As the assembly runs, the runtime continues to provide services such as security, memory management, threading, and the like. The application is managed by the runtime.
Visual Basic .NET and C# can produce only managed code. If you're working with those applications, you are making managed code. Visual C++ .NET can produce managed code if you like: When you create a project, select one of the application types whose name starts with .Managed., such as .Managed C++ application..
What Is Unmanaged Code?
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.
10)how to authenticate user in web.config
All the 4 types of authentication viz  Basic, Form-based, Digest & Client Certifcate which are defined in the web.config file in the tag does the work.
The web.config file is a XML based configuration file for each application which no where specifies or restricts the no of users.
So next time when your interviewer fires this question you also bounce back.
(Or)
The .NET Framework uses role-based security and code-based security mechanisms for protecting resources and code from unauthorized use.
Role-based security
Code-based security
in the Core Security Concepts in .NET
The common language runtime (CLR) and .NET Framework provide many useful classes and services that enable developers to easily write secure code and system administrators to customize access to protected resources. The CLR and .NET Framework provide classes and services that implement these basic underlying concepts, including:
· Principals
· Permissions
· Security policies
· Authentication
· Authorization
ASP.NET authentication methods contain the code that is necessary to authenticate the user’s credentials. ASP.NET supports three types of authentication methods. These are
1.Windows-based authentication
2.Forms-based authentication
3.Microsoft Passport authentication

1.---- With Windows-based authentication, the ASP.NET Web application relies on the Windows operating system to authenticate the user. ASP.NET uses Windows-based authentication in conjunction with IIS authentication.
With Windows-based authentication, the user requests a secure Web page from the Web application, and the request then goes through IIS. If the user’s credentials do not match those of an authorized user, IIS rejects the request. The user then has to enter his or her name and password into the logon form. The credentials are again verified by IIS. If correct, IIS directs the original request to the Web application. The secure Web page is then returned to the user
2.------ Forms-based authentication refers to a system where non-authenticated requests are redirected to a Hypertext Markup Language (HTML) form by using Hypertext Transfer Protocol (HTTP) client-side redirection. The user provides credentials and submits the form. If the application validates the credentials on the form, the system issues an authentication cookie to the user. Subsequent requests from the user are issued with the authentication cookie in the request headers, and then the user is authenticated based on those request headers.

3.---- Microsoft Passport authentication is a centralized authentication service that offers a single logon option and core profile services for member sites. Users who sign up to use Passport are authenticated for access to Web sites through a single Passport account. Microsoft Passport is an XML Web service, and it is an integral part of the .NET Framework

11)what is strong name and which tool is used for this
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 (the file that contains the assembly manifest, which in turn contains the names and hashes of all the files that make up the assembly), using the corresponding private key
The Strong Name tool helps sign assemblies with strong names. Sn.exe provides options for key management, signature generation, and signature verification.

12)what is gacutil.exe where do we store assemblies
The Global Application Cache is used to store .NET assemblies that are shared across
an entire machine. To be installed in the GAC, an assembly must
have a strong name (in order to avoid naming conflicts). You can
use the gacutil.exe utitility to add an assembly to the GAC

13)should sn.exe be used before gauctil.exe
Before an assembly can be installed in the GAC, it must be signed with a strong name using the Strong Name Utility (sn.exe).

14) what does assembly info.cs consists of
Every AssemblyInfo file has the following guidelines regarding versioning built right into the comments:
' Version information for an assembly consists of the following four values:
' Major Version
' Minor Version
' Build Number
' Revision
The attribute that the VS.NET-induced Reflection uses to display the assembly versioning information in the Add References dialog is formatted as follows:

VB.NET
[Assembly: AssemblyVersion("Major.Minor.Build.Revision")]
C#.NET
Now, for all the products that my company sells, I've changed the default versioning policy to read as follows:
' Major Version
' Minor Version
' Framework Version
' Build Number

15)differences b/w trace and debug
Tracing: the process of collecting information about a program’s execution and Debugging: the overlapping topic of finding and fixing errors in your program

16) differences b/w dataset and datareader
DataReaader is connected object and one can process the rows that are returned by query, one at a time. It discards every row after you have gone through it and so it is extremely fast.It contains only read-only data, so no updates are allowed using DataReader
objects.

In DataReader you can not get the no. of records directly from RecordSet.This is similar to VB 6, ForwardOnly RecordSet.

Meanwhile DataSet is disconnected object type.It is slow as compare to DataReader but you can do every type of operation by using this.

17) what is custom tag in web.config
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".


18) how do u define authentication In web.config
The element of Web.config lets you tell ASP.NET that you want to use forms authentication. It has a child element, , that allows you to specify the login page. Within the element, you can optionally add a element that directly assigns usernames and passwords

19) what is sequence of code in retrieving data from database

20)about dts package . purpose of dts.
DTS Packages
A DTS package is an organized collection of connections, DTS tasks, DTS transformations, and workflow constraints assembled either with a DTS tool or programmatically and saved to Microsoft® SQL Server™, SQL Server 2000 Meta Data Services, a structured storage file, or a Microsoft Visual Basic® file.
Each package contains one or more steps that are executed sequentially or in parallel when the package is run. When executed, the package connects to the correct data sources, copies data and database objects, transforms data, and notifies other users or processes of events. Packages can be edited, password protected, scheduled for execution, and retrieved by version.
21) Where does the web.config info stored? Will this be stored in the registry

22) how do u register the dotnet component  or assembly
Registering Assemblies
To add the serviced components in your assembly to a COM+ application, you need to register that assembly with COM+. You can perform that registration in three ways:
Manually, using a command line utility called RegSvcs.exe.
Dynamically, by having the client program register your assembly automatically.
Programmatically, by writing code that does the registration for you using a utility class provided by .NET.
23) Authentication mechanism in dot net? And state management in dot net?
State Management
1.Cookies are a neat way to store small pieces of identifying data, but cannot be relied upon (users may have them disabled in their browser preferences).
2.  Sessions are an extremely powerful way to store data that exists for as long as a user is connected to the site, and you can use them to store data for online shopping examples.
3.  Application-scope objects are accessible by any page in an application and are a great way to centralize objects that need to be shared.
4.  Caching data is crucial to improving application performance, but it's also similar to storing data in the Application object. However, the Cache object has some neat features such as linking to a dependency, and you can control when items in the cache expire and react to the events raised when those items expire.

24) What are http handlers?
The low level Request and Response API to service incoming Http requests are Http Handlers in Asp.Net. All handlers implement the IHttpHandler interface, which is located in the System.Web namespace. Handlers are somewhat analogous to Internet Server Application Programming Interface (ISAPI) extensions

25)types of optimization and name a few and how do u ?
1.Hand -tuning
2.Preprocesssor
3.compiler
4.parellization

26)how do u do role based security?
Code access security gives the CLR the ability to make the decisions. In role-based security, the code can perform actions based on evidence about the user and his role. Role based security is especially useful in situations where the access to resources is an important issue. Role based security is ideal for use in conjunction with windows 2000 accounts.

27)diff b/w response.expires and expires.absolute?
The Expires property specifies the length of time before a page cached on a browser expires. If the user returns to the same page before it expires, the cached version is displayed
The ExpiresAbsolute property specifies the date and time at which a page cached on a browser expires. If the user returns to the same page before that date and time, the cached version is displayed. If a time is not specified, the page expires at midnight of that day. If a date is not specified, the page expires at the given time on the day that the script is run.

28)types of objects in asp

29)diff b/w ado and ado.net
In-memory Representations of Data
In ADO, the in-memory representation of data is the recordset. In ADO.NET, it is the dataset. There are important differences between them.
Number of Tables
A recordset looks like a single table. If a recordset is to contain data from multiple database tables, it must use a JOIN query, which assembles the data from the various database tables into a single result table.
In contrast, a dataset is a collection of one or more tables. The tables within a dataset are called data tables; specifically, they are DataTable objects. If a dataset contains data from multiple database tables, it will typically contain multiple DataTable objects. That is, each DataTable object typically corresponds to a single database table or view. In this way, a dataset can mimic the structure of the underlying database.
A dataset usually also contains relationships. A relationship within a dataset is analogous to a foreign-key relationship in a database —that is, it associates rows of the tables with each other. For example, if a dataset contains a table about investors and another table about each investor's stock purchases, it could also contain a relationship connecting each row of the investor table with the corresponding rows of the purchase table.
Because the dataset can hold multiple, separate tables and maintain information about relationships between them, it can hold much richer data structures than a recordset, including self-relating tables and tables with many-to-many relationships.
Data Navigation and Cursors
In ADO you scan sequentially through the rows of the recordset using the ADO MoveNext method. In ADO.NET, rows are represented as collections, so you can loop through a table as you would through any collection, or access particular rows via ordinal or primary key index. DataRelation objects maintain information about master and detail records and provide a method that allows you to get records related to the one you are working with. For example, starting from the row of the Investor table for "Nate Sun," you can navigate to the set of rows of the Purchase table describing his purchases.
A cursor is a database element that controls record navigation, the ability to update data, and the visibility of changes made to the database by other users. ADO.NET does not have an inherent cursor object, but instead includes data classes that provide the functionality of a traditional cursor. For example, the functionality of a forward-only, read-only cursor is available in the ADO.NET DataReader object. For more information about cursor functionality, see Data Access Technologies.
Minimized Open Connections
In ADO.NET you open connections only long enough to perform a database operation, such as a Select or Update. You can read rows into a dataset and then work with them without staying connected to the data source. In ADO the recordset can provide disconnected access, but ADO is designed primarily for connected access.
There is one significant difference between disconnected processing in ADO and ADO.NET. In ADO you communicate with the database by making calls to an OLE DB provider. In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source. The important difference is that in ADO.NET the data adapter allows you to control how the changes to the dataset are transmitted to the database — by optimizing for performance, performing data validation checks, or adding any other extra processing.
Note   Data adapters, data connections, data commands, and data readers are the components that make up a .NET Framework data provider. Microsoft and third-party providers can make available other .NET Framework data providers that can be integrated into Visual Studio. For information on the different .NET Data providers, see .NET Data Providers.
Sharing Data Between Applications
Transmitting an ADO.NET dataset between applications is much easier than transmitting an ADO disconnected recordset. To transmit an ADO disconnected recordset from one component to another, you use COM marshalling. To transmit data in ADO.NET, you use a dataset, which can transmit an XML stream.
The transmission of XML files offers the following advantages over COM marshalling:
Richer data types
COM marshalling provides a limited set of data types — those defined by the COM standard. Because the transmission of datasets in ADO.NET is based on an XML format, there is no restriction on data types. Thus, the components sharing the dataset can use whatever rich set of data types they would ordinarily use.
Performance
Transmitting a large ADO recordset or a large ADO.NET dataset can consume network resources; as the amount of data grows, the stress placed on the network also rises. Both ADO and ADO.NET let you minimize which data is transmitted. But ADO.NET offers another performance advantage, in that ADO.NET does not require data-type conversions. ADO, which requires COM marshalling to transmit records sets among components, does require that ADO data types be converted to COM data types.
Penetrating Firewalls
A firewall can interfere with two components trying to transmit disconnected ADO recordsets. Remember, firewalls are typically configured to allow HTML text to pass, but to prevent system-level requests (such as COM marshalling) from passing.
Because components exchange ADO.NET datasets using XML, firewalls can allow datasets to pass.
30) Diff b/w isql and osql
There is a great deal of overlap between ISQL and OSQL. Both support input scripts, output scripts, and most of the same switch arguments. OSQL has no interface. It will only accept a typed command line, or a saved script. In spite of this disadvantage, sometimes ISQL and Query Analyzer cannot accomplish the required task. Working with MSDE is one example. Query Analyzer is not included with the Microsoft Desktop Engine. When developing an application on MSDE, or needing to do MSDE administration, the OSQL utility is the only tool included. Another key difference between ISQL and OSQL is the base library each tool was built on. ISQL is developed on the DB Library, as opposed to OSQL being developed on ODBC. The DB Library works at the SQL 6.5 standard. This difference means ISQL, or any application developed on the DB Library, dose not support some of the new SQL 2000 features. The entire list of unsupported features can found in Books on Line under the title "Connecting Early Version Clients to SQL Server 2000." Some of the main limitations of ISQL include char and varchars defined greater than 255 bytes will be non accessible, big ints will be converted to decimals, sql_variants will be converted to nvarchars, XML results may not be retrieved, and bit fields that are null will be reported as not null with a value of 0. OSQL and Query Analyzer will support all of the SQL 2000 features.

31) How can I make a column unique.

32) About sql profiler
SQL Profiler is one of the standard suite of client tools that are distributed with SQL Server 2000. You can install these tools from the SQL Server setup disk; they are a part of the main SQL Server setup, but you don't have to install SQL Server to install the client tools.

33) What are users defined stored procedures.
You can use Server Explorer to create stored procedures. Stored procedures can define complex business rules, control data modification, limit access through security permissions, provide transaction integrity, and generally do the database work your application requires.
34) What are code pages?
A term used by operating systems to describe the character set encoding. For example, the most common code page is Windows CP1252, which is the same as ISO 8859-1 (Latin-1) plus a few characters

Code page is the traditional IBM term used for a specific character encoding table: a mapping in which a sequence of bits, usually a single octet representing integer values 0 through 255, is associated with a specific character. A few code pages use more than 8 bits per character and thus encode more than 256 characters. The term cmap (character map) is used in technical documentation on Macintosh platforms.

35) What is referential integrity
Definition: Referential integrity is a database concept that ensures that relationships between tables remain consistent. When one table has a foreign key to another table, the concept of referential integrity states that you may not add a record to the table that contains the foreign key unless there is a corresponding record in the linked table. It also includes the techniques known as cascading update and cascading delete, which ensure that changes made to the linked table are reflected in the primary table

36) about sql profiler usage
-------------------
37) what are the advantages of dot net and disadvantages.
Advantages of .NET
Interoperability and Mobility
There are two types of advantages to using .NET, the advantages to the computer user and the advantages to the developers, i.e. the suppliers of services to the internet population. To the users of the internet .NET enables the user to evolve in their use of the internet away from a single desktop orientation to true interoperability and mobility. Because the user can access any of their accounts, any of their preferences, email accounts, data and common web services from any platform at any time, the user is freed to use technology that drives today´s computing marketplace e.g. mobile communications technology.
Reliability and Security
Any time such a change might come along, reliability and security are a primary concern. .NET has mitigated that concern by building a secure layer at the .NET utility level thus relieving the application level of security concerns. In this way .NET permits users to sustain a high level of comfort and confidence in their on-line transactions while using their web services in a mobile fashion. Such a seamless migration of a large customer base with no anxiety or drop in customer confidence is of immeasurable value to the business entities servicing that clientele.
On Line Forms
.NET has made possible a move away from paper toward the "paperless office" that has been talked about so often. Many of these advantages have already become a reality as the computer user has become accustomed to online filing of government forms and the like. These services and innovations can be made available through the power of standardization and the array of programs and functions within .NET that empower such development. Winforms applications that are a standard part of the .NET environment are what make these kinds of services possible for the developer to offer.
Opening the World of Wireless
Wireless applications have exploded in popularity since 2000. An amazing variety of applications have become available including handheld messaging, SMS, digital transmissions, laptops, Instant messaging plus the expansion of the concept of internet usage from the traditional home or office computer to distributed access in airline terminals, retail outlets, even outdoor venues.
.NET is an ideal tool to take advantage of this market. Because the communication and integration between application level and the constantly changing internet customer level is handled by .NET, the developer can design and implement services with the security that the application will be accessible to all compliant wireless systems today and that future introduction of technology will simply merge into the communications channel with no need for change at the application point of service.
Disadvantages of .NET
Performance and Integration
As with any new technology, there are still performance and integration issues that are still being worked out. However as .NET deployment becomes more widespread, integration will become more and more streamlined. If the planning for integration with in house and third party applications has a priority in the preparation stage of the project, the risks during implementation can be managed.
Operational Issues
From an operational perspective, the capacity and ongoing cost to support .NET at the server level will by nature be higher. .NET moves the center of processing from the desktop to the web server of the service provider to facilitate open communication to mobile devices and greater interoperability. But placing that new load on existing servers does not come without a cost. Early in the decision making process, a capacity analysis and forecast is in order to ascertain to some level of reliable detail the impact the move to .NET will have on existing server load and if there are upgrades needed, just what the new technology will cost.
Support
Finally a pragmatic look at support and ongoing operational issues in a .NET environment is in order before the decision to move to that technology is implemented. Application development is measurably more complex in the .NET world. The benefits of .NET far outweigh the difficulties of the transition but the impact on development costs and time frames must be factored in. From an operational support point of view, because Web Services is so much more distributed and carries with it the baggage of a higher applications interdependency, performance problems and problem resolution becomes significantly more difficult. The result on up-time percentage, expectation of swift problem resolution from a help desk perspective and on Service Level Agreements cannot be overlooked even as early as the design stage of application planning.
38) What are jitters and how many types.
The managed code generated by C#—and other compilers capable of generating managed code—is IL code. Although the IL code is packaged in a valid PE file, you cannot execute it unless it is converted to managed native code. That is where the NGWS runtime JIT Just-in-Time (JIT) compilers—which are also referred to as JITters—come into the picture.
39) How do u manage session in asp and asp.net
Managing ASP Sessions
The server will maintain a user's session data for the lifetime of the session. A script can end a session programmatically by calling the Abandon method of the Session object. When a user completes an application and a session is no longer needed, the script can simply call Session.Abandon to end the session and free the server resources used by that session. A session can also end if the user does not make any HTTP requests to the ASP application for a specified time-out period. This period defaults to 20 minutes, but can be adjusted by setting the Timeout property of the Session object. If a user begins a session, but stops making requests to the Web application, ASP will time out the session after the specified idle period expires. The Session object also exposes a SessionID property. SessionID is a LONG datatype that uniquely identifies the user session.
State Management in ASP.NET
By Eric Zheng
Web form pages are HTTP-Based, they are stateless, which means they don’t know whether the requests are all from the same client, and pages are destroyed and recreated with each round trip to the server, therefore information will be lost, therefore state management is really an issue in developing web applications

We could easily solve these problems in ASP with cookie, query string, application, session and so on. Now in ASP.NET, we still can use these functions, but they are richer and more powerful, so let’s dive into it.

Mainly there are two different ways to manage web page’s state: Client-side and Server-side.

1.Client-side state management :
There is no information maintained on the server between round trips. Information will be stored in the page or on the client’s computer.

A. Cookies.

A cookie is a small amount of data stored either in a text file on the client's file system or in-memory in the client browser session. Cookies are mainly used for tracking data settings. Let’s take an example: say we want to customize a welcome web page, when the user request the default web page, the application first to detect if the user has logined before, we can retrieve the user informatin from cookies:
[c#]
if (Request.Cookies[“username”]!=null)
lbMessage.text=”Dear “+Request.Cookies[“username”].Value+”, Welcome shopping here!”;
else
lbMessage.text=”Welcome shopping here!”;

If you want to store client’s information, you can use the following code:
[c#]
Response.Cookies[“username’].Value=username;

So next time when the user request the web page, you can easily recongnize the user again.
B. Hidden Field
A hidden field does not render visibly in the browser, but you can set its properties just as you can with a standard control. When a page is submitted to the server, the content of a hidden field is sent in the HTTP Form collection along with the values of other controls. A hidden field acts as a repository for any page-specific information that you would like to store directly in the page. Hidden field stores a single variable in its value property and must be explicitly added it to the page.
ASP.NET provides the HtmlInputHidden control that offers hidden field functionality.
[c#]
protected System.Web.UI.HtmlControls.HtmlInputHidden Hidden1;
//to assign a value to Hidden field
Hidden1.Value=”this is a test”;
//to retrieve a value
string str=Hidden1.Value;

Note: Keep in mind, in order to use hidden field, you have to use HTTP-Post method to post web page. Although its name is ‘Hidden’, its value is not hidden, you can see its value through ‘view source’ function.
C. View State

Each control on a Web Forms page, including the page itself, has a ViewState property, it is a built-in struture for automatic retention of page and control state, which means you don’t need to do anything about getting back the data of controls after posting page to the server.

Here, which is useful to us is the ViewState property, we can use it to save information between round trips to the server.
[c#]
//to save information
ViewState.Add(“shape”,”circle”);
//to retrieve information
string shapes=ViewState[“shape”];

Note: Unlike Hidden Field, the values in ViewState are invisible when ‘view source’, they are compressed and encoded.

D. Query Strings
Query strings provide a simple but limited way of maintaining some state information.You can easily pass information from one page to another, But most browsers and client devices impose a 255-character limit on the length of the URL. In addition, the query values are exposed to the Internet via the URL so in some cases security may be an issue.
A URL with query strings may look like this:

http://www.examples.com/list.aspx?categoryid=1&productid=101

When list.aspx is being requested, the category and product information can be obtained by using the following codes:
[c#]
string categoryid, productid;
categoryid=Request.Params[“categoryid”];
productid=Request.Params[“productid”];

Note: you can only use HTTP-Get method to post the web page, or you will never get the value from query strings.

2. Server-side state management:
Information will be stored on the server, it has higher security but it can use more web server resources.
A. Aplication object
The Application object provides a mechanism for storing data that is accessible to all code running within the Web application, The ideal data to insert into application state variables is data that is shared by multiple sessions and does not change often.. And just because it is visible to the entire application, you need to used Lock and UnLock pair to avoid having conflit value.
[c#]
Application.Lock();
Application[“mydata”]=”mydata”;
Application.UnLock();
B. Session object

Session object can be used for storing session-specific information that needs to be maintained between server round trips and between requests for pages. Session object is per-client basis, which means different clients generate different session object.The ideal data to store in session-state variables is short-lived, sensitive data that is specific to an individual session.

Each active ASP.NET session is identified and tracked using a 120-bit SessionID string containing URL-legal ASCII characters. SessionID values are generated using an algorithm that guarantees uniqueness so that sessions do not collide, and SessionID’s randomness makes it harder to guess the session ID of an existing session.
SessionIDs are communicated across client-server requests either by an HTTP cookie or a modified URL, depending on how you set the application's configuration settings. So how to set the session setting in application configuration? Ok, let’s go further to look at it.

Every web application must have a configuration file named web.config, it is a XML-Based file, there is a section name ‘sessionState’, the following is an example:



‘cookieless’ option can be ‘true’ or ‘false’. When it is ‘false’(default value), ASP.NET will use HTTP cookie to identify users. When it is ‘true’, ASP.NET will randomly generate a unique number and put it just right ahead of the requested file, this number is used to identify users, you can see it on the address bar of IE:

http://localhost/Management/(2yzakzez3eqxut45ukyzq3qp)/Default.aspx

Ok, it is further enough, let is go back to session object.
[c#]
//to store information
Session[“myname”]=”Mike”;
//to retrieve information
myname=Session[“myname”];
C. Database

Database enables you to store large amount of information pertaining to state in your Web application. Sometimes users continually query the database by using the unique ID, you can save it in the database for use across multiple request for the pages in your site.
40) How do u handle session management in asp.net and how do u implements them.how do u handle in case of sqlserver mode.

41) What is custom control? Wat is the diff b/w custom control and user control;

42) does c# supports multi dimensional arrays?Yes

43)features and disadvantages In dataset.

44) What is the reflection and disadvantages.
the mechanism of retrieving the internal details of a DotNET component (check out the word DotNet before the word component) in runtime is done with the help of Reflection in .NET.
The major disadvantage of using the reflection classes is speed. Since the reflection classes are built upon unmanaged APIs, there is a performance hit when using them. In addition to the cost of 30 x86 instructions per call to an unmanaged API, any data moving between the managed and unmanaged worlds needs to be marshaled. Certain data types are more expensive than others. Native data types like integers are much faster than strings. Passing strings can be costly when calling a non-Unicode Win32 APIs, since .NET uses all Unicode strings.
45) What is boxing and how it works internally

46) TYPES OF AUTEHNICATIONS IN IIS.
Windows authentication
Forms authentication
Passport authentication
None

other authentication options


47) Disadvantage of com components

48)how do u load xml documents and perform validations of the document.
XmlDocument dom = new XmlDocument();
dom.Load("c:\\orders.xml");

49)what is ODP.NET
The Oracle Data Provider for .NET (ODP.NET) features optimized data access to the Oracle database from a .NET environment. ODP.NET allows developers to take advantage of advanced Oracle database functionality, including Real Application Clusters, XML DB, and advanced security. The data provider can be used from any .NET language, including C# and Visual Basic .NET.

50)types of sessions management In asp.net

51)diff b/w datareader and dataset

52)what are the steps in connecting to database
1.string queryString ;
2.
3. OleDbConnection connection;
4. connection = new OleDbConnection( @"Provider=Microsoft.Jet.OleDb.4.0; Data Source=Server.MapPath( “Northwind.mdb" );
5. connection.Open();
6.
7. OleDbDataAdapter adapter = new OleDbDataAdapter( queryString, connection );
8. DataSet dbData = new DataSet();
9.
10. adapter.Fill( dbData, "Results" );
11.
12. connection.Close();

53) How do u register a .net assembly
To register a .NET class with COM, you must run a command-line tool called the Assembly Registration Tool (regasm.exe). Regasm.exe creates a type library (TBL File) and adds information about the class to the system registry, so that COM clients can use the .NET class transparently.
regasm c:\tgol\phpclass\bin\phpclass.dll /tlb:phpclass.tlb
This utility can be found in C:\WINNT\Microsoft.NET\Framework\v1.0.3705 (on my computer).

54) Caching techniques in .net
ASP.NET caching is of two types:
• Output Caching
• Object Level or Data Caching

55) diff b/w .Net and previous version
Both Visual Basic .NET and Visual Basic 6.0 can be installed on the same computer and run at the same time. Likewise, applications written in Visual Basic .NET and Visual Basic 6.0 can be installed and run on the same computer. Components written in Visual Basic .NET can interoperate with COM components written in earlier versions of Visual Basic and other languages. For example, you can drag an ActiveX control written in Visual Basic 6.0 onto a Visual Basic .NET Windows Form, use a Visual Basic 6.0 COM object from a Visual Basic .NET class library, or add a reference to a Visual Basic .NET library to a Visual Basic 6.0 executable.
Components compiled with Visual Basic .NET have subtle run-time differences from components compiled with Visual Basic 6.0. Because Visual Basic .NET objects are released through garbage collection, when objects are explicitly destroyed there may be a lag before they are actually removed from memory. There are additional differences such as data type and other language changes. The combined result of these differences is that Visual Basic .NET applications will have similar but not identical run-time behavior to Visual Basic 6.0 applications.
In addition, Visual Basic .NET makes binary compatibility between Visual Basic .NET components and those in Visual Basic 6.0 unnecessary. Components now have a more robust versioning and deployment system, files can be deployed by simply copying to a directory, and upgrading to a new version of a component is as simple as replacing the old file with a new file. All you have to do is ensure classes and methods are compatible with the previous version.
56)diff b/w dataset and datareader

57) what are runtime hosts
The common language runtime has been designed to support a variety of different types of applications, from Web server applications to applications with a traditional rich Windows user interface. Each type of application requires a runtime host to start it. The runtime host loads the runtime into a process, creates the application domains within the process, and loads user code into the application domains.
The .NET Framework ships with a number of different runtime hosts, including the hosts listed in the following table.
Runtime Host
Description
ASP.NET
Loads the runtime into the process that is to handle the Web request. ASP.NET also creates an application domain for each Web application that will run on a Web server.
Microsoft Internet Explorer
Creates application domains in which to run managed controls. The .NET Framework supports the download and execution of browser-based controls. The runtime interfaces with the extensibility mechanism of Microsoft Internet Explorer through a mime filter to create application domains in which to run the managed controls. By default, one application domain is created for each Web site.
Shell executables
Invokes runtime hosting code to transfer control to the runtime each time an executable is launched from the shell.


58) What is an 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.

59) What is view state?
Maintaining the ViewState
When a form is submitted in classic ASP, all form values are cleared. Suppose you have submitted a form with a lot of information and the server comes back with an error. You will have to go back to the form and correct the information. You click the back button, and what happens.......ALL form values are CLEARED, and you will have to start all over again! The site did not maintain your ViewState.
When a form is submitted in ASP .NET, the form reappears in the browser window together with all form values. How come? This is because ASP .NET maintains your ViewState. The ViewState indicates the status of the page when submitted to the server. The status is defined through a hidden field placed on each page with a
control. The source could look something like this:

value="dDwtNTI0ODU5MDE1Ozs+ZBCF2ryjMpeVgUrY2eTj79HNl4Q=" />
.....some code

Maintaining the ViewState is the default setting for ASP.NET Web Forms. If you want to NOT maintain the ViewState, include the directive <%@ Page EnableViewState="false" %> at the top of an .aspx page or add the attribute EnableViewState="false" to any control.
60) What are the blocks in stored procedures
Using Hierarchy of Stored Procedures we can generate hierarchical report of nested procedures:
If Proc1 calls Proc2 and Proc2 calls Proc3 we will have this report:
-Proc1
--Proc2
----Proc3

Classification of stored procedures depending on nested level:

First Level (FL), Procedure called by client application; First level procedure calls Middle level procedures and Last level procedures.

Middle Level (ML),  Nested procedure called by an other procedure, Middle level procedure calls Middle or Last level procedures.

Last Level (LL),  Nested procedure called by First or Middle level procedure; Last level procedure doesn’t call any other procedure.

61)what is normalization and how many type and give some examples
The process of reducing a complex data structure into its simplest, most stable structure. In general, the process entails the removal of redundant attributes, keys, and relationships from a conceptual data model

Normalization is the process of moving columns of a data table so that all of the columns that depend on a primary key column are placed in the same table as that primary key. For example, all columns that are wholly dependent on “customer number” primary key in a CUSTOMER table (such as “customer name” and “customer account balance”) are moved into that table with the primary key..

62)what is subquery and what is correlated subquery
In SQL, a subselect used within a predicate. For example, a select-statement within the WHERE or HAVING clause of another SQL statement.
correlated subquery
1.Select a Row from the Outer Query
2.Determine the value of the correlated column(s)
3.For each record of the outer query, the inner query is executed
4.The result of the inner query is then fed to the outer query and evaluated.  If it satisfies the criteria, the row is returned for output
5.The next record of the outer query is selected and steps 2 through 4 are repeated until all the records of the outer query are evaluated
63)diff types of validation control  in asp.net

64)diff b/w server.execute and response.redirect
The Server.Execute method runs another complete ASP page and then returns to the current page at the next line. This can be used to do "dynamic includes" which were not really possible with ASP 2.0. Compare this with Server.Transfer. The only parameter for this method is the URL of the ASP script that you want to execute.
The Response.Redirect method causes the browser to connect to a specified URL
The Server.Transfer method transfers execution from the current ASPX file to another ASPX file on the same web Server. When your code calls the Server.Transfer method, the current ASPX page terminates execution and the flow of control is transferred to another ASPX page. The new ASPX page still uses the response stream created by the prior ASPX page. When you use this method to navigate between pages, the URL in the browser still shows the original page, because the redirection occurs on the server side and the browser remains unaware of the transfer.
By default, the Server.Transfer method does not pass the form data or the query string of the original page request to the transferred page. But you can preserve the form data and query string of the original page by setting the optional second argument of the method to True. When you use this technique, though, you need to aware of one thing: the destination page uses the same response stream that was created by the original page, and therefore the hidden _VIEWSTATE field of the original page ends up on the second page. This causes the ASP.NET machine authentication check (MAC) to assume that the ViewState of the new page has been tampered with. Therefore, when you choose to preserve the form and query string collection of the original page, you must set the EnableViewStateMac attribute of the Page directive to False for the destination page.
65)how response.flush works in server.execute

66)tell about global.asax
In addition to writing UI code, developers can also add application level logic and event handling code into their Web applications. This code does not handle generating UI and is typically not invoked in response to individual page requests. Instead, it is responsible for handling higher-level application events such as Application_Start, Application_End, Session_Start, Session_End, and so on. Developers author this logic using a Global.asax file located at the root of a particular Web application's virtual directory tree. ASP.NET automatically parses and compiles this file into a dynamic .NET Framework class--which extends the HttpApplication base class--the first time any resource or URL within the application namespace is activated or requested.
The Global.asax file is parsed and dynamically compiled by ASP.NET into a .NET Framework class the first time any resource or URL within its application namespace is activated or requested. The Global.asax file is configured to automatically reject any direct URL request so that external users cannot download or view the code within.
67)tell about web.config

68)tell about machine.config
Machine.Config is something like a superset of web.config. This specifies details related to the machine wide configuration.The configuration system first looks in the machine configuration file for the element and other configuration sections that a developer might define.

Machine.Config can be found at
systemroot\Microsoft.NET\Framework\version number\CONFIG
Ex :

69) How do u set languages in web.config.
Using Globalization tag

70) what is nested query
A nested query is a query that has another query embedded within it; the embedded query is called a subquery.
The embedded query can be nested query itself.- A subquery typically appears within the where clause of a query –From clause or having clause.

71)diff b/w in vb dll and assemblies in .net

72)what is WSDL
Web Services Description Language (WSDL) is an XML based protocol for information exchange in decentralized and distributed environments.

73)What are WSDL PORTS
A WSDL port describes the interfaces (legal operations) exposed by a web service.

WSDL Ports
The element is the most important WSDL element.
It defines a web service, the operations that can be performed, and the messages that are involved.
The port defines the connection point to a web service. It can be compared to a function library (or a module, or a class) in a traditional programming language. Each operation can be compared to a function in a traditional programming language.

Operation Types
The request-response type is the most common operation type, but WSDL defines four types:
Type
Definition
One-way
The operation can receive a message but will not return a response
Request-response
The operation can receive a request and will return a response
Solicit-response
The operation can send a request and will wait for a response
Notification
The operation can send a message but will not wait for a response


One-Way Operation
A one-way operation example:









In this example the port "glossaryTerms" defines a one-way operation called "setTerm".
The "setTerm" operation allows input of new glossary terms messages using a "newTermValues" message with the input parameters "term" and "value". However, no output is defined for the operation.

Request-Response Operation
A request-response operation example:













In this example the port "glossaryTerms" defines a request-response operation called "getTerm".
The "getTerm" operation requires an input message called "getTermRequest" with a parameter called "term", and will return an output message called "getTermResponse" with a parameter called "value".
74) Where do u store connection string
1.Store the database connection string in web config file
2. Store an Encrypted Connection String in the Registry

75) What does connection string consists of
"Persist Security Info=False;Integrated Security=SSPI;database=northwind;server=mySQLServer"
76) Which namespace is used for exception?
System. Exception

77) what are the types of threading concepts
Threading Concepts:
A thread is a path of execution. Each application has a default thread called 'Main Thread' or 'Primary Thread'. You can create multiple threads in your program. Other threads besides primary threads are called 'Secondary Threads'. Each process has at least one of more threads.

Multithreading: 
Running more than one thread simultaneously is multithreading.
Why multiple threads?
Sometimes your program requirement is to do more than one task simultaneously. For example, if you have a program which reads a large database, generate some reports and print them. Suppose generating and printing these reports take few hours. If you don't use multithreading, you can't do anything if you are generating reports. Now what if you want to feed some input data when its generating time consuming reports? In present scenario you can't. But your program supports multithreading, one thread can takes care of reports and you can use other thread to feed input data.
Did you use FrontPage or MS Word? This is one good example of multithreading. When you type wrong spelling of any word, it let you know by drawing an underline. It does spell checking in a background thread and you even notice it. Neat? huh?
MFC and Multithreading
MFC supports two types of threading: User Interface Threads ( UI Threads ) and Worker Threads. UI threads have a GUI with a message pump so user can trap the messages such as mouse or keyboard. Worker thread doesn't have message pump and used to execute background talks such as big calculations, or generating reports.
Thread Synchronization
If more than one thread uses same resources ( variables such as a link list ) then it is very important to provide a synchronization between them. Ok let's say, two threads A and B are using a list. When thread A is reading data, thread B is writing data. To avoid data inconsistency thread synchronization is must.
Win 32 supports 4 types of thread synchronization objects:
Events
Critical Sections
Mutexes
Semaphores
Events: 
Events are used to provide synchronization between two or more concurrently running threads. An event is a BOOL type variable. This can have two states, either set or reset. If two threads are using same list, and say ThreadA is writing data to the list, then ThreadA will reset that event. Now if ThreadB wants to access that data, it will first see if that event is set or not. If it is not set then it will wait. ThreadA will set this event as it is done writing data to the list. One this event is set, ThreadB has the acccess. 
MFC's CEVent class encapsulate this functionality. It provides two members SetEvent and ResetEvent.
Critical Sections: 
A critical section is an area of the code which is locked by one thread and this thread doesn't release this area until it is done it job. During CS, only one thread can access that code. Let's say, ThreadA is writing some data to a data structure, it will lock that area of code until it is done writing and it will only unlock after it is done.
MFC's CCriticalSection class encapsulate this functionality. It provides members functions Lock and UnLock. It's easy to use CS in your applications:
CCriticalSection cs;
.....
....

// ThreadA writes data to an array
cs.Lock();
// Write data to an array
cs.Unlock();

....

// ThreadB reads data to an array
cs.Lock();
// Read data from an array
cs.Unlock();
Mutexes: 
Critical Sections can only work for single process while mutexes can be used for mutiple process using multiple threads. You can use mutexes for multiple threads in same process too. Let's say, you have one txt file. You are running two processes ProcA and ProcB. You want to make sure that ProcB can't have access to the txt file if ProA is reading/writing it.
CMutex mx( FALSE, "tada");
.....
....

// ProcA writes data to the file
mx.Lock();
// Writes data 
mx.Unlock();

....
CMutex mx( FALSE, "tada");
// ProcB writes data to the file
mx.Lock();
// Writes data 
mx.Unlock();
We will see how to use in our examples.
Semaphores:
Semaphores can be used to synchronize threads of a single process or multiple processes. The use of semaphores depends of number of resources available. CSemaphore class of MFC also have Lock and Unlock functions but it works in different way. Initially you have to allocate available resources. Locking a semaphore decrements a resource count and unlocking it increases the resource count. When resource count is 0, that means there are no resources available. Rest of the threads have to wait until another threads free the resources.
CSemaphore cph( 1, 5) ; // This means initial resource count 1 with max 5 resources
....

cph.Lock(); // decrement count
// access the resource  
cph.Unlock(); // increment count
We will see how to use in our examples.
Thread Termination and other operations
There are different ways to terminate a thread. 
1. Normal Thread Termination : For a worker thread, when a thread exits its controlling function, call either AfxEndThread function or a return 0. For a user-interface thread, ::PostQuitMessage. The  ::PostQuitMessage takes is the exit code of the thread. Call GetExitCodeThread  to get the exit code of a thread.  Return 0 is for successful completion.
2. Premature Thread Termination
AfxEndThread is used to terminate a thread from within the thread. Pass the desired exit code as the only parameter. This stops execution of the thread, deallocates the thread?s stack, detaches all DLLs attached to the thread, and deletes the thread object from memory.
Suspending and Resuming a Thread 
You can use CWinThread's ResumeThread and SuspendThead to resume and suspend a thread.
Thread Sleep
You can put a thread to sleep by using Sleep Win32 API.
::Sleep(1000);
78) How many steps in .net application while running

79) how do u send an xml document from client to server

80) what is intermediate language in .net
Microsoft Intermediate Language (MSIL) is a platform independent language that gets compiled into platform dependent executable file or dynamic link library. It means .NET compiler can generate code written using any supported languages and finally convert it to the required machine code depending on the target machine

81) what is clr and how it generates native code
Common Language Runtime
Common Language Runtime (CLR) manages the execution of code and provides different services like Garbage collection and support for Base Class Libraries etc. The main constituents of CLR are described below 
The common Language Runtime (CLR) a rich set of features for cross-language development and deployment. CLR supports both Object Oriented Languages as well as procedural languages. CLR provides security, garbage collection, cross language exception handling, cross language inheritance and so on. 
The Common Type System, support both Object Oriented Programming languages as well as procedural languages. Basically CTS provides rich type system that is intended to support wide range of languages.  
CLS (Common Language Specification) defines a subset of Common Type System, which all language compilers targeting CLR must adhere to. CLS is a subset of CTS.  
All compilers under .NET will generate Intermediate Language no matter what language is used to develop an application. In fact, CLR will not be aware of the language used to develop an application. All language compilers will generate a uniform, common language called Intermediate Language. For this reason IL can be called as The language of CLR A platform for cross language development. 
82)any disadvantage in dataset and in refleciton

83)what is runtime host
The environment in which the Common Language Runtime is started and managed. When you install the .NET Framework, you get three runtime host already configured: Windows shell, ASP.NET, and Internet Explorer.

84) What is purpose of system.enterprise services namespace

85) types of state management techniques.

86) How to invoke .net components and from COM components, give the sequence.

87) How to check null values in the dataset
Check IsNull method on the DataRow Class

88) features in .net framework.
The Microsoft .NET Framework is the programming model of the .NET platform. .NET is used for building, deploying, and running Extensible Markup Language (XML) Web services and all types of applications-both desktop and Web-based.
.NET provides a highly productive, standards-based environment for integrating existing technology with next-generation applications and services, as well as the agility to solve the challenges of deployment and operation of Internet-scale applications. By managing much of the plumbing, it enables developers to focus on writing the code for their applications. The .NET Framework includes the common language runtime and class libraries.
89) About disco and uddi
Disco and UDDI
You need to know where and how to locate a Web Service in order to be able to use it – a process known as discovery. The aim of these two protocols is to facilitate the discovery process.
Disco is a Microsoft standard for the creation of discovery documents. A Disco document is kept in a standard location on a Web Services server (i.e. a web server which hosts Web Services). It contains information such as the path to the corresponding WSDL file (see next section). A Disco document supports static discovery – a potential client must know the location of the document in order to use it.
For VS.NET projects you would not normally use Disco documents as discovery information is available anyway from their base URL, e.g.
http://myServer/myWebService/base_class.asmx?wsdl
would provide discovery information.
However you may also add Disco files to your Web Services project.
UDDI (Universal Description, Discovery, and Integration) is a standardised method of finding web services via a central repository or directory. It applies not only to Web Services but any online resource. UDDI registries are searchable sites that contain information available via UDDI. UDDI provides dynamic discovery – you can discover a Web Service without having to know its location first.
UDDI registries can be private (Intranet based) or public (Internet based). To add your WebServices to a UDDI resgistry you must use the tools provide by the particular registry.


90) What is jit , what are the types of jits and their purpose.
What is Jit compilers?.how many are available in clr?
Just-In-Time compiler- it converts the language that you write in .Net into machine language that a computer can understand. there are tqo types of JITs one  is memory optimized & other  is performace optimized.

What is the difference between structures and enumeration?.
Unlike classes, structs are value types and do not require heap allocation. A variable of a struct type directly contains the data of the struct, whereas a variable of a class type contains a reference to the data. They are derived from System.ValueType class.
Enum->An enum type is a distinct type that declares a set of named constants.They  are strongly typed constants. They are unique types that allow to declare symbolic names to integral values. Enums are value types, which means they contain their own value, can't inherit or be inherited from and assignment copies the value of one enum to another.
public enum Grade
{
   A,
   B,
   C
}
91) What is interoperability

92) diff b/w application and session

93)wat is web application and session

94)wat is web application and virtual directory

95)diff b/w activex exe and dll

96)can tow web applications share a sesssion and application variable.

97)diff b/w CDATA AND PCDATA IN XML

98)types of compatability in vb and their usage.

99)if I have a page where I create an instance of a dll  and invoking any method can I send value to next page.

100)about mts and it's purpose

101)about xlst

102)wat is xml

103)how do u attach an xsl to an xml in presenting output.

104)about response.buffer and response.flush

105)wat is dataset and datamining

106)about soap

107)usage of htmlencode and urlencode

108)usage of server variables

109)how  to find the clint browser type

110)diff b/w sqlserver 7.0 and sql server 2000

111)about dts usage

112)how do u optimize sql queries.

113)define .net architecture

114)where does ado.net and xml web services come in the architecture.

115)wat is msil code

116)types of jit and wat is econo-jit

117)wat are webservices, its attributes . where they are available.

118) wat is uddi and how to register a webservrice

119)without uddi, is it possible to access a remote webservice.

120) wat is wsdl and disco file

121)wat does ado.net consists of?

122)wat does manifest consists?

123)wat do u mean by passport authentication and windows authenication

124)how wsdl stores

125)wat is key features of ado.net and ado

126)wat is odp.net

127)wat is process

128)wat is binding in webservice

129)how a proxy Is generated for a web service

130)wat is delegates how it works

131) types of backups

132) wat is INSTEAD OF trigger.

133)write a query for to get second maximum salary In emp table

134)wat is currency in database

135)wat are nested triggers

136)wat is a heap related to database

137)diff b/w com and .net component

138)wat is UUID AND GUID wat is the size of this ID?

139)diff b/w dynamic querry and static query

140)about ado and its objects

141)wat is unmanaged code and will clr handle this kind of code or not.

142)garbage collector's functionality on unmanages code.

143)types of cursors and explain them

144)types of cursor locks and explanation eace of them

145)wat is side by side execution

146)how do u impliment inheritance In dotnet.

147)about ado.net components/objects . usage of data adapters and tell the steps to retrieve the data.

148)about sn.exe

149)wat was the problem in traditional component why side by side execution is supported in .net?

150)how .net assemblies are registered as private and public assemblies.


151)all kind of specifiers for a class and for methods.

152) wat is deployement and give one example with one progrme

153)if suppose I done a project in dotnet . suppose if that project is installed in some other system is it necessary to install all .net framework or not

154)diff b/w oracle and sql server

155)diff  b/w sql server7.0 and 2000

156)wat asp.net objects

where diff= difference
b/w = between



How do u resolve a many to may relationship

What is unicode

What is a subquery.

Define co-related query

Difference between subquery and corelated subquery.

What are explicit and implicit transactions

How will u run a query in which table name is passed as a parameter.

What is set no count on

What was the size of the last db u worked on and how may tables where in there.

Isolation level  in  SQL  

What are User Defined Types? and how do you use them?

How do u trigger a COM from SQL?  

What is Transaction?  

Transaction isolation

What are optimizer hints  

What is clustered index and a non-clustered index?

What is an indexed view and why do you need it?

What is an execution plan?

How will you return results as xml from SQL server?

How do you design a database? - basics of DB Design, SPs, triggers?

What are the normal forms and which is the best?

If a database is in 3NF, how many minimum number of tables should it have?

What is referential integrity & how is it achieved?

What is a Primary Key? Can it have >1 field?

What are constraints?

Why should you create index? Types on indexes?

What is a trigger and stored procedure?

Types of triggers?

What are inserted and deleted tables?

What is a view?

Where will you use views?

What is fillfactor?

You have a table containing information about empid, empname, emailid, emailname and emailtext.

How will you normalize the table.

You have a table containing empid, empname, managerid. Write an SQL to display the emp name along with his manager's name.

Desing a db for a school database?

What is SQL Trace?

What is a join and what are different types of joins?

Difference between union and join

Difference between Group by and Having clause

Implementation of Stored procedures

SQL performance tuning




How big is the datatype int in .NET? 32 bits.

How big is the char? 16 bits (Unicode).

How do you initiate a string without escaping each backslash? Put an @ sign in front of the double-quoted string.

What are valid signatures for the Main function?

public static void Main()
public static int Main()
public static void Main( string[] args )
public static int Main(string[] args )

Does Main() always have to be public? No.

How do you initialize a two-dimensional array that you don’t know the dimensions of?
int [, ] myArray; //declaration
myArray= new int [5, 8]; //actual initialization

What’s the access level of the visibility type internal? Current assembly.

What’s the difference between struct and class in C#?
Structs cannot be inherited.
Structs are passed by value, not by reference.
Struct is stored on the stack, not the heap.

Explain encapsulation. The implementation is hidden, the interface is exposed.

What data type should you use if you want an 8-bit value that’s signed? sbyte.
Speaking of Boolean data types, what’s different between C# and C/C++? There’s no conversion between 0 and false, as well as any other number and true, like in C/C++.

Where are the value-type variables allocated in the computer RAM? Stack.


Where do the reference-type variables go in the RAM? The references go on the stack, while the objects themselves go on the heap. However, in
reality things are more elaborate.

What is the difference between the value-type variables and reference-type variables in terms of garbage collection? The value-type variables are not garbage-collected, they just fall off the stack when they fall out of scope, the reference-type objects are picked up by GC when their references go null.

How do you convert a string into an integer in .NET? Int32.Parse(string), Convert.ToInt32()

How do you box a primitive data type variable? Initialize an object with its value, pass an object, cast it to an object

Why do you need to box a primitive variable? To pass it by reference or apply a method that an object supports, but primitive doesn’t.

What’s the difference between Java and .NET garbage collectors? Sun left the implementation of a specific garbage collector up to the JRE developer, so their performance varies widely, depending on whose JRE you’re using. Microsoft standardized on their garbage collection.

How do you enforce garbage collection in .NET? System.GC.Collect();

Can you declare a C++ type destructor in C# like ~MyClass()? Yes, but what’s the point, since it will call Finalize(), and Finalize() has no guarantees when the memory will be cleaned up, plus, it introduces additional load on the garbage collector. The only time the finalizer should be implemented, is when you’re dealing with unmanaged code.

What’s different about namespace declaration when comparing that to package declaration in Java? No semicolon. Package declarations also have to be the first thing within the file, can’t be nested, and affect all classes within the file.

What’s the difference between const and readonly? You can initialize readonly variables to some runtime values. Let’s say your program uses current date and time as one of the values that won’t change. This way you declare
public readonly string DateT = new DateTime().ToString().

Can you create enumerated data types in C#? Yes.

What’s different about switch statements in C# as compared to C++? No fall-throughs allowed.

What happens when you encounter a continue statement inside the for loop? The code for the rest of the loop is ignored, the control is transferred back to the beginning of the loop.

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:
Windows: Basic, digest, or Integrated Windows Authentication (NTLM or Kerberos).
Microsoft Passport authentication
Forms authentication
Client Certificate authentication

How do you turn off SessionState in the web.config file? In the system.web section of web.config, you should locate the httpmodule tag and you simply disable session by doing a remove tag with attribute name set to session.
CodeBehind is relevant to Visual Studio.NET only.

What’s a bubbled event? When you have a complex control, likeDataGrid,
writing an event processing routine for each object (cell, button,row, etc.)
is quite tedious. The controls can bubble up their eventhandlers, allowing
the main DataGrid event handler to take care of itsconstituents.
Suppose you want a certain ASP.NET function executed on MouseOver overa
certain button. Where do you add an event handler? It’s the Attributesproperty,
the Add function inside that property. So

btnSubmit.Attributes.Add("onMouseOver","someClientCode();")A simple"Javascript:ClientCode();” in the button control of the .aspx
page will attach the handler (javascript function)to the onmouseover event.

What data type does the RangeValidator control support? Integer,String
and Date.

Where would you use an iHTTPModule, and what are the limitations of any
approach you might take in implementing one? One of ASP.NET’s most useful
features is the extensibility
of the HTTP pipeline, the path that data takes between client and server.
You can use them to extend your ASP.NET applications by adding pre- and post-processing
to each HTTP request coming into your application. For example, if you wanted
custom authentication facilities for your application, the best technique
would be to intercept the request when it comes in and process the request
in a custom HTTP module.

Explain what a diffgram is, and a good use for one? A DiffGram is
an XML format that is used to identify current and original versions of data
elements. The DataSet uses the DiffGram format to load and persist its contents,
and to serialize its contents for transport across a network connection. When
a DataSet is written as a DiffGram, it populates the DiffGram with all the
necessary information to accurately recreate the contents, though not the
schema, of the DataSet, including column values from both the Original and
Current row versions, row error information, and row order.



1.        Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process. inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.

2.        What’s the difference between Response.Write() andResponse.Output.Write()? The latter one allows you to write formattedoutput.

3.        What methods are fired during the page load? Init() - when the pageis instantiated, Load() - when the page is loaded into server memory, PreRender() - the brief moment before the page is displayed to the user asHTML, Unload() - when page finishes loading.

4.        Where does the Web page belong in the .NET Framework class hierarchy?System.Web.UI.Page

5.        Where do you store the information about the user’s locale? System.Web.UI.Page.Culture

6.        What’s the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"? CodeBehind is relevant to Visual Studio.NET only.

7.        What’s a bubbled event? When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.

8.        Suppose you want a certain ASP.NET function executed on MouseOver overa certain button. Where do you add an event handler? It’s the Attributesproperty, the Add function inside that property. So btnSubmit.Attributes.Add("onMouseOver","someClientCode();")

9.        What data type does the RangeValidator control support? Integer,String and Date.

10.    Explain the differences between Server-side and Client-side code?  Server-side code runs on the server. Client-side code runs in the clients’ browser.

11.    What type of code (server or client) is found in a Code-Behind class? Server-side code.

12.    Should validation (did the user enter a real date) occur server-side or client-side? Why? Client-side. This reduces an additional request to the server to validate the users input.

3.    What does the "EnableViewState" property do? Why would I want it on or off?  It enables the viewstate on the page. It allows the page to save the users input on a form.

14.    What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other? Server.Transfer is used to post a form to another page. Response.Redirect is used to redirect the user to another page or site.

15.    Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?

·         A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
·         A DataSet is designed to work without any continuing connection to the original data source.
·         Data in a DataSet is bulk-loaded, rather than being loaded on demand.
·         There's no concept of cursor types in a DataSet.
·         DataSets have no current record pointer You can use For Each loops to move through the data.
·         You can store many edits in a DataSet, and write them to the original data source in a single operation.
·         Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.

16.    Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?  This is where you can set the specific variables for the Application and Session objects.

17.    If I’m developing an application that must accommodate multiple security levels though secure login and my ASP.NET web application is spanned across three web-servers (using round-robin load balancing) what would be the best approach to maintain login-in state for the users? Maintain the login state security through a database.

18.    Can you explain what inheritance is and an example of when you might use it? When you want to inherit (use the functionality of) another class. Base Class Employee. A Manager class could be derived from the Employee base class.

19.    Whats an assembly?  Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN

20.    Describe the difference between inline and code behind. Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

21.    Explain what a diffgram is, and a good use for one? The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. For reading database data to an XML file to be sent to a Web Service.

22.    Whats MSIL, and why should my developers need an appreciation of it if at all? MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL.

23.    Which method do you invoke on the DataAdapter control to load your generated dataset with data? The .Fill() method

24.    Can you edit data in the Repeater control?  No, it just reads the information from its data source

25.    Which template must you provide, in order to display data in a Repeater control? ItemTemplate

26.    How can you provide an alternating color scheme in a Repeater control? Use the AlternatingItemTemplate

27.    What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control? You must set the DataSource property and call the DataBind method.

28.    What base class do all Web Forms inherit from?  The Page class.

29.    Name two properties common in every validation control? ControlToValidate property and Text property.

30.    What tags do you need to add within the asp:datagrid tags to bind columns manually? Set AutoGenerateColumns Property to false on the datagrid tag

31.    What tag do you use to add a hyperlink column to the DataGrid?

32.    What is the transport protocol you use to call a Web service? SOAP is the preferred protocol.

33.    True or False: A Web service can only be written in .NET? False

34.    What does WSDL stand for? (Web Services Description Language)

35.    Where on the Internet would you look for Web services? (http://www.uddi.org)

36.    Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box? DataTextField property

37.    Which control would you use if you needed to make sure the values in two different controls matched?  CompareValidator Control

38.    True or False: To test a Web service you must create a windows application or Web application to consume this service? False, the webservice comes with a test page and it provides HTTP-GET method to test.

39.    How many classes can a single .NET DLL contain?  It can contain many classes.





 System.Web.UI

string logfile = Request.MapPath("log.txt");
using (StreamWriter sw = File.AppendText(logfile))
{
sw.WriteLine("I was here at {0}", DateTime.Now);
}

DataSet Web Services
Within the world of the Services Oriented Architecture, the Web Service is the basic unit of work. This means that often a Web Service is constructed to only return a set of data based on a query that the front-end application sends in. This provides a perfect use for the DataSet as a way of returning data. For example, the following code section shows how data can be returned directly from a Web Service using a DataSet.

Public Function GetRequests(ByVal RequestedStatus As
Boolean) As DataSet
'db connection
Dim sqlConn As SqlConnection
Dim sqlCmd As SqlCommand
Dim strConstring As String
Dim intUserID As Integer

strConstring = ConfigurationSettings.AppSettings("constring")
sqlConn = New SqlConnection(strConstring)
sqlConn.Open()
sqlCmd = New SqlCommand

With sqlCmd
.Connection = sqlConn
.CommandTimeout = 30
.CommandType = CommandType.StoredProcedure
If RequestedStatus = True Then
.CommandText = "spGetOpenRequests"
Else
.CommandText = "spGetClosedRequests"
End If

End With

Dim RequestDA As SqlDataAdapter = New SqlDataAdapter
RequestDA.SelectCommand = sqlCmd
Dim RequestDS As DataSet = New DataSet
RequestDA.Fill(RequestDS, "RequestType")

Return RequestDS
sqlConn.Close()

End Function

Typed Vs. Untyped DataSets
The nature of a DataSet requires that it is either typed or untyped. By definition a typed DataSet is any DataSet that is derived from the base DataSet class that applies the information contained in the XSD to generate a typed class. Information from the schema that contains the tables, columns, and rows is generated and compiled into a new DataSet derived from the XSD and this promotes the DataSet to a first class object in the .NET Framework.
The process of inheriting the typed DataSet from the base DataSet class means that the typed class assumes all functionality of the DataSet class and can be used with methods that take an instance of the DataSet class as a parameter. This is the opposite of the untyped DataSet that has no corresponding schema and is exposed only as a collection.
Defining the Schema
The first step in defining a typed DataSet is to create the XSD that is used to control and provide structure for the DataSet.