jump to navigation

Exam 70-551 (MCPD Web Developer) Part 01 December 17, 2006

Posted by addisu in MCPD Web Developer.
trackback

1.)     The heart of the new ASP.NET 2.0 data access system is the “DataSource” control. A “DataSource” represents a backed data store (database, object, xml, message queue, and so on), and can be expressed declaratively on a Web page.

ASP.NET 2.0 provides several distinct data source objects that are used to construct a common interface framework for data-bound controls. The data sources’ objects are used to manipulate different underlying structures, from databases and in-memory objects to XML files, and provide abstract data manipulation functionality for controls.

Which one of the following data source controls would be the best to use if you wanted to implement your own data access layer in order to provide better encapsulation and abstraction and subsequently be able to bind to any method that returns a DataSet or an IEnumerable object.

a.)     AccessDataSource
b.)     SqlDataSource
c.)     ObjectDataSource
d.)     DataSetDataSource
e.)     XmlDataSource

Answer: Note: This class is new in the .NET Framework version 2.0.

Represents a business object that provides data to data-bound controls in multi-tier Web application architectures.

2.)     The ASP.NET 2.0 Wizard control simplifies many of the tasks associated with building a series of forms to collect user data. The control provides a mechanism that allows you to easily build the desired wizard as a collection of steps, add a new step, or reorder the steps.

To use the Wizard control, “asp:Wizard” element, you follow these simple steps: drop a Wizard control onto your Web Forms, add constituent controls, images, and text to each wizard step, and access the wizard’s data between steps.

Besides the classic events of any server control like Init, Load, and PreRender, the Wizard control also features a number of more specific events.

Which of the following events require the use of a WizardNavigationEventHandler delegate? Select all that apply?

a.)     ActiveStepChanged
b.)     CancelButtonClick
c.)     FinishButtonClick
d.)     NextButtonClick
e.)     PreviousButtonClick

Answer: The WizardNavigationEventHandler class represents the method that handles the navigation events FinishButtonClick, NextButtonClick, PreviousButtonClick, and SideBarButtonClick for a Wizard control and for controls that inherit from the Wizard control

3.)     You are developing a web site using ASP.NET 2.0 and your have been looking into using asynchronous web pages. The find that the System.Web.UI.Page class introduces a method called RegisterAsyncTask() to facilitate asynchronous operations. You are told that RegisterAsyncTask() have several advantages over using the AddOnPreRenderCompleteAsync() method.

Which of the following statements are true concerning the use of RegisterAsyncTask? Select all that apply.

a.)     RegisterAsyncTask() lets you register a timeout method that’s called if an asynchronous operation takes too long to complete
b.)     RegisterAsyncTask() can be called several times in one request to register several asynchronous operations
c.)     RegisterAsyncTask()’s fourth parameter to pass state to your Begin methods
d.)     RegisterAsyncTask does not flow impersonation, culture, and HttpContext.Current to the End and Timeout methods

Answer: In ASP.NET 2.0, the System.Web.UI.Page class introduces another method to facilitate asynchronous operations: RegisterAsyncTask. RegisterAsyncTask has four advantages over AddOnPreRenderCompleteAsync. First, in addition to Begin and End methods, RegisterAsyncTask lets you register a timeout method that’s called if an asynchronous operation takes too long to complete. You can set the timeout declaratively by including an AsyncTimeout attribute in the page’s @ Page directive. AsyncTimeout=”5″ sets the timeout to 5 seconds. The second advantage is that you can call RegisterAsyncTask several times in one request to register several async operations. As with MethodAsync, ASP.NET delays rendering the page until all the operations have completed. Third, you can use RegisterAsyncTask’s fourth parameter to pass state to your Begin methods. Finally, RegisterAsyncTask flows impersonation, culture, and HttpContext.Current to the End and Timeout methods. As mentioned earlier in this discussion, the same is not true of an End method registered with AddOnPreRenderCompleteAsync.

http://msdn.microsoft.com/msdnmag/issues/05/10/WickedCode/
http://msdn2.microsoft.com/en-us/library/system.web.ui.page.registerasynctask.aspx
http://msdn.microsoft.com/msdnmag/issues/05/10/WickedCode/#S5
http://pluralsight.com/blogs/fritz/archive/2005/02/14/5861.aspx

4.)     You are working as an ASP.NET 2.0 Web developer and you want to include a simple search box at the top of every page in your application. Some of the pages in your application have forms for the user to fill out where some of the controls on the form include validation controls to validate the user data. A typical page is shown in the code snippet below.

