.NET Framework Interview Questions and Answers (547) - Page 1

What are Web services?

Web services are functions exposed by server-side applications. They are programmable units that other applications (and Web services) can access over the Internet.

More details can be found at:

http://www.roseindia.net/webservices/webservices.shtml
http://www.webopedia.com/TERM/W/Web_services.html
What are session management techniques in .NET?

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.

For more details, please visit
http://shailkpatel.blogspot.com/2007/03/session-management-techniques.html895r
What is MVC (Model View Controller) pattern?

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.

For more details and its implementaion, please see
http://www.c-sharpcorner.com/UploadFile/napanchal/MVCDesign12052005035152AM/MVCDesign.aspx
http://msdn2.microsoft.com/en-us/library/ms978748.aspx
http://msdn2.microsoft.com/en-us/library/ms998540.aspx
How to use trace in libraray classes (like BAL, DAL)?

Use following code to use Trace.Warn, Trace.Write etc.

System.Web.HttpContext.Current.Trace
What is gacutil.exe?

It's a command to install the assembly into the Global Assembly Cache.
What is boxing and unboxing?

Converting a value type to reference type is called Boxing and Converting reference type of value type is Unboxing.

int i = 1;
object o = i; // boxing
int j = (int) o; // unboxing
What provider ADO.NET use by default?

NOTE: This is objective type question, Please click question title for correct answer.
Difference between Response.Expires and Response.ExpiresAbsolute?

Response.Expires
This property specifies the number of minutes before a page cached in the browser expires ie. if the user returns to the same page before the specified number of minutes the cached version of the page is displayed.
<% Response.Expires = minutes %>

Response.ExpiresAbsolute
Using this property we can set the date and/or time at which page cached in the browser expires.
<% Response.ExpiresAbsolute=#May 15, 1999 18:00:00# %>
What is CLR (Common Language Runtime)?

This is an execution engine for .NET Framework application. It provides a number of services including
1. Code Management
2. Application memory isolation
3. Verification of type safety
4. Conversion of IL to native code.
5. Access to meta data
6. Managing memory for managed objects
7. Enforcement of code access security
8. Exception handling, including cross-language exceptions.
9. Inter operation between managed code, COM objects and pre-existing DLLs (Unmanaged code and data)
10. Automation of object layout
11. Support for developer services (profiling, debugging etc.)
Write a function into Javascript that will toggle display a HTML element.

function ShowHide(id)

{
document.getElementById(id).style.display == '' ? document.getElementById(id).style.display = 'none' : document.getElementById(id).style.display = '';
}


We can call this function like
<a href="#" onclick="ShowHide('divid')">Show/Hide</a>

If the "divid" is already displaying on the page it will hide if not it will show on the page and so on.
When to use String and StringBuilder class?

Use the String class to concat, join or format methods to join multiple items in a single statement.

Use StringBuilder class to create dynamic strings.
Which statement is correct in terms of try catch finally block?

NOTE: This is objective type question, Please click question title for correct answer.
String is a value type or reference type?

String is a reference type variable.
List few ValueTypes variables.

Below are all ValueTypes variables.

System.SByte,
System.Byte
System.Int16
System.Int32
System.Int64
System.Single
System.Double
System.Decimal
System.Char
System.Boolean
System.DateTime
What is the use of RCW & CCW?

RCW : Runtime Collable Wrapper takes a COM component, wrap it up and allows .NET client to consume it.

CCW: COM Collable Wrapper wraps a .NET object for consumption by COM client
What is StringCollection?

StringCollection is a simple resizable collection of strings

Following function shows how to insert and retrive data into/from StringCollection.

public static string GetStringCollection()

{
System.Text.StringBuilder strB = new System.Text.StringBuilder();
// Add strings into StringCollection
System.Collections.Specialized.StringCollection strC = new System.Collections.Specialized.StringCollection();
strC.Add("Ram 1");
strC.Add("Ram 2");
strC.Add("Ram 3");
strC.Add("Ram 4");
strC.Add("Ram 5");

// Retrieve string from StringCollection
System.Collections.Specialized.StringEnumerator coll = strC.GetEnumerator();
while (coll.MoveNext())
{
strB.Append(coll.Current + "
");
}
return strB.ToString();
}

Where reference and value types variables are stored?

All reference type variables are stored in heap (Random) and all value types variables are stored in stack (Sequential).
What is Singleton pattern?

Singleton pattern ensures a class has only one instance & provide a global point of access to it. It is achieved by declaring a static variable for the class & checking for null before actually instantiating it.
What does apsx stand for?

Active Server Pages Extension
What is CTS?

CTS (Common Type System) is a rich type system, build into the common language runtime that supports the types and operations found in most of the programming languages. The common type system supports the complete implementation of a wide range of programming language.
Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories