Interview Questions and Answers for freshers and Experienced by Satish Dadi
1.What is the
difference between Server.Transfer and Response.Redirect?
Server.Transfer is more faster than Response.Redirect
Reason :
Server.Transfer :
Process : Directly From Server.Transfer to Web Server
Response.Redirect :
Process : From Response.Redirect à Client Browser à Web Server
2. In which event of
page cycle is the ViewState available?
After Init and Before Page_Load
3. What is ViewState?
ViewState is used to maintain the
state through out the life time of a current page
4. What are the Page
Life Events?
1.Pre_Init
2.Init
3.Init_Complete
4.Page_Load
5.Page Events
6.Pre_Render
7.Render
8.UnLoadWhat is the difference between the System.Array.CopyTo() and System.Array.Clone()
Clear Coding :
int[] array1 = { 1, 2, 3, 4 };
int[] array2 = array1;
array2[2] = 5;
Console.WriteLine(array1[2]);
Console.WriteLine(array2[2]);
//Output :
//5
//5
int[] array1 = { 1, 2, 3, 4 };
int[] array2 = (int[])array1.Clone();
array2[2] = 5;
Console.WriteLine(array1[2]);
Console.WriteLine(array2[2]);
//Output :
//3
//5
int[] array1 = { 1, 2, 8, 4 };
int[] array2 = (int[])array1.Clone();
int[] array3 = new int[6];// Length should be (number of position(2)+array1Length(4))(6)
array1.CopyTo(array3, 2);
array2[2] = 5;
array3[3] = 11;
Console.WriteLine(array1[3]);
Console.WriteLine(array2[3]);
Console.WriteLine(array3[1]);
int[] array1 = { 1, 2, 3, 4 };
int[] array2 = array1;
array2[2] = 5;
Console.WriteLine(array1[2]);
Console.WriteLine(array2[2]);
Output :
5
5
int[] array1 = { 1, 2, 8, 4 };
int[] array2 = (int[])array1.Clone();
int[] array3 = new int[6];
array1.CopyTo(array3, 2);
array2[2] = 5;
array3[3] = 11;
Console.WriteLine(array1[3]);
Console.WriteLine(array2[3]);
Console.WriteLine(array3[1]);
Output :
3
5
int[] array1 = { 1, 2, 8, 4 };
int[] array2 = (int[])array1.Clone();
int[] array3 = new int[6];// Length should be (number of
position(2)+array1Length(4))(6)
array1.CopyTo(array3, 2);
array2[2] = 5;
array3[3] = 11;
Console.WriteLine(array1[3]);
Console.WriteLine(array2[3]);
Console.WriteLine(array3[1]);
int[] array1 = { 1, 2, 3, 4 };
int[] array2 = array1;
array2[2] = 5;
Console.WriteLine(array1[2]);
Console.WriteLine(array2[2]);
//Output :
//5
//5
int[] array1 = { 1, 2, 3, 4 };
int[] array2 = (int[])array1.Clone();
array2[2] = 5;
Console.WriteLine(array1[2]);
Console.WriteLine(array2[2]);
//Output :
//3
//5
int[] array1 = { 1, 2, 8, 4 };
int[] array2 = (int[])array1.Clone();
int[] array3 = new int[6];// Length should be (number of position(2)+array1Length(4))(6)
array1.CopyTo(array3, 2);
array2[2] = 5;
array3[3] = 11;
Console.WriteLine(array1[3]);
Console.WriteLine(array2[3]);
Console.WriteLine(array3[1]);
Web Services Clear Example
Following example will give a clear Idea about how to create a Web Service and How to consume the service.
Create One Web Service Application
-->File-->New-->Project-->VC-->Web-->Asp.Net Web Service Application
By default one service will be added "HELLO WORLD"
Think that you are providing this service only.
Then Public this though IIS, then you will get a Link.
Create one Project for Accessing the Web Service.
Add the reference as
Right click on Project select Add Web Service Reference and Give the path of Hosted Web Service
Link.
There you can find the Namespace.
If you want to call the Web Service method then you need to create the instance as
Namespace.ServiceName proxy=new Namespace.ServiceName();
proxy.WebMethod() nothing but a service.
Create One Web Service Application
-->File-->New-->Project-->VC-->Web-->Asp.Net Web Service Application
By default one service will be added "HELLO WORLD"
Think that you are providing this service only.
Then Public this though IIS, then you will get a Link.
Create one Project for Accessing the Web Service.
Add the reference as
Right click on Project select Add Web Service Reference and Give the path of Hosted Web Service
Link.
There you can find the Namespace.
If you want to call the Web Service method then you need to create the instance as
Namespace.ServiceName proxy=new Namespace.ServiceName();
proxy.WebMethod() nothing but a service.
The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.Data.Database, Application]) failed: Unable to find the requested .Net Framework Data Provider. It may not be installed. (Strategy type Configured Object Strategy, index 2)
Unable to find the requested .Net Framework Data Provider. It may not be installed. (Strategy type ConfiguredObjectStrategy, index 2)
Then Paste the following code in Web.Config
This DbProviderFactories should be matched with machine.config
which you can find in the following path
C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config
Then Paste the following code in Web.Config
<system.data>
<DbProviderFactories>
<add
name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory,
Oracle.DataAccess, Version=2.112.3.0, Culture=neutral,
PublicKeyToken=89b483f429c47342"/>
</DbProviderFactories>
</system.data>
This DbProviderFactories should be matched with machine.config
which you can find in the following path
C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config
Subscribe to:
Posts (Atom)