News:

GinGly.com - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!

Main Menu

Interview Questions: ASP.NET

Started by ganeshbala, May 09, 2008, 02:13 PM

Previous topic - Next topic

ganeshbala

1. What are the main differences between asp and asp.net?

ASP 3.0

• Supports VBScript and JavaScript
o scripting languages are limited in scope
o interpreted from top to bottom each time the page is loaded
• Files end with *.asp extension
• 5 objects: Request, Response, Server, Application, Session
• Queried databases return recordsets
• Uses conventional HTML forms for data collection

ASP .NET

• Supports a number of languages including Visual Basic, C#, and JScript
o code is compiled into .NET classes and stored to speed up multiple hits on a page
o object oriented and event driven makes coding web pages more like traditional applications
• Files end with *.aspx extension
• .NET contains over 3400 classes
• XML-friendly data sets are used instead of recordsets
• Uses web forms that look like HTML forms to the client, but add much functionality due to server-side coding
• Has built-in validation objects
• Improved debugging feature (great news for programmers)
• ASP .NET controls can be binded to a data source, including XML recordsets
Source: mikekissman.com

2. What is a user control?

• An ASP.NET user control is a group of one or more server controls or static HTML elements that encapsulate a piece of functionality. A user control could simply be an extension of the functionality of an existing server control(s) (such as an image control that can be rotated or a calendar control that stores the date in a text box). Or, it could consist of several elements that work and interact together to get a job done (such as several controls grouped together that gather information about a user's previous work experience).
Source: 15seconds.com

3. What are different types of controls available in ASP.net?
• HTML server controls HTML elements exposed to the server so you can program them. HTML server controls expose an object model that maps very closely to the HTML elements that they render.
• Web server controls Controls with more built-in features than HTML server controls. Web server controls include not only form-type controls such as buttons and text boxes, but also special-purpose controls such as a calendar. Web server controls are more abstract than HTML server controls in that their object model does not necessarily reflect HTML syntax.
• Validation controls Controls that incorporate logic to allow you to test a user's input. You attach a validation control to an input control to test what the user enters for that input control. Validation controls are provided to allow you to check for a required field, to test against a specific value or pattern of characters, to verify that a value lies within a range, and so on.
• User controls Controls that you create as Web Forms pages. You can embed Web Forms user controls in other Web Forms pages, which is an easy way to create menus, toolbars, and other reusable elements.
• Note You can also create output for mobile devices. To do so, you use the same ASP.NET page framework, but you create Mobile Web Forms instead of Web Forms pages and use controls specifically designed for mobile devices.
Source: MSDN

4. What are the validation controls available in ASP.net?

Type of validation Control to use
Description

Required entry RequiredFieldValidator Ensures that the user does not skip an entry.
Comparison to a value CompareValidator Compares a user's entry against a constant value, or against a property value of another control, using a comparison operator (less than, equal, greater than, and so on).
Range checking RangeValidator Checks that a user's entry is between specified lower and upper boundaries. You can check ranges within pairs of numbers, alphabetic characters, and dates.
Pattern matching RegularExpressionValidator Checks that the entry matches a pattern defined by a regular expression. This type of validation allows you to check for predictable sequences of characters, such as those in social security numbers, e-mail addresses, telephone numbers, postal codes, and so on.
User-defined CustomValidator Checks the user's entry using validation logic that you write yourself. This type of validation allows you to check for values derived at run time.
Source: MSDN

5. How will you upload a file to IIS in Asp and how will you do the same in ASP.net?

First of all, we need a HTML server control to allow the user to select the file. This is nothing but the same old <input tag, with the type set to File, such as <input type=file id="myFile" runat=server />. This will give you the textbox and a browse button. Once you have this, the user can select any file from their computer (or even from a network). Then, in the Server side, we need the following line to save the file to the Web Server.


myFile.PostedFile.SaveAs ("DestinationPath")

Note: The Form should have the following ENC Type
<form enctype="multipart/form-data" runat="server">

Source: ASP Alliance
6. What is Attribute Programming? What are attributes? Where are they used?

Attributes are a mechanism for adding metadata, such as compiler instructions and other data about your data, methods, and classes, to the program itself. Attributes are inserted into the metadata and are visible through ILDasm and other metadata-reading tools. Attributes can be used to identify or use the data at runtime execution using .NET Reflection.
Source: OnDotNet.com

7. What is the difference between Data Reader & Dataset?

Data Reader is connected, read only forward only record set.
Dataset is in memory database that can store multiple tables, relations and constraints; moreover dataset is disconnected and is not aware of the data source.

8. What is the difference between server side and client side code?

Server code is executed on the web server where as the client code is executed on the browser machine.

9. Why would you use "EnableViewState" property? What are the disadvantages?

EnableViewState allows me to retain the values of the controls properties across the requests in the same session. It hampers the performance of the application.

10. What is the difference between Server. Transfer and Response. Redirect?

The Transfer method allows you to transfer from inside one ASP page to another ASP page. All of the state information that has been created for the first (calling) ASP page will be transferred to the second (called) ASP page. This transferred information includes all objects and variables that have been given a value in an Application or Session scope, and all items in the Request collections. For example, the second ASP page will have the same SessionID as the first ASP page.

When the second (called) ASP page completes its tasks, you do not return to the first (calling) ASP page. All these happen on the server side browser is not aware of this.
The redirect message issue HTTP 304 to the browser and causes browser to got the specified page. Hence there is round trip between client and server. Unlike transfer, redirect doesn't pass context information to the called page.

11. What is the difference between Application_start and Session_start?

Application_start gets fired when an application receive the very first request.
Session_start gets fired for each of the user session.



12. What is inheritance and when would you use inheritance?

The concept of child class inheriting the behavior of the parent is called inheritance.
If there are many classes in an application that have some part of their behavior common among all , inheritance would be used.

13. What is the order of events in a web form?

1. Init
2. Load
3. Cached post back events
4. Prerender
5. Unload

14. Can you edit Data in repeater control?

No

15. Which template you must provide to display data in a repeater control?

Item Template

16. How can you provide an alternating color scheme in a Data Grid?

Use ALTERNATINGITEMSTYLE and ITEMSTYLE, attributes or Templates

17. Is it possible to bind a data to Textbox?

Yes

18. What method I should call to bind data to control?

Bind Data ()

19. How can I kill a user session?

Call session. abandon.

21. Which is the common property among all the validation controls?

ControlToValidate

22. How do you bind a data grid column manually?

Use BoundColumn tag.

23. Web services can only be written in .NET, true or false?

False

24. What does WSDL, UDDI stands for?

Web Service Description Language.
Universal Description Discovery and Integration
25. How can you make a property read only? (C#)

Use key word Read Only

25. Which validation control is used to match values in two controls?

Compare Validation control.

26. To test a Web Service I must create either web application or windows application. True or false?

False

27. How many classes can a single .NET assembly contains?

Any number

28. What are the data types available in JavaScript?

Object is the only data type available.

29. Is it possible to share session information among ASP and ASPX page?

No, it is not possible as both of these are running under different processes.

30. What are the caching techniques available?
Page cahahing.
Fragment Caching
And Data Caching



31. What are the different types of authentication modes available?

1. Window.
2. Form.
3. Passport.
4. None.

32. Explain the steps involved to populate dataset with data?

Open connection
Initialize Adapter passing SQL and connection as parameter
Initialize Dataset
Call Fill method of the adapter passes dataset as the parameter
Close connection.

33. Can I have data from two different sources into a single dataset?

Yes, it is possible.

34. Is it possible load XML into a Data Reader?

No.

35. Is it possible to have tables in the dataset that are not bound to any data source?

Yes, we can create table object in code and add it to the dataset.

36. Why do you deploy an assembly into GAC?

To allow other application to access the shared assembly.

37. How do you uninstall assembly from GAC?

Use Gacutil.exe with U switch.

38. What does Regasm do?

The Assembly Registration tool reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create .NET Framework classes transparently. Once a class is registered, any COM client can use it as though the class were a COM class. The class is registered only once, when the assembly is installed. Instances of classes within the assembly cannot be created from COM until they are actually registered.

39. What is the difference between Execute Scalar and ExceuteNoneQuery?

Execute Scalar returns the value in the first row first column of a query result set.
ExceuteNonQuery return number of rows affected.

40. What is an assembly?

Assembly is a deployment unit of .NET application. In practical terms assembly is an Executable or a class library.