View Single Post

  #13 (permalink)  
Old 08-07-2004, 07:48 PM
sanereddy
Guest
 
Posts: n/a
Re:.Net Interview Questions

1.User is giving \"false\" as the second argument of Response.Redirect what will happen a)not compile at all b)executes ....

Answer: b)executes

Explanation:
If you want to get rid of this exception, use Response.Redirect(url, false).

Instead of putting Response.Redirect into Try..Catch block. You may try this one:

Dim url As String

Try
url = Application(\"sRoot\&quot & \"Prva.aspx\"
Catch ex As Exception
Dim Greska As String
Greska = ex.Message
Greska = ex.ToString()
url = Session(\"sRoot\&quot & \"GlobalError.aspx?ER=\" & Greska
End Try

Response.Redirect(url, False)


2)which object is fastest when reading from database
a)dataset b)data reader c)xml clause.

Answer: It\'s bit difficult one to answers, the answer would be either dataset or datareader depending on waht you are trying to accomplish. In most cases Datareader would be the appropriate answer.

Explanation:
Use the DataReader Class

These are the ideal situations when you should use the DataReader class:
The data that you are retrieving must always be fresh, and therefore must be retrieved from the database each time you need it. There is less overhead associated with creating a DataReader class, and performance over DataSet improves rapidly with increasing load.

You plan to make several repeated calls to the database to retrieve small pieces of information. The performance data referred to in the first bullet applies to an even greater scale here.

It is true that many of the features that make DataSet classes great, such as the ability to set up relations between tables, are better left to client-based Windows Forms applications. There are numerous occasions, however, when DataSet classes are preferable to DataReader classes, and a few where you cannot use DataReader classes at all.

Use the DataSet Class Here\'s when you should consider using the DataSet class:

You are building a Web service that uses the data you are retrieving as the return value. Because DataReader classes maintain a connection to the database, they cannot be serialized into XML and therefore cannot be transmitted over the wire to the caller of a Web service.
You need to sort or filter data. Before using a DataView object (exposed as the DefaultView property of DataTable classes, which comprise a DataSet class) to sort or filter your data, first try to use SQL query constructs—such as the WHERE and ORDER BY clauses—to do it for you, and use the more lightweight and faster DataReader class. Sometimes, however, this is not possible or you might need to sort or filter the data more than once.
You need to iterate through the data more than once on the same request. You can only loop through DataReader once. If, for example, you need to bind more than one ServerControl class to the same set of data, DataSet is the more appropriate solution. DataReader cannot be bound to more than one ServerControl class because it is forward-only. The data would have to be retrieved twice from the database in order for DataReader to be used in this situation.

Still, DataSet classes undoubtedly play an important role in an ASP.NET Web application of any significant size or complexity. You can reduce the \"performance penalty\" of DataSet classes by judicious caching to minimize database round-trips. Both DataReader and DataSet are essential pieces of a successful ASP.NET Web application. It\'s just important to know when and where each is used best.

Read this article : http://www.ftponline.com/vsm/2003_02...efault_pf.aspx

3)while using the custom control if the user is putting the background property to blue in the on_init function.What will happen if he is viewing this in design mode

a)blue background b)white c)error

Answer: I don\'t have anser from top of my head , please read this article and practice the excersize , let us know the answer.

Explanation: http://www.15seconds.com/issue/040421.htm4)

Questions 6,7 and 13:
6)one user custom control is there in the top.inside this we are defining one more user control.There we are defining the property of the controls what will happen?

7)what is the advantage of server control over all other controls
a)only for persistance of data b)fast...

13)If I am writing an element \"<web.usercontrols>\" in web.config what will happen

Here is very good Questions and Ansers for any Server Controls and User controls Questions. The one of the big advantages of custom (precompiled) controls over user controls. You can install a custom control to the Global Assembly Cache on the server so that every application on the server can share it.

http://msdn.microsoft.com/chats/vstu...dio_032102.asp

19)for serializing an object the object must implement which interface?

Please read this very nice tutorial on this
http://msdn.microsoft.com/library/de..._an_object.asp

http://www.topxml.com/xmlserializer/..._an_object.asp

20)For asynchronously executing two processes what will we user?

Read this one to get an overview on Multi Threading Concept

http://msdn.microsoft.com/msdnmag/is...T/default.aspx

Sample Code Download:

http://download.microsoft.com/downlo...35/NET0401.exe

8)where is the best place to declare an event so that it will not affect the view state?

ADO.NET Examples and Best Practices : Download this 39 page document with sample code

http://www.vslive.com/2002/sf/Chapter_1-2.pdf

14)what is typed dataset
A typed DataSet is a class that derives from a DataSet. As such, it inherits all the methods, events, and properties of a DataSet. Additionally, a typed DataSet provides strongly typed methods, events, and properties. This means you can access tables and columns by name, instead of using collection-based methods. Aside from the improved readability of the code, a typed DataSet also allows the Visual Studio .NET code editor to automatically complete lines as you type.

Additionally, the strongly typed DataSet provides access to values as the correct type at compile time. With a strongly typed DataSet, type mismatch errors are caught when the code is compiled rather than at run time.


Here are the few articles on Typed Dataset:

http://www.ondotnet.com/pub/a/dotnet...notations.html

http://msdn.microsoft.com/library/de...pedDataSet.asp

21)ForXML Clause is used for

With the release of SQL Server 2000, a lot more support and functionality for XML was included in the product. In this article we would target at some of the out of the box functionality that SQL Server 2000 offers us to convert our relational data as XML formatted data. Not wasting much of the time lets get into the usage of these functionality into our application ...

Well, New with SQL Server 2000 is the ability to return the results of a query in XML format. This is accomplished by adding the FOR XML clause at the end of the SELECT statement. The syntax is as follows:

FOR XML mode [, XMLDATA] [, ELEMENTS] [, BINARY BASE 64]

The arguements in the braket suggest that these are optional. But lets understand each of these components before proceeding further.

Please read with syntax in detail here

http://www.extremeexperts.com/sql/articles/ForXML.aspx
will update with more answeers soon....

12)If we want an application to start on start of windows and end on close of windows what we have to do?
a)build ordinary appln and put in the start menu
b)use windows service

Answer: b)use windows service

Post edited by: sanereddy, at: 2004/08/07 20:10
Reply With Quote