Dot Net Interview questions for 3+ years of experience - Part-3

Previous Questions


Next Questions

1)What is Marshaling?
Ans)

The process of establishing a Remote Proxy Server object which resides at the client side and act as if it was the server.Which in turn handles the communication between the real server object and client object. This process of monitoring is said to be Marshaling.
--------------------------------------------------
2)What is Smart Navigation ?
Ans)
When ever there is a request from a web browser which is IE 5.0 or greater Smart Navigation enhances the user feel of the page.

These are the different functions which this smart navigation performs.

1) It Persists the element focus between navigation's.

2) It also persists the scroll position when user traversing from one page to another.

3) It eliminates the flash content which was caused by navigation.

4) Most important feature is retaining the last page state in the browsers history.

This is how we can set the Smart Navigation :

We can set SmartNavigation attribute at the @ page directive in the .aspx page. So when the page is requested the dynamically generated class sets this attribute.

Note : This property is best useful when a particular web site has frequent postbacks.
---------------------------------------------------
3)In C# how do you find the last error which occurred ?
Ans)

This can be done by implementing a method called GetLastError(). Generally this returns a ASPError object stating the error condition that has occurred. This method will work only before the .ASP page sent any content to the Client.

Sample Code

Exception LastErrorOccured;

String ShowErrMessage;

LastErrorOccured = Server.GetLastError();

if (LastErrorOccured != null)

ShowErrMessage = LastErrorOccured.Message;

else

ShowErrMessage = "No Errors";

Response.Write("Last Error Occured = " + ShowErrMessage);
---------------------------------------------------
4)What is the difference between OLEDB Provider and SqlClient ? Which is more productive to use for Dot Net application?
Ans)
Generally SQLClient .NET classes are highly optimized for the .net / sqlserver combination which in-turn gives accurate results. The SqlClient data provider is fast. It works faster than the Oracle provider, and even more faster than accessing database through the OleDb layer.

Reason for being faster is, it access the native library which generally gives you a better performance and it has also got a lot of support from SQL Server team online.
----------------------------------------------------
5)which is server side state management technical?
Ans)
Select from following answers:
a)cookies
b)hidden fields
c)session
d)view state

session is the server side state management and other 3 r client side state management

6) What is the name given to a type of assembly which contains localized resources?

Ans)

Select from following answers:

A. a) Satellite

B. b)Spoke

C. c)Sputnik

D. d)Hub

satellite

We can deploy our application's resources in satellite assemblies. Generally by definition, satellite assemblies contains only resource files. They do not contain any application code.

In the satellite assembly deployment model, we create an application with one default assembly (which is the main assembly) and several satellite assemblies.

-------------------------------------------------------------------

7) In Singleton Pattern, how will you make sure that threading is done with minimal overhead

Ans)

''''''''''''''''''''''''''''''''''''''''''''''''''''''''

public sealed class Singleton

{

private static volatile Singleton instance;

private static object syncRoot = new Object();

private Singleton() {}

public static Singleton Instance

{

get

{

if (instance == null)

{

lock (syncRoot)

{

if (instance == null)

instance = new Singleton();

}

}

return instance;

}

}

}

'''''''''''''''''''''''''''''''''''''''''''''''''''''

In the above code, when the Singleton instance is created for the first time then it is locked and synchronized but next call or successive calls make sure that the lock is not checked anymore because an instance already exists. This way the overhead of checking the lock minimizes.

The double-check locking approach solves the thread concurrency problems while avoiding an exclusive lock in every call to the Instance property method.



Previous Questions


Next Questions