The problem is that when someone uses your search box, the validation controls trigger whenever you submit the contents of the search box.

How can you modify the code snippet below to allow the search box and form controls to work together and independently?

          <html>
            <head runat=”server”>
              <title>Search Box</title>
            </head>
          <body>
              <form runat=”server”>
              <table bgcolor=”blue” width=”100%”>
              <tr>
                  <td align=”right”>
                  <asp:RequiredFieldValidator
                      ControlToValidate=”txtSearch”
                      Text=”(required)”
                      ValidationGroup=”Group1″
                      SetFocusOnError=”true”
                      Runat=”Server” />
                  <asp:TextBox
                      ID=”txtSearch”
                      Runat=”Server” />
                  <asp:Button
                      Text=”Search”
                      ValidationGroup=”Group1″
                      Runat=”Server” />
                  </td>
              </tr>
              </table>
              <h1>Website User Survey</h1>
              What is your annual income?
              <br />
              <asp:TextBox
                  ID=”txtIncome”
                  Runat=”Server” />
              <asp:RequiredFieldValidator
                  ControlToValidate=”txtIncome”
                  Text=”(required)”
                  Runat=”Server” />
              <br /><br />
              <asp:Button
                  Text=”Submit Survey”
                  Runat=”Server” />
              </form>
          </body>
          </html>
      
a.)     Add ValidationGroup=”Group1″ to the RequiredFieldValidator for txtSearch
b.)     Add ValidationGroup=”Group1″ to the txtSearch Textbox control
c.)     Add ValidationGroup=”Group1″ to the Search Button control
d.)     Both A. and B.
e.)     Both A. and C.

Answer:

ASP.NET V2 introduces a new “ValidationGroup” property on validation and input controls that now makes this possible.  This allows page developers to group different controls together for more granular validation behavior.

 

Using the ValidationGroup property is simple – just add a “ValidationGroup” property to the validation controls that you want to group together, and then add the same ValidationGroup name to the postback control (for example: a button) that you want to cause the validation to occur.

5.)     You are working as an ASP.NET developer and you want to use the new .NET 2.0 Framework feature that allows you to encrypt/decrypt sensitive configuration information located in your web.config file.

You want to encrypt/decrypt the following configuration settings of the web.config file given below using either the RSAProtectedConfigurationProvider or the DataProtectionConfigurationProvider.

Which of the following command line tools will allow you to encrypt/decrypt these particular configuration sections in your web.config file?

           <appSettings>
           <connectionStrings>
           <identity>
           <sessionState>
         
a.)     aspnet_setreg
b.)     aspnet_regiis
c.)     aspnet_wp.exe
d.)     aspnet_state.exe

Answer:
Configuration sections can be easily encrypted using code or aspnet_regiis.exe, a command-line program.

6.)     You are migrating a web site build with ASP.NET 1.x to a new web site which uses the .NET 2.0 framework. You first job is to replace the login system, which is something you built from scratch, with the security/login web controls provided with .Net 2.0.

You are aware that ASP.NET 2.0 ships with several new security Web controls which provide a user interface for accomplishing user account-related tasks. Also, these controls use the Membership system which allows you to use a custom user store provided you create a custom membership provider.

Which one of the following security web controls would provide you with the ability to display a link to the Login page if an anonymous user is visiting the page or a Logoff link if an authenticated user is visiting the page?

a.)     Login web server control
b.)     LoginView web server control
c.)     PasswordRecovery web server control
d.)     LoginStatus web server control
e.)     LoginName web server control

Answer:
The LoginStatus Control

The LoginStatus control displays a login link for users who are not authenticated and a logout link for users who are authenticated. The login link takes the user to a login page. The logout link resets the current user’s identity to be an anonymous user.

You can customize the appearance of the LoginStatus control by setting the LoginText and LoginImageUrl properties.

7.)     The ASP.NET 2.0 Wizard control simplifies many of the tasks associated with building a series of forms to collect user data. The control provides a mechanism that allows you to easily build the desired wizard as a collection of steps, add a new step, or reorder the steps.

To use the Wizard control, “asp:Wizard” element, you follow these simple steps: drop a Wizard control onto your Web Forms, add constituent controls, images, and text to each wizard step, and access the wizard’s data between steps.

A Wizard control is made up of four main parts: header, view of the current step, navigation bar all of which can be further customized using which of the following Wizard control templates. Select all that apply.

