---------------------------
1) -.NET -Difference between asp and asp.net
Ans:- ASP stands for Active Server Pages. ASP.NET is the next generation of ASP. After the introduction of ASP.NET, old ASP is called 'Classic ASP'.
Classic ASP uses vb script for server side coding. Vb Script is not supported any more in ASP.NET. Instead, ASP.NET supports more languages including C#, VB.NET, J# etc. VB.NET is very similar to vb script, so it should be easy for old Visual Basic or ASP programmers to switch to VB.NET and ASP.NET
VB Script is a simple scripting language, where as VB.NET or C# are modern, very powerfull, object oriented programming languages. Just for that reason, you will be able to write much more robust and reliable programs in ASP.NET compared to ASP.
In classic ASP, there was no server controls. You have to write all html tags manually. ASP.NET offers a very rich set of controls called Server Controls and Html Controls. It is very easy to drag and drop any controls to a web form. The VS.NET will automatically write the required HTML tags automatically for you.
ADO and ADO.NET:-
Classic ASP uses a technology called ADO to connect and work with databases. ASP.NET uses the ADO.NET technology (which is the next generation of ADO).
2)-How do you do exception management?
Ans:-
3):- What is maintainable code ?
Ans:- If an existing application is given to a new employee in the company and ask him to fix a problem in that,most probably he will come back with the answer : "oh, it is stupid code.. I can't figure out what they have written. Instead of trouble shooting the issues in this code, I can re write the entire application with less time."
This is a common scenario in the programming world. The above answer shows the code is not a maintainable code. Over a period of time, there will be lot of changes required in existing applications to adapt to the new requirements. Only if you write 'maintainable code', you can enhance your application when new requirements come up and solve issues.
There is no specific set of rules to make an application 'maintainable'. There are lot of factors involved in it including following coding standards, writing lot of comments within code, writing self explanatory code, separating application into multiple well defined layers, having good exception handling etc.
4) What is an 'Exception' ?
Ans:- 'Exception' is an error situation that a program may encounter during runtime. For example, your program may be trying to write into a file, but your hard disk may be full. Or, the program may be trying to update a record in database, but that record may be already deleted. Such errors may happen any time and unless you handle such situation properly, your application may have un predictable behaviour.
5) What is the difference between 'Exception' and 'Error' ?
Ans:-Error is an expected situation in an application. For example, you want to create a file in the folder "C:\Projects\Test\". If you attempt to create a file when this folder doesn't exists, it will make the operating system throw an exception. But you should not leave it to the operating system to throw the exception. This has to be handled through code. You must first check for the existence of the folder before you attempt to write the file. If the folder doesn't exists, you must first create the folder. This is how a stable application should be written.
Exception is a runtime error that the program may encounter during the execution of the program. For example, hard disk may be full when you attempt to write into a file, network connection may be lost while your application is communicating with another computer etc. There is no clear definition, but typically, Exceptions are unpredictable errors during runtime.
6) What is 'Exception Handling'?
Ans:-When you ride a bike, you may wear a helmet. When you go for boating, you might use a life jacket. A car driver might use seat belts while driving at high speed in a high way. What is the purpose ? To handle exceptions (accidents), right ? We do not know when it might happen, so we are prepared to 'handle' such situations any time.
An exception can occur anytime during the execution of an application. Your application must be prepared to face such situations. An application will crash if an exception occurs and it is not handled.
"An exception handler is a piece of code which will be called when an exception occurs."
.NET Framework provides several classes to work with exceptions. The keywords try, catch are used to handle exceptions in .NET. You have to put the code (that can cause an exception) in a try block. If an exception occurs at any line of code inside a try block, the control of execution will be transfered to the code inside the catch block.
Syntax :
try
{
// Code which can cause an exception.
}
catch(Exception ex)
{
// Code to handle exception
}
Just like a bike rider wrap his head in a helmet to protect from accident, the above syntax will protect the code within the try block from accidents (exceptions).
If any statement within the try block raises an exception, the control of execution will be transfered to the first line within the catch block. You can write the error handling code in the catch block, like recording the error message into a log file, sending an email to the administrator about the problem occurred, showing an appropriate error message to the user etc.
See the following code :
try
{
Statement 1
Statement 2
Statement 3
}
catch(Exception ex)
{
Statement 4
Statement 5
}
Statement 6
In normal flow of program, the statements 1, 2, 3, 6 will be executed. Statements 4 and 5 will be executed only if an exception occurs.
Assume there is an exception at statement 2. In this scenario, statements 1, 2, 4, 5 and 6 will be executed. Statement 3 will not be executed at all, because an exception occurred at statement 2 and program flow was transferred to the catch block.
'finally' block
You can optionally use a 'finally' block along with the try-catch. The 'finally' block is guaranteed to be executed even if there is an exception.
Sample Code :
try
{
Statement 1
Statement 2
Statement 3
}
catch(Exception ex)
{
Statement 4
Statement 5
}
finally
{
Statement 6
Statement 7
}
Statement 8
In normal flow of program, the statements 1, 2, 3, 6, 7 and 8 will be executed. Statements 4 and 5 will be executed only if an exception occurs.
Assume there is an exception at statement 2. In this scenario, statements 1, 2, 4, 5, 6, 7 and 8 will be executed.
Note that the statements 6 and 7 are executed in both the cases. The bottom line is, the code within the 'finally' block is executed whether there is an exception or not.
You can use the finally block to do any code cleanup. For example, you are doing some database operations inside a try block.
try
{
Statement 1 - Open database
Statement 2 - Execute Query
Statement 3 - Close Database
}
catch(Exception ex)
{
Statement 4 - Show messagebox to user
}
In the above code sample, what will happen if an exception occurs when the statement 2 is executed ? The catch block will be executed and a message box will be shown to the user. But the Statement 3 is never executed in that case, which means the database will not be closed.
Here is where the finally block will be helpful.
try
{
Statement 1 - Open database
Statement 2 - Execute Query
}
catch(Exception ex)
{
Statement 3 - Show messagebox to user
}
finally
{
Statement 4 - Close Database
}
See the improved code. We have moved the code to close the database to the 'finally' block. The statement to close the database will be executed whether there is an exception or not.
7):-Why should we catch exceptions ?
Why should you use a helmet when you ride a bike ? To protect your head from crashing when there is an accident, right ? Just like that, exception handling will protect your application from crashing when there is an exceptions.
If an exception is not 'handled' in code, the application will crash and user will see an ugly message. Instead, you can catch the exception, log the errors and show a friendly message to the user.
8) -If you are using components in your application, how can you handle exceptions raised in a component
9)- Can we throw exception from catch block?
Ans:- We can absolutely throw exceptions in catch blocks.This is called bubbling the exceptions to one level higher.If catch block can not handle exceptions,then it can throw the exception that it caught, to it's caller.
10) -How do you relate an aspx page with its code behind page?
Ans:- using Page directive
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="LoginInformation.aspx.cs" Inherits="LoginInformation" Title="Untitled Page" %>
11)-What are the types of assemblies and where can u store them and how
Ans:- Please note there are three types of Assemblies.
1) Private - Assembly available only to clients in the same directory.
2) Shared - Assemblies in GAC
3) Satelite - Assembly in the specific directory of the locale.
Assembly is Basic Unit Application Deployment in .Net. This is either DLL or EXE.We have 3 types of Assemblies in .Net
1.Private Assembly:This is Local to Perticular Application and not sharable among all the applications.This will be stored on application Root directory.
2.Shared Assembly:This is Sharable among all the applications in our System.This will Stored in Global Assembly Cache.
3.Sattelite Assembly:This is not having appliaction having only Language Specification.
12)-What is difference between value and reference types
Ans:-Value Type:
When you assign value to value type variable to another variable then it's value only copy to another variable. It allocates memory in stack. Here both variables
work independent.
Reference Type:
When you assign value to reference type variable to another reference type variable then it's value doesn't copy both variables are dependent to each other and if you
change one value it reflects in other one. It allocates memory in the heap data structure.
13)-Is array reference type / value type?
Ans:- array in .net is of reference type.It implements various interfaces.also the array you create is automatically derived from system.array class
14) -Is string reference type / value type
Ans:- string is Reference Type
15) -What is web.config. How many web.config files can be allowed to use in an application
Ans:- We can place any number of web.config files in ur aplication.u can place one web.config in one folder.. like this u can do..
The ASP.NET Web.config file is used to define the configuration settings for an ASP.NET application. ASP.NET and the .NET Framework use .config files to define all
configuration options. The .config files, including the ASP.NET Web.config file, are XML files.
Server-wide configuration settings for the .NET Framework are defined in a file called Machine.config. The settings in the Machine.config file can be changed and those
settings affect all .NET applications on the server.
Different ASP.NET applications might need different application settings, that’s why defining those settings in the Machine.config file, is usually not practical. The
solution for this problem is the ASP.NET Web.config file.
The ASP.NET application configuration settings can be changed by creating a file called Web.config and saving it in the root folder of the application. But what if the
Machine.config file defines different settings than the ones defined in your Web.config file? The good news is that the settings in the Web.config file override the settings
in the Machine.config file.
There can be more than one web.config file .
16) -What is differnce between machine.config and web.config
Ans:- machine. config is configuration file for all the application in the IIS.
web.config is a configuration file for a application or folder
machine.config for machine level configuration.
web.config for a application/folder level configuration
17:-What is a DLL Hell Problem in .Net?
Ans:- DLL HELL is the problem that occures when an installation of a newer application might break or hinder other application as newer DLLs are copied into the system and the older application do not support or not compatible with
them. .net overcomes this problem by supporting multiple versions of an assembly at any given time.this is called
side-by-side component versioning.
WINDOWS REGISTRY CANNOT SUPPORT THE MULTIPLE VERSIONS OF SAME COM COMPONENT.THIS IS CALLED AS THE DLL HELL.
DLL Hell, is kind of conflict that occured previously, due to lack of version supportability of dll for(within) an application. Previously, if u had deployed any dll for particular application, and in between u made some changes or provide some more functionality within that application or u enhance your application and you deploy new dll or override existing dll, in this case ur old module which was/were running fine with previous dll, may behaves improperly because of new dll deployed.This called dll Hell. This is no more exist in dot net because of different version supportability of dll, it means old process worked with old dll only and respond in exact manner, and new process which starts after new dll deployed uses(executes with) new dll and respond to user.
18:-How Do I Create Shared Assemblies?
Ans:- The following steps are involved in creating shared assemblies:
a)Create your DLL/EXE source code.
b)Generate a unique assembly name using SN utility.
c) Sign your DLL/EXE with the private key by modifying the Assembly Info file.
d) Compile your DLL/EXE.
e) Place the resultant DLL/EXE in a global assembly cache by using the AL utility.
19) How Do I Create a Unique Assembly Name?
Microsoft now uses a public-private key pair to uniquely identify an assembly. These keys are generated by using a utility called SN.exe (SN stands for shared name). The most common syntax of it is:
sn -k mykeyfile.key
where k represents that you want to generate a key and the file name following is the file in which the keys will be stored.
20) How Do I Sign My DLL/EXE?
Before placing the assembly into a shared cache, you need to sign it by using the keys you just generated. You mention the signing information in a special file called AssemblyInfo. Open the file from VS.NET solution explorer and change it to include the following line:
[assembly:AssemblyKeyFile("file_path")]
Now, recompile the project and the assembly will be signed for you.
Note: You also can supply the key file information during a command line compilation via the /a.keyfile switch.
21) How Do I Place the Assembly in a Shared Cache?
Microsoft has provided a utility called AL.exe to actually place your assembly in shared cache:
AL /i:my_dll.dll
Now, the utility will place your DLL at the proper location.
Hands On...
Now that you understand the basics of assemblies, you can apply your knowledge by developing a simple shared assembly. In this example, you will create a C#.NET component called SampleGAC (GAC stands for Global Assembly Cache). You also will create a key file named sample.key. You will sign your component with this key file and place it in the Global Assembly Cache.
Step 1: Creating your sample component
Here is the code for the component. It just includes one method that returns a string.
using System;
namespace BAJComponents
{ public class Sample
{ public string GetData()
{ return "hello world"; }
}
}
Step 2: Generate a key file
To generate the key file, issue the following command at the command prompt.
sn -k sample.key
This will generate the key file in the same folder.
Step 3: Sign your component with the key
Now, you will sign the assembly with the key file you just created.
csc sampleGAC.cs /t:library /a.keyfile:sample.key
Step 4: Host the signed assembly in the Global Assembly Cache
You will use the AL utility to place the assembly in the Global Assembly Cache:
AL /i:sampleGAC.dll
After hosting, the assembly just goes to the WINNT\Assembly folder and you will find your assembly listed there. Note how the assembly folder is treated differently than normal folders.
Step 5: Test that your assembly works
Now, create a sample client application that uses your shared assembly. Just create a sample code as listed below:
using System;
using BAJComponents;
public class SampleTest
{ static void main()
{ sample x= new sample();
string s= x.getdata();
console.writeline(s); }
}
Compile the above code by using:
csc sampletest.cs /t:exe /r:
Now, copy the resulting EXE in any other folder and run it. It will display "Hello World", indicating that it is using your shared assembly.
22) What is an assembly?
An Assembly is a logical unit of code
Assembly physically exist as DLLs or EXEs
One assembly can contain one or more files
The constituent files can include any file types like image files, text files etc. along with DLLs or EXEs
When you compile your source code by default the exe/dll generated is actually an assembly
Unless your code is bundled as assembly it can not be used in any other application
When you talk about version of a component you are actually talking about version of the assembly to which the component belongs.
Every assembly file contains information about itself. This information is called as Assembly Manifest.
23) What is assembly manifest?
Assembly manifest is a data structure which stores information about an assembly
This information is stored within the assembly file(DLL/EXE) itself
The information includes version information, list of constituent files etc.
24) What is private and shared assembly?
The assembly which is used only by a single application is called as private assembly. Suppose you created a DLL which encapsulates your business logic. This DLL will be used by your client application only and not by any other application. In order to run the application properly your DLL must reside in the same folder in which the client application is installed. Thus the assembly is private to your application.
Suppose that you are creating a general purpose DLL which provides functionality which will be used by variety of applications. Now, instead of each client application having its own copy of DLL you can place the DLL in 'global assembly cache'. Such assemblies are called as shared assemblies.
25) What is Global Assembly Cache?
Global assembly cache is nothing but a special disk folder where all the shared assemblies will be kept. It is located under
26) How assemblies avoid DLL Hell?
As stated earlier most of the assemblies are private. Hence each client application refers assemblies from its own installation folder. So, even though there are multiple versions of same assembly they will not conflict with each other. Consider following example :
You created assembly Assembly1
You also created a client application which uses Assembly1 say Client1
You installed the client in C:\MyApp1 and also placed Assembly1 in this folder
After some days you changed Assembly1
You now created another application Client2 which uses this changed Assembly1
You installed Client2 in C:\MyApp2 and also placed changed Assembly1 in this folder
Since both the clients are referring to their own versions of Assembly1 everything goes on smoothly
Now consider the case when you develop assembly that is shared one. In this case it is important to know how assemblies are versioned. All assemblies has a version number in the form:
major.minor.build.revision
If you change the original assembly the changed version will be considered compatible with existing one if the major and minor versions of both the assemblies match.
When the client application requests assembly the requested version number is matched against available versions and the version matching major and minor version numbers and having most latest build and revision number are supplied.
27) -What is shared and private assembly
Ans:- The assembly which is used only by a single application is called as private assembly. Suppose you created a DLL which encapsulates your business logic. This DLL will be used by your client application only and not by any other application. In order to run the application properly your DLL must reside in the same folder in which the client application is installed. Thus the assembly is private to your application.
Suppose that you are creating a general purpose DLL which provides functionality which will be used by variety of applications. Now, instead of each client application
having its own copy of DLL you can place the DLL in 'global assembly cache'. Such assemblies are called as shared assemblies.
28) -What are asynchronous callbacks
Ans:- call server-side code from the client-side without invoking a Page postback.
Imagine that you need to do client-side e-mail validation in your page; not just regex validation; real stuff. You have to do a real-time check to confirm that the mail address exists. Here's how you could do that using Asynchronous Callbacks.
1) Implement an Interface
In your page you implement the System.Web.UI.ICallbackEventHandler interface and add code for the RaiseCallbackEvent method which is a method that receives an Asynch call (as a string) and returns data to the callee (again as a string).
<%@ Implements Interface="System.Web.UI.ICallbackEventHandler" %>
' ICallbackEventHandler implementation
Protected Function RaiseCallbackEvent(ByVal arg As String) As String _
Implements ICallbackEventHandler.RaiseCallbackEvent
If IsNumeric(arg) Then
Return "Good Data"
Else
Throw New ArgumentException("You cannot use that type of data. Must be numeric.")
End If
End Function
2) Do the wiring-up
There's a method on the Page class which emits a javascript string suitable for calling the RaiseCallbackEvent method asynchronously. The method is named: "GetCallbackEventReference". To use it you basically tell it what client-side method will handle the callback and another client-side method to call just in case an error occurs.
' a string which will hold the callback javascript
Public Atts As String
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
If Not IsPostBack Then
' __CallbackHandler is a javascript method to callback
' __CallbackError is a javascript method to callback in case an error occurs
Atts = Me.GetCallbackEventReference(Me, "myClientSideVar", "__CallbackHandler", _
Nothing, "__CallbackError")
End If
End Sub
3) Invoke the call from the client
Add some client-side functions to: A) invoke the asynch. callback, B) receive the asynch. response, C) handle and errors. Note that the names match the names which were passed to the GetCallbackEventReference method on the server.
// a processing function which requires an asynch call
function DoStuff() {
alert("about to do callback")
var myClientSideVar = txtField.value ;
<%= Atts %> // this will write out the javascript to invoke the callback
alert("just did the callback")
}
// the callback function
function __CallbackHandler(result, context) {
alert( result ) ;
}
// the callback function in case of an error
function __CallbackError(message, context) {
alert( "An error occurred: " + message ) ;
}
So now, whenever the DoStuff() function is called, an asynch call will be made and processing will continue on through to the end of DoStuff. Eventually the callback will return through either "__CallbackHandler" or "__CallbackError".
29) -How to write unmanaged code and how to identify whether the code is managed/ unmanaged.
Ans:- All the components that are developed using the languages that are not supported by the CLS are called unmanaged code that means which is not viable to run under the CLR. All the COM components are unmanaged and all the ASSEMBLIES are managed. We can even run the unmanged code components in the CLR using ComCallableWrapper class.
30) -How to authenticate users using web.config
Ans:- if we are using form based authentication at that time in the web.config we can set the autentication mode to "form" then we can specify the user name and password which we are going to access. if any one can access that application then you can specify
inside the authentication tags
Forms authentication can be done at web.config
31) -What is strong name and which tool is used for this
Ans:- If you want to design an assembly which is used by more than one application then that assembly should be assigned a strong name. sn.exe is used to generate a strong name.
A common use of attributes is to provide a strong name for an assembly. assemblies that have a strong name can be placed in the global assembly cache. The global assembly cache enables a single assembly to be shared among multiple projects. The global assembly cache can be used to share multiple copies of the same assembly,tool for that command
---sn -k mykey.snk
and then add this key in assembly information like
[assembly: AssemblyKeyFile("mykey.snk")]
and paste in global assembly catch like
---gacutil /i filename.dll
32) -What is gacutil.exe. Where do we store assemblies
Ans:- gacutil is a toll that will list, install, and uninstall assemblies in the GAC.
33) -Should sn.exe be used before gacutil.exe
Ans:- Yes. It is mandatory to assign the strong name to the assembly before placing it into the GAC. The stron name contains the public key to recognize by the GAC for whom the request comes.
Note : GAC is a special area where more than one same named assemblies may be placed having different versions.
34) -What does assemblyinfo.cs file consists of
Ans:- Assemblyinfo.cs is the file that will be created by the .net runtime where the information like version number, strong name,signature details of the assembly will be
stored in.
35) -What is boxing and unboxing
Ans:-boxing is conversion from value type to object(reference) type.Actually the copy of value type copied from stack to heap memory.
unboxing is reverse of it.from heap memory back to stack memory.
36) -Types of authentications in ASP.NET
Ans:- Forms Authentication:This authentication mode is based on cookies where the user name and the password are stored either in a text file or the database
Windows Authentication:This is the default authentication mode in ASP.NET. Using this mode, a user is authenticated based on his/her Windows account.
Passport Authentication:Passport authentication is a centralized authentication service that uses Microsoft's Passport Service to authenticate the users of an application.
37) -difference between Trace and Debug
Ans:- Debug only works in debug mode and trace works in debug and release both mode.
38) -Difference between Dataset and DataReader
Ans:-DataReader
Datareader is like a forward only recordset. It fetches one row at a time so very less Network Cost compare to DataSet (Fetches all the rows at a time). DataReader is readonly so we cannot do any transaction on them. DataReader will be the best choice where we need to show the data to the user which requires no transaction ie reports. Due to DataReader is forward only we cannot fetch the data randomly. .NET Dataproviders optimizes the datareaders to handle the huge amount of data.
DataSet
DataSet is always a bulky object that requires lot of memory space compare to DataReader. We can say the dataset as a small database coz it stores the schema and data in the application memory area. DataSet fetches all data from the datasource at a time to its memory area. So we can traverse through the object to get required data like qureying database.
39) -What is custom tag in web.config
Ans:- Custom tag allows you to create your own tag and specify key value pair for it.
40) What is ASP.NET 2.0 Page Life Cycle?
Ans:- Main Events
=============
1. OnPreInit
2. OnInit
3. OnInitComplete
4. LoadViewState
5. OnPreLoad
6. OnLoad
7. RaisePostBackEvent
8. OnLoadComplete
9. OnPreRender
10. OnPreRenderComplete
11. SaveViewState
12. OnRender
13. OnUnload
Detailed Events
============
1. Constructor
2. Construct
3. TestDeviceFilter
4. AddParsedSubObject
5. DeterminePostBackMode
6. OnPreInit
7. LoadPersonalizationData
8. InitializeThemes
9. OnInit
10. ApplyControlSkin
11. ApplyPersonalization
12. OnInitComplete
13. LoadPageStateFromPersistenceMedium
14. LoadControlState
15. LoadViewState
16. ProcessPostData1
17. OnPreLoad
18. OnLoad
19. ProcessPostData2
20. RaiseChangedEvents
21. RaisePostBackEvent
22. OnLoadComplete
23. OnPreRender
24. OnPreRenderComplete
25. SavePersonalizationData
26. SaveControlState
27. SaveViewState
28. SavePageStateToPersistenceMedium
29. Render
30. OnUnload
41) How to use trace in libraray classes (like BAL, DAL)?
Ans:- Use following code to use Trace.Warn, Trace.Write etc.
System.Web.HttpContext.Current.Trace
42) What is MVC (Model View Controller) pattern?
Ans:- The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes [Burbeck92]:
Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).
View. The view manages the display of information.
Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.
43) What are session management techniques in .NET?
Ans:- There are three different techniques of managing session in ASP.NET
InProc
Session state is stored locally in memory of ASP.NET worker process.
StateServer
Session state is stored outside ASP.NET worker process and is managed by Windows service. Location of this service is specified by stateConnectionString attribute.
SQLServer
Session state is stored outside ASP.NET worker process in SQL Server database. Location of this database is represented by sqlConnectionString attribute.
44) Is overriding of a function possible in the same class?
Ans:- No
45) What is lock statement in C#?
Ans:- Lock ensures that one thread does not enter a critical section of code while another thread is in the critical section. If another thread attempts to enter a locked code, it will wait, block, until the object is released.
46) What is the use of Monitor in C#?
Ans:- It provides a mechanism that synchronizes access to objects.
The Monitor class controls access to objects by granting a lock for an object to a single thread. Object locks provide the ability to restrict access to a block of code, commonly called a critical section. While a thread owns the lock for an object, no other thread can acquire that lock. You can also use Monitor to ensure that no other thread is allowed to access a section of application code being executed by the lock owner, unless the other thread is executing the code using a different locked object.
47) What is static constructor?
Ans:- Static constructor is used to initialize static data members as soon as the class is referenced first time, whereas an instance constructor is used to create an instance of that class with keyword. A static constructor does not take access modifiers or have parameters and can't access any non-static data member of a class.
48) What data types do the asp:RangeValidator control support?
Ans:- Currency, Date, Double, Integer, String
49) What is ViewState?
Ans:- ViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used to retain the state of server-side objects between postabacks.
50) -How do you define authentication in web.Config
Ans:-
51) -What is sequence of code in retrieving data from database
Ans:- if you use sql server
SqlConnection con = new SqlConnection();
con.ConnectionString ="Data Source=servername;Initial
Catalog=databasename;";
con.Open();
String sql;
sql ="select * from tbl_tablename";
SqlCommand cmd = new SqlCommand(sql,con);
SqlDataReader reader;
reader = cmd.ExecuteReader();
while(reader.Read)
{
Console.WriteLine("Field1:"+read.GetString(0));
Console.WriteLine("Field1:"+read.GetString(1));
Console.WriteLine("Field1:"+read.GetValue(2));
}
con.Close();
}
52) -About DTS package?
Ans:- Data Transformation Services (DTS) provides a set of tools that lets you extract, transform, and consolidate data from disparate sources into single or multiple destinations.we can create a DTS solution as one or more packages. Each package may contain an organized set of tasks that define work to be performed, transformations on data and objects, workflow constraints that define task execution, and connections to data sources and destinations. DTS packages also provide services, such as logging package execution details, controlling transactions, and handling global variables.
53) -What provider ADO.net use by default
Ans:- SQLclient is the default provider of ADO.Net.
54) -Where does web.config info stored? Will this be stored in the registry?
Ans:- web.config contains authorization/authentication session related information.It is stored in the root directory of your application.Optionalyy you individual web.config can be created in each sub directory of your project if required.
55) -How do you register the dotnet component or assembly?
Ans:- The steps to register a dot net component is:
The command line instruction to create a strong name.
sn -k ComInterOp.snk.
Strong name is a unique name created by hashing a 128-bit encryption key against the name of the Assembly (ComInterOp in our case). The strong name is created using SN.exe, that would create ComInterOp.snk file, which we would use while creating the DotNet Assembly.
The command line instruction to create an assembly using the strong name
vbc /out:ComInterOp.dll /t:library /keyfile:ComInterOp.snk
Assembly Registration Tool.
The Assembly Registration Tool (Regasm.exe), reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create DotNet Framework classes transparently. The Assembly Registration tool can generate and register a type library when you apply the /tlb: option. COM clients require that type libraries be installed in the Windows registry. Without this option, Regasm.exe only registers the types in an assembly, not the type library. Registering the types in an assembly and registering the type library are distinct activities.
The command line instruction to create and register ComINterOp.tlb(Type Library) is
regasm ComInterOp.dll /tlb:ComInterOp.tlb.
The DotNet Services Installation Tool (Regsvcs.exe)
The command line instruction to install ComINterOp.dll in GAC is
Gacutil -i ComInterOp.dll.
56) -Difference between asp and asp.net?
57) -Whis is stateless asp or asp.net?
Ans:- Both ASP and ASP.NET are stateless. Because both ASP and ASP.NET uses HTTP protocol which is stateless.
58) -Authentication mechanism in dotnet
Ans:- there r thrr type of authentication mechanism in asp.net:
Form Authentication
Window Authentication
Passport Authentication
Authentication refers to the method used by the server to verify the clients’ identity. This feature provides methods to authenticate clients via a set of standardized and
reusable methods that require little or no modification. The methods available to developers are:
None – This method does nothing.
Windows Authentication – Attempts to verify users by validating supplied credentials using authentication methods used by the Windows operating system. This includes
NTLM (NT LanMan) and Kerberos (for systems running versions more current than Windows NT 4.0). Windows authentication is used by default if no method is explicitly selected.
IIS Authentication – Uses authentication methods provided by the IIS Web server.
Passport Authentication – Verifies users through the use of the Microsoft Passport authentication server.
Forms Authentication – Allows for application developers to provide a form for authenticating users in a standardized way. User accounts can be made specific to the application and stored in the web.config file.
59) -State management in asp.net
Ans:- State management is the process by which you maintain state and page information over multiple requests for the same or different pages.
Types of State Management
There are 2 types State Management:
1. Client – Side State Management
This stores information on the client's computer by embedding the information into a Web page, a uniform resource locator(url), or a cookie. The techniques available to store the state information at the client end are listed down below:
a. View State – Asp.Net uses View State to track the values in the Controls. You can add custom values to the view state. It is used by the Asp.net page framework to automatically save the values of the page and of each control just prior to rendering to the page. When the page is posted, one of the first tasks performed by page processing is to restore view state.
b. Control State – If you create a custom control that requires view state to work properly, you should use control state to ensure other developers don’t break your control by disabling view state.
c. Hidden fields – Like view state, hidden fields store data in an HTML form without displaying it in the user's browser. The data is available only when the form is processed.
d. Cookies – Cookies store a value in the user's browser that the browser sends with every page request to the same server. Cookies are the best way to store state data that must be available for multiple Web pages on a web site.
e. Query Strings - Query strings store values in the URL that are visible to the user. Use query strings when you want a user to be able to e-mail or instant message state data with a URL.
2. Server – Side State Management
a. Application State - Application State information is available to all pages, regardless of which user requests a page.
b. Session State – Session State information is available to all pages opened by a user during a single visit.
Both application state and session state information is lost when the application restarts. To persist user data between application restarts, you can store it using profile properties.
Advantages of Client – Side State Management:
1. Better Scalability: With server-side state management, each client that connects to the Web server consumes memory on the Web server. If a Web site has hundreds or thousands of simultaneous users, the memory consumed by storing state management information can become a limiting factor. Pushing this burden to the clients removes that potential bottleneck.
2. Supports multiple Web servers: With client-side state management, you can distribute incoming requests across multiple Web servers with no changes to your application because the client provides all the information the Web server needs to process the request. With server-side state management, if a client switches servers in the middle of the session, the new server does not necessarily have access to the client’s state information. You can use multiple servers with server-side state management, but you need either intelligent load-balancing (to always forward requests from a client to the same server) or centralized state management (where state is stored in a central database that all Web servers access).
Advantages of Server – Side State Management:
1. Better security: Client-side state management information can be captured (either in transit or while it is stored on the client) or maliciously modified. Therefore, you should never use client-side state management to store confidential information, such as a password, authorization level, or authentication status.
2. Reduced bandwidth: If you store large amounts of state management information, sending that information back and forth to the client can increase bandwidth utilization and page load times, potentially increasing your costs and reducing scalability. The increased bandwidth usage affects mobile clients most of all, because they often have very slow connections. Instead, you should store large amounts of state management data (say, more than 1 KB) on the server.
60) -Types of values mode can hold session state in web.config
Ans:- Types of values mode can hold in sesssion state are:
-InProc :-which stores session state in memory on the Web server. This is the default.
-StateServer :-which stores session state in a separate process called the ASP.NET state service.
-SQLServer :-stores session state in a SQL Server database.
-Custom :-which enables to specify a custom storage provider.
-Off :- which disables session state.
61) - About WebService -What are Http handler
Ans:- An ASP.NET HTTP handler is the process (frequently referred to as the "endpoint") that runs in response to a request made to an ASP.NET Web application. The most common handler is an ASP.NET page handler that processes .aspx files. When users request an .aspx file, the request is processed by the page via the page handler.
To create a custom HTTP handler, you create a class that implements the IHttpHandler interface to create a synchronous handler or the IHttpAsyncHandler to create an asynchronous handler. Both handler interfaces require you to implement the IsReusable property and the ProcessRequest method. The IsReusable property specifies whether the IHttpHandlerFactory object (the object that actually calls the appropriate handler) can place your handlers in a pool and reuse them to increase performance, or whether it must create new instances every time the handler is needed. The ProcessRequest method is responsible for actually processing the individual HTTP requests.
62) -What is view state and how this can be done and was this there in asp?
63) -Types of optimization and name a few and how do u do?
Ans:- For SQL --
Heuristic Optimization
Syntactical Optimization
Cost-Based Optimization
Semantic Optimization
64) - About DataAdapters -Features of a dataset?
65) -How do you do role based security
Ans:- 1.Create a principle object which contains users identity (login name) and array of roles
2.and pass this object to HttpContext.Current.User
3.The roles supplied to this object will be checked against roles specified in the web.config file,if they matched then they are allowed access to the page otherwise not.
allowed roles can be specified like this in web.config
66) -Difference between Response.Expires and Expires.Absolute
Ans:- Response.Expires specifies the lenght of the time ie 20 seconds
Response.ExpiresAbsolute specifies the time ie 12:12:10
************************
Response.expires:
Sets the expiration date for the current page expressed as the number of minutes from the current time.
Usage
Sets the expiration date for the current page. The expiration date is used by a HTTP client to determine whether and how long the content of the page can be cached locally. This property is an integer value with its definition defined in the table below.
Value Description
> 0 The number of minutes from the current server time that the page content expires.
< 0 The content expires immediately
= 0 No content expiration is specified. This is generally interpreted by the client as the content expires immediately.
************************
Response.expiresAbsolute
Sets the expiration date for the current page to a specific date and time.
Usage
Sets the expiration date for the current page. The expiration date is used by a HTTP client to determine whether and how long the content of the page can be cached locally. This property is a date value that specifies the absolute date and time the page content expires. If this property is set to null then no expiration date is sent to the client.
// Page content expires on Jan. 1, 2006
Response.expiresAbsolute = new Date(2006, 0, 1);
// Clear the content expiration
Response.expiresAbsolute = null;k
67) -Types of object in asp
68) -About duration in caching technique
69) -Types of configuration files and ther differences?
Ans:- app.config-> contains application specific settings
web.config
Web.config is a security in ASP.Net application and how to secure applications. Web.config does most of the work for the application the who, what, where, when and how to be authenticated.
1.This is automatically created when you create an ASP.Net web application project.
2.This is also called application level configuration file.
3.This file inherits setting from the machine.config
Machine.config contains settings that apply to an entire computer. This file is located in the %runtime install path%\Config directory. Machine.config contains configuration
settings for machine-wide assembly binding, built-in remoting channels.
1.This is automatically installed when you install Visual Studio. Net.
2.This is also called machine level configuration file.
3.Only one machine.config file exists on a server.
4.This file is at the highest level in the configuration hierarchy.
70)- What is the difference between DataList and Repeater data binding controls?
Answer: The DataList control is similar to the Repeater control. However, it has some additional properties and templates that you can use to display its data in a diverse fashion. The Repeater control does not have any built-in layout or style. We are forced to specify all formatting-related HTML elements and style tags. On the other hand, a DataList control provides more flexibility to display data in a desired layout. It also provides data selection and editing capabilities. How does it do it? Well, in addition to the five templates (Item Template, AlternatingItem Template, Separator Template, Header Template, Footer Template that a repeater has, the DataList control has two more templates: SelectedItemTemplate, and EditItemTemplate. These templates are useful for allowing data selection and data editing functionalities.
Furthermore, the RepeatDirection and RepeatColumns properties of a DataList control can be exploited to lay out the data in horizontal or vertical fashions.
71) What are Aggregate functions? Explain Aggregate functions in SQL SERVER 2008 with example.
Ans Aggregate functions are applied to a group of data values from a column. Aggregate functions always return a single value.
SQL SERVER 2008 / Transact-SQL supports following aggregate functions:
AVG: Calculates the arithmetic mean (average) of the data values contained within a column. The column must contain numeric values.
MAX and MIN: Calculate the maximum and minimum data value of the column, respectively. The column can contain numeric, string, and date/time values.
SUM: Calculates the total of all data values in a column. The column must contain numeric values.
COUNT: Calculates the number of (non-null) data values in a column. The only aggregate function not being applied to columns is COUNT(*). This function returns the number of rows (whether or not particular columns have NULL values).
COUNT_BIG: New and Analogous to COUNT, the only difference being that COUNT_BIG returns a value of the BIGINT data type.
Aggregate function Example:
SELECT ProjectName, SUM(budget) TotalBudget FROM Project_Tbl GROUP BY ProjectName;
72) Name the Basic or Default Databases of SQL SERVER and What are their functions and use.?
Ans) Microsoft SQL SERVER Provides 4 default databases
The Master database holds information for all databases located on the SQL Server instance and is the glue that holds the engine together. Because SQL Server cannot start without a functioning master database, you must administer this database with care.
The tempdb holds temporary objects such as global and local temporary tables and stored procedures. The model is essentially a template database used in the creation of any new user database created in the instance.
The msdb database stores information regarding database backups, SQL Agent information, DTS packages, SQL Server jobs, and some replication information such as for log shipping.
SQL Server 2008 advantages for Developers
Microsoft has released a new version of its popular Database management system (SQL Server). It is Microsoft SQL Server 2008. So what are the benefits of SQL SERVER 2008 for Developers & Programmers.
73) SQL Management Studio improvements including IntelliSense.
New Data Types for just dates or times (no more storing time when you only need the date).
New Hierarchical data support .IsDescendent(), that can automatically pull a hierarchical view of data (no more custom recursive queries).
New Grouping Sets statement which enables you to automatically group dimensions in a query for easy aggregation and reporting.
New Merge statement which provides automatic insert/update semantics for keeping multiple data sources in sync.
New data types and support for Geodata and geometry.
New support for optimizing "empty" or row/column tables using the sparse keyword.
New FileStream attribute that enables you to include files that are stored in the server file system, but can be managed by SQL Server.
74) Value types VS Reference types C#
What is difference between Value types and Reference types in VB.NET or C# (Value types VS Reference types)
C# provides two types—class and struct, class is a reference type while the other is a value type. Here is difference between Value types and Reference types.
Value types directly contain their data which are either allocated on the stack or allocated in-line in a structure. Reference types store a reference to the value's memory address, and are allocated on the heap. With reference types, an object is created in memory, and then handled through a separate reference—rather like a pointer.
Reference types can be self-describing types, pointer types, or interface types. Primitive types such as int, float, bool and char are value types.
Variables that are value types each have their own copy of the data, and therefore operations on one variable do not affect other variables. Variables that are reference types can refer to the same object; therefore, operations on one variable can affect the same object referred to by another variable.
Value types have a default implied constructor that initializes the default value. Reference types default to a null reference in memory.
Value types derive from System.ValueType. Reference types derive from System.Object.
Value types cannot derive a new type from an existing value type, except for structs. Reference types can derive a new type from an existing reference type as well as being able to implement interfaces.
75) Multiple - Language Development in .NET Framework
.NET Framework encourages cross-language development using multiple programming languages. To become a .NET language, any language should have a compiler that translates the source code written in different languages into Microsoft Intermediate Language (MSIL).
MSIL code is called as Managed Code. Managed code runs in .NET environment.
In .Net framework the Common Runtime Language (CLR) contains a couple of just-in-time compilers (JIT) which can understand IL Code (managed Code), and can convert IL to native code (binary code targeted at a specific machine processor).
Hence any language with IL Code generating compiler can become a .Net language
76) Explain the delegates in C#.
Delegates in C# are objects which points towards a function which matches its signature. Delegates are reference type used to encapsulate a method with a specific signature. Delegates are similar to function pointers in C++; however, delegates are type-safe and secure.
Here are some features of delegates:
A delegate represents a class.
A delegate is type-safe.
We can use delegates both for static and instance methods
We can combine multiple delegates into a single delegate.
Delegates are often used in event-based programming, such as publish/subscribe.
We can use delegates in asynchronous-style programming.
We can define delegates inside or outside of classes.
Syntax of using delegates
//Declaring delegate
delegate void SampleDelegate(string message);
// declare method with same signature:
static void SampleDelegateMethod(string message) { Console.WriteLine(message); }
// create delegate object
SampleDelegate d1 = SampleDelegateMethod;
// Invoke method with delegate
d1("my program");
77) What is the purpose of connection pooling in ADO.NET?
Connection pooling enables an application to use a connection from a pool of connections that do not need to be re-established for each use. Once a connection has been created and placed in a connection pool, an application can reuse that connection without performing the complete connection creation process.
By default, the connection pool is created when the first connection with a unique connection string connects to the database. The pool is populated with connections up to the minimum pool size. Additional connections can be added until the pool reaches the maximum pool size.
When a user request a connection, it is returned from the pool rather than establishing new connection and, when a user releases a connection, it is returned to the pool rather than being released. But be sure than your connections use the same connection string each time. Here is the Syntax
conn.ConnectionString = "integrated Security=SSPI; SERVER=192.168.0.123; DATABASE=MY_DB; Min Pool Size=4;Max Pool Size=40;Connect Timeout=14;";
78) What is the difference between classes and structs in Microsoft.Net?
A struct is a value type, while a class is a reference type.
When we instantiate a class, memory will be allocated on the heap. When struct gets initiated, it gets memory on the stack.
Classes can have explicit parameter less constructors. But structs cannot have this.
Classes support inheritance. But there is no inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.
We can assign null variable to class. But we cannot assign null to a struct variable, since structs are value type.
We can declare a destructor in class but can not in struct.
79) What is a Strong Name in Microsoft.Net?
In Microsoft.Net a strong name consists of the assembly's identity. The strong name guarantees the integrity of the assembly. Strong Name includes the name of the .net assembly, version number, culture identity, and a public key token. It is generated from an assembly file using the corresponding private key.
Steps to create strong named assembly:
To create a strong named assembly you need to have a key pair (public key and a private key) file. Use sn -k KeyFile.snk
Open the dot net project to be complied as a strong named assembly. Open AssembyInfo.cs/ AssembyInfo.vb file. Add the following lines to AssemblyInfo file.
[Assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("..\\..\\KeyFile.snk")]
Compile the application, we have created a strong named assembly.
80) Explain ACID properties of the database?
All Database systems which include transaction support implement ACID properties to ensure the integrity of the database. ACID stands for Atomicity, Consistency, Isolation and Durability
Atomicity: Each transaction is said to be “atomic.” If one part of the transaction fails, the entire transaction fails. Modifications on the data in the database either fail or succeed.
Consistency: This property ensures that only valid data will be written to the database. If, for some reason, a transaction is executed that violates the database’s consistency rules, the entire transaction will be rolled back and the database will be restored to a state consistent with those rules.
Isolation: It requires that multiple transactions occurring at the same time not impact each other’s execution.
Durability: It ensures that any transaction committed to the database will not be lost.
81) What is the basic functionality of Garbage Collector in Microsft.Net?
The Common Language Runtime (CLR) requires that you create objects in the managed heap, but you do not have to bother with cleaning up the memory once the object goes out of the scope or is no longer needed. The Microsoft .NET Framework Garbage Collector provides memory management capabilities for managed resources. The Garbage Collector frees objects that are not referenced and reclaims their memory. You should set your references to Nothing(null) as soon as you are done with them to ensure your objects are eligible for collection as soon as possible.
Here are the list of some tasks performed by the Garbage collector:
Garbage collector reserves a piece of memory as the application starts for the managed heap.
Garbage collector controls the managed heap memory currently used and available to an application.
Garbage collector allocates memory for new objects within the application.
The Garbage Collector attempts to reclaim the memory of objects that are not referenced.
82) What is a static class?
We can declare a static class. We use static class when there is no data or behavior in the class that depends on object identity. A static class can have only static members. We can not create instances of a static class using the new keyword. .NET Framework common language runtime (CLR) loads Static classes automatically when the program or namespace containing the class is loaded.
Here are some more features of static class
Static classes only contain static members.
Static classes can not be instantiated. They cannot contain Instance Constructors
Static classes are sealed.
83) What is static member of class?
A static member belongs to the class rather than to the instances of the class. In C# data fields, member functions, properties and events can be declared static. When any instances of the class are created, they cannot be used to access the static member.
To access a static class member, use the name of the class instead of an instance variable
Static methods and Static properties can only access static fields and static events.
Like: int i = Car.GetWheels;
Here Car is class name and GetWheels is static property.
Static members are often used to represent data or calculations that do not change in response to object state
84) What is the purpose of Server.MapPath method in Asp.Net?
In Asp.Net Server.MapPath method maps the specified relative or virtual path to the corresponding physical path on the server. Server.MapPath takes a path as a parameter and returns the physical location on the hard drive. Syntax
Suppose your Text files are located at D:\project\MyProject\Files\TextFiles
If the root project directory is MyProject and the aspx file is located at root then to get the same path use code
//Physical path of TextFiles
string TextFilePath=Server.MapPath("Files/TextFiles");
85)-Difference between ADO and ADO.net
Ans:- ? ADO works with connected data. This means that when you access data, such as viewing and updating data, it is real-time, with a connection being used all the time. This is barring, of course, you programming special routines to pull all your data into temporary tables.
ADO.NET uses data in a disconnected fashion. When you access data, ADO.NET makes a copy of the data using XML. ADO.NET only holds the connection open long enough to either pull down the data or to make any requested updates. This makes ADO.NET efficient to use for Web applications. It's also decent for desktop applications.
? ADO has one main object that is used to reference data, called the Recordset object. This object basically gives you a single table view of your data, although you
can join tables to create a new set of records. With
ADO.NET, you have various objects that allow you to access data in various ways. The Dataset object will actually allow you to store the relational model of your database.
This allows you to pull up customers and their orders, accessing/updating the data in each related table individually.
? ADO allows you to create client-side cursors only, whereas ADO.NET gives you the choice of either using client-side or server-side cursors. In ADO.NET, classes actually handle the work of cursors. This allows the developer to decide which is best. For Internet development, this is crucial in creating efficient applications.
? Whereas ADO allows you to persist records in XML format, ADO.NET allows you to manipulate your data using XML as the primary means. This is nice when you are working with other business applications and also helps when you are working with firewalls because data is passed as HTML and XML.
86) - About Postback -If you are calling three SPs from a window application how do u check for the performance of the SPS #61607; Database
87) - What is normalization?
Ans:- Database normalization is a technique for designing relational database tables to minimize duplication of information and, in so doing, to safeguard the database
against certain types of logical or structural problems, namely data anomalies.
For example, when multiple instances of a given piece of information occur in a table, the possibility exists that these instances will not be kept consistent when the data
within the table is updated, leading to a loss of data integrity. A table that is sufficiently normalized is less vulnerable to problems of this kind, because its structure
reflects the basic assumptions for when multiple instances of the same information should be represented by a single instance only.
88) -What is an index and types of indexes. How many number of indexes can be used per table ?
Ans :- Indexs are used for the faster retrivel of data. two types of indexesCluster index,unclustered indexwe can have one cluster index and uotp 249 cluster indexes
for a table
89) -What is a constraint. Types of constraints?
Ans:- constraint are nothing but a conditions,in other words enforcing the business rules into the database.types of constraits:
1)check constraint
2)unique constraint
3)primary key
4)foreign key
5)Not null
6)Default
90) -What are code pages?
Ans:-
91) What is referential integrity?
Ans:- 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.
Consider the situation where we have two tables: Employees and Managers. The Employees table has a foreign key attribute entitled ManagedBy which points to the record for that employee’s manager in the Managers table. Referential integrity enforces the following three rules:
1. We may not add a record to the Employees table unless the ManagedBy attribute poi
2. nts to a valid record in the Managers table. If the primary key for a record in the Managers table changes, all corresponding records in the Employees table must be modified using a cascading update.
3. If a record in the Managers table is deleted, all corresponding records in the Employees table must be deleted using a cascading delete
92) -What is a trigger?
Ans:-
93)-What are different types of joins?
Ans:- First of all take a look on the names of different types of joins in SQL.
Inner Join
Outer Join
Left Outer Join
Right Outer Join
Full Outer Join
Cross Join
Joins in SQL Server allows the retrieval of data records from one or more tables having some relation between them. Logical operators can also be used to drill down the number of records to get the desired output from sql join queries.
Inner Join: Inner Join is a default type join of SQL Server. It uses logical operators such as =, <, > to match the records in two tables. Inner Join includes equi join and natural joins.
Outer Join: Outer Join has further 3 sub categories as left, right and full. Outer Join uses these category names as keywords that can be specified in the FROM clause.
Left Outer Join: Left Outer Join returns all the rows from the table specified first in the Left Outer Join Clause. If in the left table any row has no matching record in the right side table then that row returns null column values for that particular tuple.
Right Outer Join: Right Outer Join is exactly the reverse method of Left Outer Join. It returns all the rows from right table and returns null values for the rows having no match in the left joined table.
Full Outer Join: Full outer join returns all the rows from both left and right joined tables. If there is any match missing from the left table then it returns null column values for left side table and if there is any match missing from right table then it returns null value columns for the right side table.
Cross Join: Cross join works as a Cartesian product of rows for both left and right table. It combined each row of left table with all the rows of right table.
93)-What is a self join?
Ans:- A self-join is a query in which a table is joined (compared) to itself. Self-joins are used to compare values in a column with other values in the same column in the same table. One practical use for self-joins: obtaining running counts and running totals in an SQL query.
To write the query, select from the same table listed twice with different aliases, set up the comparison, and eliminate cases where a particular value would be equal to itself.
Which customers are located in the same state (column name is Region)? Type this statement in the SQL window:
SELECT DISTINCT c1.ContactName, c1.Address, c1.City, c1.Region
FROM Customers AS c1, Customers AS c2
WHERE c1.Region = c2.Region
AND c1.ContactName <> c2.ContactName
ORDER BY c1.Region, c1.ContactName;
94)- What is the default “SORT” order for a SQL?
Ans:- ASCENDING
95) Can you name some aggregate function is SQL Server?
Ans:- Some of them which every interviewer will expect: -
• AVG: - Computes the average of a specific set of values, which can be an expression list or a set of data records in a table.
• SUM: - Returns the sum of a specific set of values, which can be an expression list or a set of data records in a table.
• COUNT: - Computes the number of data records in a table.
• MAX: - Returns the maximum value from a specific set of values, which can be an expression list or a set of data records in a table.
• MIN: - Returns the minimum value from a specific set of values, which can be an expression list or a set of data records in a table.
96) How do you select unique rows using SQL?
Ans:- Using the “DISTINCT” clause. For example if you fire the below give SQL in “AdventureWorks” , first SQL will give you distinct values for cities , while the other will give you distinct rows.
97) How do you sort in SQL?
Ans:- Using the “ORDER BY” clause, you either sort the data in ascending manner or descending manner.
98) You want to select the first record in a given set of rows?
Ans:- Select top 1 * from sales. salesperson
99) What is “CROSS JOIN”? OR What is Cartesian product?
Ans:- “CROSS JOIN” or “CARTESIAN PRODUCT” combines all rows from both tables. Number of rows will be product of the number of rows in each table. In real life scenario, I cannot imagine where we will want to use a Cartesian product. However, there are scenarios where we would like permutation and combination probably Cartesian would be the easiest way to achieve it.
100) What is a DDL, DML and DCL concept in RDBMS world?
Ans:- DDL (Data definition language) defines your database structure. CREATE and ALTER are DDL statements as they affect the way your database structure is organized.
DML (Data Manipulation Language) lets you do basic functionalities like INSERT, UPDATE, DELETE and MODIFY data in database.
DCL (Data Control Language) controls you DML and DDL statements so that your data is protected and has consistency. COMITT and ROLLBACK are DCL control statements. DCL guarantees ACID fundamentals of a transaction.
101) How to import table using “INSERT” statement?
Ans:- I have made a new temporary color table which is flourished using the below SQL. Structures of both the table should be same in order that this SQL executes properly.
INSERT INTO TempColorTable SELECT code,ColorValue FROM ColorTable
102) What is Cascade and Restrict in DROP table SQL? OR What is “ON DELETE CASCADE” and “ON DELETE RESTRICT”?
Ans:- RESTRICT specifies that table should not be dropped if any dependencies (i.e. triggers, stored procedure, primary key, foreign key etc) exist. Therefore, if there are dependencies then error is generated and the object is not dropped.
CASCADE specifies that even if there dependencies go ahead with the drop. That means drop the dependencies first and then the main object. So if the table has stored procedures and keys (primary and secondary keys) they are dropped first and then the table is finally dropped.
103) What are “GRANT” and “REVOKE’ statements?
Ans:- GRANT statement grants rights to the objects (table). While revoke does the vice-versa of it, it removes rights from the object.
104) How can we consume data directly in web services?
Ans:- We can consume data directly using ‘Sys.Data’ controls.
105) Difference b/w IDENT_CURRENT, @@IDENTITY, SCOPE_IDENTITY?
Ans: IDENT_CURRENT returns the last identity value generated for a specific table in any session and any scope.
@@IDENTITY returns the last identity value generated for any table in the current session, across all scopes.
SCOPE_IDENTITY returns the last identity value generated for any table in the current session and the current scope.
How do we do exception handling in Ajax?
How can you do validations in Ajax?
Can you explain the ‘UpdateProgress’ component?
Can you explain the concept of triggers in ‘UpdatePanel’ control?
Can you explain Enablepartialrendering and UpdatePanel control in Ajax?
Can you explain Scriptmanager control in Ajax?
How do we reference HTML controls using Atlas?
How do we do inheritance-using Atlas? OR How do we define interfaces using Atlas?
How can we create a class in JavaScript using Atlas?
How do we pass parameters to the server?
What are the various states in XMLHttpRequest and how do we check the same? OR How can we get response text? OR How can we send request to the server using the XMLHttpRequest component?
How do we do asynchronous processing using Ajax?
How do we use XMLHttpRequest object in JavaScript?
How do we consume web service in Atlas?
-Authentication mechanisms in Sql Server
-What are user defined stored procedures.
-What is INSTEAD OF trigger
-Difference between SQL server 7.0 and 2000
-How to optimize a query that retrieves data by joining 4 tables
-Usage of DTS
-How to disable an index using select query
-Is non-clustered index faster than clustered index
-Types of optimization in querries
-Difference between ISQL and OSQL
-How you log an exception directly into sql serverwhat is used for this
-About Replication in Database
-What is the default optimization done in oracle and sql server
-How can i make a coulmn as unique
-How many no of tables can be joined in same sql server
-How many coulmns can exist per table
-About Sql Profiler usage
•HR & Project - About yourself -About work experience
-How long you are working on .NET
-Are you willing to relocate
-When will you join
-Why do u what to change from current organization
-Why do you want to join Accenture
-What are your weaknesses / areas of improvement
-What is your current project and your responsibilities
-Have you done database design / development
-What is D in ACID
#61656; Microsoft • HR (Screening) -Tell about yourself
-Tell about your work experience
-Tell about projects
-Tell about your current project and your role in it -What is your current salary p.a. • Technical #61607; .NET -How do you manage session in ASP and ASP.NET
-How do you handle session management in ASP.NET and how do you implement
them. How doyou handle in case of SQLServer mode.
-What are different authentication types. How doyou retreive user id in case of
windows authentication
-For a server control, you need to have same properties like color maxlength, size,
and allowed character throughout the application. How do you handle this.
-What is custom control. What is the difference between custom control and user
control
-What is the syntax for datagrid and specifying columns
-How do you add a javascript function for a link button in a datagrid.
-Does C# supports multi-dimensional arrays
-How to transpose rows into columns and columns into rows in a multi-
dimensional array
A
What are object oriented concepts
-How do you create multiple inheritance in C#
-ADO and ADO.NET differences
-Features and disadvantages of dataset
-What is the difference between and ActiveX dll and control
-How do you perform validations
-What is reflection and disadvantages of reflection
-What is boxing and how it is done internally
-Types of authentications in IIS
-What are the security issues if we send a query from the application
-Difference between ByVal and ByRef
-Disadvantages of COM components
-How do we invoke queries from the application
-What is the provider and namespaces being used to access oracle database
-How do you load XML document and perform validation of the document
-How do you access elements in XML document
-What is ODP.NET
-Types of session management in ASP.NET
-Difference between datareader and dataset
-What are the steps in connecting to database
-How do you register a .NET assembly
-Usage of web.config
-About remoting and web services. Difference between them
-Caching techniques in .NET
-About CLS and CTS
-Is overloading possible in web services
-Difference between .NET and previous version
-Types of chaching. How to implement caching
-Features in ASP.NET
-How do you do validations. Whether client-side or server-side validations are
better
-How do you implement multiple inheritance in .NET
Describe the difference between a Thread and a Process?
What is a Windows Service and how does its lifecycle differ from a “standard†EXE?
What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?
What is the difference between an EXE and a DLL?
What is strong-typing versus weak-typing? Which is preferred? Why?
What’s wrong with a line like this? DateTime.Parse(myString
What are PDBs? Where must they be located for debugging to work?
What is cyclomatic complexity and why is it important?
Write a standard lock() plus double check to create a critical section around a variable access.
What is FullTrust? Do GAC’ed assemblies have FullTrust?
What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?
What does this do? gacutil /l | find /i “about”
What does this do? sn -t foo.dll
What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
Contrast OOP and SOA. What are tenets of each
How does the XmlSerializer work? What ACL permissions does a process using it require?
Why is catch(Exception) almost always a bad idea?
What is the difference between Debug.Write and Trace.Write? When should each be used?
What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?
Does JITting occur per-assembly or per-method? How does this affect the working set?
Contrast the use of an abstract base class against an interface?
What is the difference between a.Equals(b) and a == b?
In the context of a comparison, what is object identity versus object equivalence?
How would one do a deep copy in .NET?
Explain current thinking around IClonable.
What is boxing?
Is string a value type or a reference type?