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

Can we have try block without catch?

Yes.

We can write Try { } Finally { } block. In this case exception will be thrown in try block if it is but code inside finally block will execute.

Here any exception in CallFirstMethod() or CallSecondMethod() will be handled by MainMethod() and finally block will execute always to perform any cleanups for respective methods.
public void MainMethod()

{
try
{
CallFirstMethod();
CallSecondMethod();
}
Catch(Exception ex)
{
//handle exception
}
}
publiv void CallFirstMethod()
{
try
{
//code
}
finally
{
//cleanups
}
}
publiv void CallSecondMethod()
{
try
{
//code
}
finally
{
//cleanups
}
}

Can we have goto or return statement in finally block

Answer : No

If finally block is being run as a effect of exception thrown from try block it doesn't make sense of returning any thing or leaving the finally block.
If any exception occurs in finally block it will replace original exception in try block.
What are the different ways to deploy a assembly ?

Basically there are three different ways to deploy an assembly the are

1. Using a MSI Installer

2. Using a CAB archive

3. Using a XCOPY Command
What are User Controls and Custom controls?

Custom controls are control build entirely in code. The pro is that you can put them in libraries, add an icon to the toolbox and other fine control.

User controls are more easy to do, and in general is a way to encapsulate things to simplify other pages or when you need to use the same markup in several pages.
Suppose you have a DataTable having 100,000 rows and 50 columns. Now you've create array of perticular column values, how will you do that?

It's simple.
for C#
object[] arr = Array.ConvertAll<DataRow, object>(dataTable.Select(<criteria if any or leave blank>), (DataRow r) => r[<column-name>]);


for VB
dim arr as Object() = Array.ConvertAll(Of DataRow, Object)(dataTable.Select(<criteria if any or leave blank>), Function(r as DataRow) r(<column-name>));

difference between array and stack

There are two main differences between an array and a stack. Firstly, an array can be multi-dimensional, while a stack is strictly one-dimensional. Secondly, an array allows direct access to any of its elements, whereas with a stack, only the 'top' element is directly accessible; to access other elements of a stack, you must go through them in order, until you get to the one you want
What is difference between "String" and "string" ?

"string" is an alias for System.String . So technically, there is no difference between them. It's like int vs. System.Int32
What is the difference between Two Tier & Three tier Architecture ?

Two Tier Architecture: It is nothing but client server Architecture, where client will hit request directly to server and client will get response directly from server.
2-tier means 1) Design layer 2) Data layer

Three tier Architecture: It is nothing but Web Based application,here in between client and server middle ware will be there, if client hits a request it will go to the middle ware and middle ware will send to server and vise-versa.
3-tier means 1) Design layer 2) Business layer or Logic layer 3) Data layer

What is Cross-Page Posting?

Whenever you send a request to the server it sends request to the same page. Cross_page posting means it will send request to the another page. we can achieve. this through postback url property
What is Application State?

Application State is one of the Server Side State management Mechanism which stores application memory on the server rather than persisting data in the client side memory.
What is the difference between Pre-Render and Render events in ASP page execution.

Generally,

Pre Render - This event is used for modifying server controls just before sending them to client.

Render - This event is used to put the HTML output to the response stream
What is UDDI ?

UDDI - Universal Description, Discovery, and Integration (UDDI)

This is an XML based registry for businesses worldwide to list themselves on the Internet and a mechanism to register and locate web service applications.

It also provides a searchable directory of businesses and their Web Services. Hence this acts as a Service Broker that enables service requester's to find a suitable service provider.
Generally Reference types are inherited from which class?

NOTE: This is objective type question, Please click question title for correct answer.
Which of the following are known to be the attributes of an Object ?

NOTE: This is objective type question, Please click question title for correct answer.
Static members are 'eagerly initialized' ?

NOTE: This is objective type question, Please click question title for correct answer.
What kind of DLL is System.dll ?

NOTE: This is objective type question, Please click question title for correct answer.
Which of the following tool is useful to see all the methods which are used in the class file of our application ?

NOTE: This is objective type question, Please click question title for correct answer.
How do we read XML Schema and Data into a Dataset ?

We can read the XML Schema and data into Dataset using --

Dataset.ReadXml command.

example Follows :

DataSet DemoDataSet = new DataSet();

DataTable DemoDataTable = new DataTable("Table Name");
DemoDataTable .Columns.Add("Column Name", typeof(string));
DemoDataSet .Tables.Add(DemoDataTable);

string strXMLData = "<XmlDS><table1><col1>Value1</col1></table1><table1><col1>Value2</col1></table1></XmlDS>";

System.IO.StringReader xmlSR = new System.IO.StringReader(strXMLData);

DemoDataSet .ReadXml(xmlSR, XmlReadMode.IgnoreSchema);

What is the use of Assembly Manifest ?

Generally assembly contains a collection of data where it describes the relation between different elements in the assembly which relate to each other. This assembly manifest contains the assembly metadata. Assembly manifest can be stored in either executable file like an .exe file or .dll file with MSIL. Assembly Manifest has below mentioned information:
Assembly Name
Culture Type
Reference Information
Information on referenced Assemblies
Version Culture List of all the files in the Assembly
In .Netframework how CLR(Commom language runtime) has work???

1st--- CLS (common language specification)
2nd-- CTS (common type system)
cts will check line by line typesafty checking.
3rd-- JIT (just in time) JIT will change the code into MSIL
4th-- MSIL (Microsoft Intermidiate language) MSIL will change the code in .exe

and we run the .exe files....
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