a.)     FinishNavigationTemplate
b.)     HeaderTemplate
c.)     FooterTemplate
d.)     StepNavigationTemplate
e.)     StepStyle

Answer:

Wizard Templates

The Wizard control allows you more complete control of the look and feel of the control through templating. The Wizard control supports individual components of the Wizard to be templated separately. You may choose to template 1 or more of these templates for a given Wizard in your web application. The Wizard control supports the following templates:

  • HeaderTemplate
  • SideBarTemplate
  • StartNavigationTemplate
  • StepNavigationTemplate
  • FinishNavigationTemplate

8.)     You are migrating a web site build with ASP.NET 1.x to a new web site which uses the .NET 2.0 framework. You first job is to replace the login system, which is something you built from scratch, with the security/login web controls provided with .Net 2.0.

You are aware that ASP.NET 2.0 ships with several new security Web controls which provide a user interface for accomplishing user account-related tasks. Also, these controls use the Membership system which allows you to use a custom user store provided you create a custom membership provider.

Which one of the following security web controls would provide you with the ability to render different content dependent on whether the page is being visited by an anonymous user or an authenticated user?

a.)     Login web server control
b.)     LoginView web server control
c.)     PasswordRecovery web server control
d.)     LoginStatus web server control
e.)     LoginName web server control

LoginView control displays different Web site content templates (or “views”) for different users, based on’>The LoginView control displays different Web site content templates (or “views”) for different users, based on whether the user is authenticated and, if so, which Web site roles he or she belongs to.
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.loginview.aspx

9.)     By taking advantage of the new Web Parts framework introduced with ASP.NET 2.0, you can build applications that can be easily customized by users at runtime. Users can rearrange the elements of a page built with Web Parts by using a drag-and-drop interface. Users can also add and remove elements in a page by working with one or more Web Part catalogs.

Every web page that contains Web parts must have exactly one WebPartManager control. The location of this control must appear before any WebPartZone controls on the page.

The WebPartManager has a property named ‘DisplayMode’ which the is typically set through the use of one or more link buttons on the page. The code snippet below shows two handlers for two link buttons that change this property.

What value would you set the DisplayMode property of the WebPartManager to if you wanted to display special UI elements and enable end users to add and remove web part page controls from the web page?

           <script runat=”server”>
               void LinkHandler0(Object s, EventArgs e)
               {
                   WebPartManager1.DisplayMode = WebPartManager.CatalogDisplayMode;
               }
               void LinkHandler1(Object s, EventArgs e)
               {
                   WebPartManager1.DisplayMode = WebPartManager.EditDisplayMode;
               }
           </script>
            .
            .
            .
           <asp:LinkButton ID=”LinkButton1″
                              Text=”Customize Page”
                              OnClick=”LinkHandler0″
                              Runat=”Server” />
        
           <asp:LinkButton ID=”LinkButton2″
                              Text=”Edit Web Parts”
                              OnClick=”LinkHandler1″
                              Runat=”Server” />
         
a.)     WebPartManager.BrowseDisplayMode
b.)     WebPartManager.CatalogDisplayMode
c.)     WebPartManager.ConnectDisplayMode
d.)     WebPartManager.DesignDisplayMode
e.)     WebPartManager.EditDisplayMode

BrowseDisplayMode

Displays Web Parts controls and UI elements in the normal mode in which end users view a page.

DesignDisplayMode

Displays zone UI elements and enables users to drag Web Parts controls to change the layout of a page.

EditDisplayMode

Displays special editing UI elements and enables end users to edit the controls on a page.

CatalogDisplayMode

Displays special catalog UI elements and enables end users to add and remove page controls.

ConnectDisplayMode

Displays special connections UI elements and enables end users to connect Web Parts controls.

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webpartdisplaymode.aspx

10.)     The practical consequences of the adaptive rendering model fall into two main areas. First, as a developer, you can design a control once and expect it to work on any type of device or browser for which you have an adapter. Second, you can leverage the extensive Microsoft testing of the common adapters, and reduce your own browser specific testing.

The adaptive rendering model also provides the opportunity for ASP.NET 2.0 to add which of the following services into the control rendering process? Select all that apply.

a.)     Use ‘filters’ to change the look and feel of a control, based on the type of target.
b.)     Use templates to change the entire page layout, based on the type of target.
c.)     Control the rendering on a browser by browser basis.
d.)     Implement uplevel/downlevel determination from ASP.NET 1.x.

Comments»

No comments yet — be the first.