ASP.NET 2.0 Interview Questions
17. In the Design view in Visual Studio 2005 of an ASP.NET web page, what is the easiest way to create an event handler for the default event of a ASP.NET server control? A. Open the code-behind page and write the code. B. Right-click the control and select Create Handler. C. Drag an event handler from the ToolBox to the desired control.D. Double-click the control.
18. Which of the following represents the best use of the Table, TableRow, and Table-Cell controls?A. To create and populate a Table in Design view B. To create a customized control that needs to display data in a tabular fashionC. To create and populate a Table with images D. To display a tabular result set
19. For your ASP.NET web application your graphics designer created elaborate images that show the product lines of your company. Some of graphics of the product line are rectangular, circular, and others are having complex shapes. You need to use these images as a menu on your Web site. What is the best way of incorporating these images into your Web site? A. Use ImageButton and use the x- and y-coordinates that are returned when the user clicks to figure out what product line the user clicked. B. Use the Table, TableRow, and TableCell controls, break the image into pieces that are displayed in the cells, and use the TableCell control’s Click event to identify the product line that was clicked. C. Use the MultiView control and break up the image into pieces that can be displayed in each View control for each product line. Use the Click event of the View to identify the product line that was clicked. D. Use an ImageMap control and define hot spot areas for each of the product lines. Use the PostBackValue to identify the product line that was clicked.
20. You are writing ASP.NET 2.0 Web site that collects lots of data from users, and the data collection forms spreads over multiple ASP.NET Web pages. When the user reaches the last page, you need to gather all of data, validate the data, and save the data to the SQL Server database. You have noticed that it can be rather difficult to gather the data that is spread over multiple pages and you want to simplify this application. What is the easiest control to implement that can be used to collect the data on a single Web page? A. The View control B. The TextBox control C. The Wizard control D. The DataCollection control
21. In your ASP.NET 2.0 web application you want to display an image that is selected from a collection of images. What approach will you use to implementing this? A. Use the ImageMap control and randomly select a HotSpot to show or hide. B. Use the Image control to hold the image and a Calendar control to randomly select a date for each image to be displayed. C. Use the AdServer control and create an XML file with configuration of the control. D. Use an ImageButton control to predict randomness of the image to be loaded based on the clicks of the control.
22. In your ASP.NET web application you want to display a list of clients on a Web page. The client list displays 10 clients at a time, and you require the ability to edit the clients. Which Web control is the best choice for this scenario? A. The DetailsView control B. The Table control C. The GridView control D. The FormView control
23. While developing ASP.NET 2.0 web application you want to display a list of parts in a master/detail scenario where the user can select a part number using a list that takes a minimum amount of space on the Web page. When the part is selected, a DetailsView control displays all the information about the part and allows the user to edit the part. Which Web control is the best choice to display the part number list for this scenario? A. The DropDownList control B. The RadioButtonList control C. The FormView control D. The TextBox control
.NET WebDev interview questions
9. How will you identify which event in the ASP.NET Web page life cycle takes the longest time to execute? A. Turn on ASP.NET trace and run the Web application. B. Add a few code to each of the page life-cycle events that will print the current time. C. In the Web.config file, add the monitorTimings attribute and set it to True. D. In the Web site properties, turn on the performance monitor and run the Web application. After that, open performance monitor to see the timings.
11. You are interested in examining the data that is posted to the Web server. What trace result section can you use to see this information?A. Control Tree B. Headers Collection C. Form Collection D. Server Variables
12. While creating web site you need to add an HTML Web server control to the Web page, you need to drag an HTML element from the ToolBox of Visual Studio 2005 to the Web page and then which of the following tasks you will perform? A. Right-click the HTML element and click Run=Server. B. Double-click the HTML element to convert it to an HTML server control. C. Right-click the HTML element and click Run As Server Control. D. Click the HTML element and set ServerControl to true in the Properties window.
13. While testing your ASP.NET web application you noticed that while clicking on CheckBox of one of the web page it does not cause a PostBack; you required that the CheckBox should make PostBack so Web page can be update on the server-side code. How can you make the CheckBox to cause a PostBack? A. Set the AutoPostBack property to true. B. Add JavaScript code to call the ForcePostBack method. C. Set the PostBackAll property of the Web page to true. D. Add server-side code to listen for the click event from the client.
14. While writing code in Visual Studio 2005 you creates a new instance of a ASP.NET TextBox server control, what do you need to do to get the TextBox to display on the Web page? A. Call the ShowControl method on the TextBox. B. Set the VisibleControl to true on the TextBox. C. Add the TextBox instance to the form1.Controls collection. D. Execute the AddControl method on the Web page.
15. While creating your ASP.NET web based application you want to create multiple RadioButton server controls which should be mutually exclusive, what property of RadioButton server controls you must set? A. Exclusive B. MutuallyExclusive C. Grouped D. GroupName
16. While creating an ASP.NET web application with the help of Visual Studio 2005 you are creates a Web page that has several related buttons, such as fast-forward, reverse, play, stop, and pause. There should be one event handler that handles the processes of PostBack from these Button server controls. Other than the normal Submit button, what type of button can you create? A. OneToMany B. Command C. Reset D. ManyToOne
What is the difference between Server.Transfer and Server.Execute?
Both Server.Transfer and Server.Execute were introduced in Classic ASP 3.0 (and still work in ASP.NET).
When Server.Execute is used, a URL is passed to it as a parameter, and the control moves to this new page. Execution of code happens on the new page. Once code execution gets over, the control returns to the initial page, just after where it was called. However, in the case of Server.Transfer, it works very much the same, the difference being the execution stops at the new page itself (means the control is'nt returned to the calling page).
In both the cases, the URL in the browser remains the first page url (does'nt refresh to the new page URL) as the browser is'nt requested to do so.
ASP .NET Interview Questions, Part 2
19. Whats an assembly? Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN
20. Describe the difference between inline and code behind. Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.
21. Explain what a diffgram is, and a good use for one? The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. For reading database data to an XML file to be sent to a Web Service.
22. Whats MSIL, and why should my developers need an appreciation of it if at all? MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL.
23. Which method do you invoke on the DataAdapter control to load your generated dataset with data? The .Fill() method
24. Can you edit data in the Repeater control? No, it just reads the information from its data source
25. Which template must you provide, in order to display data in a Repeater control? ItemTemplate
26. How can you provide an alternating color scheme in a Repeater control? Use the AlternatingItemTemplate
27. What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control? You must set the DataSource property and call the DataBind method.
28. What base class do all Web Forms inherit from? The Page class.
29. Name two properties common in every validation control? ControlToValidate property and Text property.
30. What tags do you need to add within the asp:datagrid tags to bind columns manually? Set AutoGenerateColumns Property to false on the datagrid tag
31. What tag do you use to add a hyperlink column to the DataGrid?
32. What is the transport protocol you use to call a Web service? SOAP is the preferred protocol.
33. True or False: A Web service can only be written in .NET? False
34. What does WSDL stand for? (Web Services Description Language)
35. Where on the Internet would you look for Web services? (http://www.uddi.org)
36. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box? DataTextField property
37. Which control would you use if you needed to make sure the values in two different controls matched? CompareValidator Control
38. True or False: To test a Web service you must create a windows application or Web application to consume this service? False, the webservice comes with a test page and it provides HTTP-GET method to test.
39. How many classes can a single .NET DLL contain? It can contain many classes.
What are different types of directives in .NET?
@Page: Defines page-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .aspx files <%@ Page AspCompat="TRUE" language="C#" %>
@Control:Defines control-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .ascx files. <%@ Control Language="VB" EnableViewState="false" %>
@Import: Explicitly imports a namespace into a page or user control. The Import directive cannot have more than one namespace attribute. To import multiple namespaces, use multiple @Import directives. <% @ Import Namespace="System.web" %>
@Implements: Indicates that the current page or user control implements the specified .NET framework interface.<%@ Implements Interface="System.Web.UI.IPostBackEventHandler" %>
@Register: Associates aliases with namespaces and class names for concise notation in custom server control syntax.<%@ Register Tagprefix="Acme" Tagname="AdRotator" Src="AdRotator.ascx" %>
@Assembly: Links an assembly to the current page during compilation, making all the assembly's classes and interfaces available for use on the page. <%@ Assembly Name="MyAssembly" %><%@ Assembly Src="MySource.vb" %>
@OutputCache: Declaratively controls the output caching policies of an ASP.NET page or a user control contained in a page<%@ OutputCache Duration="#ofseconds" Location="Any | Client | Downstream | Server | None" Shared="True | False" VaryByControl="controlname" VaryByCustom="browser | customstring" VaryByHeader="headers" VaryByParam="parametername" %>
@Reference: Declaratively indicates that another user control or page source file should be dynamically compiled and linked against the page in which this directive is declared.
What are different types of directives in .NET?
@Page: Defines page-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .aspx files <%@ Page AspCompat="TRUE" language="C#" %>
@Control:Defines control-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .ascx files. <%@ Control Language="VB" EnableViewState="false" %>
@Import: Explicitly imports a namespace into a page or user control. The Import directive cannot have more than one namespace attribute. To import multiple namespaces, use multiple @Import directives. <% @ Import Namespace="System.web" %>
@Implements: Indicates that the current page or user control implements the specified .NET framework interface.<%@ Implements Interface="System.Web.UI.IPostBackEventHandler" %>
@Register: Associates aliases with namespaces and class names for concise notation in custom server control syntax.<%@ Register Tagprefix="Acme" Tagname="AdRotator" Src="AdRotator.ascx" %>
@Assembly: Links an assembly to the current page during compilation, making all the assembly's classes and interfaces available for use on the page. <%@ Assembly Name="MyAssembly" %><%@ Assembly Src="MySource.vb" %>
@OutputCache: Declaratively controls the output caching policies of an ASP.NET page or a user control contained in a page<%@ OutputCache Duration="#ofseconds" Location="Any | Client | Downstream | Server | None" Shared="True | False" VaryByControl="controlname" VaryByCustom="browser | customstring" VaryByHeader="headers" VaryByParam="parametername" %>
@Reference: Declaratively indicates that another user control or page source file should be dynamically compiled and linked against the page in which this directive is declared.
Interview questions for asp.net Web application developers
- Name a few differences between .NET application and a Java application?
- Specify the best ways to store variables so that we can access them in various pages of ASP.NET application?
- What are the XML files that are important in developing an ASP.NET application?
- What is XSLT and what is its use?
- How do you separate business logic while creating an ASP.NET application?
- If there is a calendar control to be included in each page of your application, and we do not intend to use the Microsoft-provided calendar control, how do you develop it? Do you copy and paste the code into each and very page of your application?
- How do you debug an ASP.NET application?
- How do you deploy an ASP.NET application?
- What is the maximum length of a varchar field in SQL Server?
- How do you define an integer in SQL Server?