Exam 70-562 : Microsoft .NET Framework 3.5, ASP.NET Application Development – 27

Question: You work as an application developer at Company.com. You make use of .NET Framework 3.5 to create an ASP.NET application. You write the code below in order to add a Calendar server control to the Web pag

  • <asp:Calendar SelectionMode="DayWeek" ID="Cal1" runat="server"></asp:Calendar> 

    You receive an instruction from the senior developer to disable Saturdays and Sundays in the Calendar control. You thus need to determine the appropriate code you need to add to the Cal1 DayRender event handler. What should you do?

    1. You should consider adding:
      if (e.Day.IsWeekend) {
      if (Cal1.SelectedDates.Contains(e.Day.Date))
      Cal1.SelectedDates.Remove(e.Day.Date);
      }
    2. You should consider adding:
      List<DateTime> list = new List<DateTime>();
      foreach (DateTime st in (sender as Calendar).SelectedDates) {
      if (st.DayOfWeek == DayOfWeek.Saturday || st.DayOfWeek == DayOfWeek.Sunday) {
      list.Add(st);
      }
      }
      foreach (DateTime dt in list) {
      (sender as Calendar).SelectedDates.Remove(dt);
      }
    3. You should consider adding:
      if (e.Day.IsWeekend) {
      e.Day.IsSelectable = false;
      }
    4. You should consider adding:
      List<DateTime> list = new List<DateTime>();
      foreach (DateTime st in (sender as Calendar).SelectedDates) {
      if (st.DayOfWeek == DayOfWeek.Saturday || st.DayOfWeek == DayOfWeek.Sunday) {
      list.Add(st);
      }
      }
      foreach (DateTime dt in list) {
      (sender as Calendar).SelectedDates.Remove(dt);
      }

    Correct Answer: 3


    Question: You work as a Web Application Developer. You make use of Microsoft .NET Framework 3.5 to create a Microsoft ASP.NET application. You decide to create a Web form. You apoplication contain a Web form with the following code:
    01 <script runat=”server”>
    02 protected void sbm_Handler(object sender, EventArgs e)
    03 {
    04 // processing code
    05 }
    06 </script>
    07 <div>
    08 <asp:ScriptManager ID=”ScMan1″ runat=”server” />
    09
    10 <asp:UpdatePanel ID=”updPan1″ UpdateMode=”Conditional” runat=”server”>
    11 <ContentTemplate>
    12 <!– add content here –>
    13 <asp:Button ID=”btnSbm” runat=”server” Text=”Submit” OnClick=”sbm_Handler” />
    17 </ContentTemplate>
    18 </asp:UpdatePanel>
    19 </div>
    Management wants you to create an AJAX client-side script that suppresses any Click events while the smb_Handler request is processe

  • What should you do?
    1. You should consider adding:
      <script type=”text/javascript” language=”javascript”>
      var x = Sys.WebForms.PageRequestManager.getInstance();
      x.add_initializeRequest(checkPostback);
      function checkPostback(sender, args) {
      if (x.get_isInAsyncPostBack() && args.get_postBackElement().id == ‘btnSbm’) {
      args.set_cancel(true);
      alert(‘A previous request is being processed.’);
      } }
      </script>
    2. You should consider adding:
      <script type=”text/javascript” language=”javascript”>
      var x = Sys.WebForms.PageRequestManager.getInstance();
      x.add_beginRequest(checkPostback);
      function checkPostback(sender, args) {
      if (x.get_isInAsyncPostBack() && args.get_postBackElement().id == ‘btnSbm’) {
      x.abortPostBack();
      alert(‘A previous request is being processed.’);
      } }
      </script>
    3. You should consider adding:
      <script type=”text/javascript” language=”javascript”>
      var x = Sys.WebForms.PageRequestManager.getInstance();
      x.add_beginRequest(checkPostback);
      function checkPostback(sender, args) {
      var request = args.get_request();
      if (x.get_isInAsyncPostBack() && args.get_postBackElement().id == ‘btnSbm’) {
      request.completed(new Sys.CancelEventArgs());
      alert(‘A previous request is being processed.’);
      } }
      </script>
    4. You should consider adding:
      <script type=”text/javascript” language=”javascript”>
      var x = Sys.WebForms.PageRequestManager.getInstance();
      x.add_initializeRequest(checkPostback);
      function checkPostback(sender, args) {
      if (x.get_isInAsyncPostBack() && args.get_postBackElement().id == ‘btnSbm’) {
      x.abortPostBack();
      alert(‘A previous request is being processed.’);
      }
      }
      </script>

    Correct Answer: 1


    Question: You use Microsoft .NET Framework 3.5 to create a Microsoft ASP.NET application for Company.com. You application contains a client-script function that uses the code below: (The line numbers is included for reference purposes)
    1 function updCrtl(lblId, updText) {
    2 var myLbl = $find(lblId);
    3 myLbl.innerHTML = updText;
    4 }
    This newly created script will make use of ASP.NET AJAX. The script will also update the text of all the Label controls in the web form. It has come to your attention that the Label controls are not updated when the client script function is teste

  • However, you receive the “‘null’ is null or not an object” JavaScript error message in the browser. What should you do?
    1. To resolve the error you need to replace line 2 with
      var myLbl = Sys.UI.DomElement.getElementById($get(lblId))
    2. To resolve the error you need to replace line 3 with
      myLbl.innerText = updText;
    3. To resolve the error you need to replace line 2 with
      var myLbl = $get(lblId)
    4. To resolve the error you need to replace line 2 with
      var myLbl = Sys.UI.DomElement.getElementById($find(lblId))

    Correct Answer: 3


    Question: You work as a Web Developer at Company.com. You are in the process of creating a mobile Web application. You use Microsoft ASP.NET 3.5 to create the Web application. In an assembly named MobileUser the following code exists:

    namespace Company.MobileUser
    {
    public class Capabilities
    {
    public static bool IsEnhancedDevice(MobileCapabilities capabilities, string optional)
    {
    return (capabilities["AJAX"] == Boolean.TrueString &&
    capabilities["Silverlight"] == Boolean.TrueString);
    }
    }
    } 

    The following code is contained on a page in the Web application:

    MobileCapabilities capabilities = (MobileCapabilities)Request.Browser;
    bool isEnhancedDevice = capabilities.HasCapability("SilverlightAndAjax", null) 

    You have to make sure that the code calls the IsEnhancedDevice method of the Capabilities class. You configure the Web.config file to accomplish this. What should you do?

    1. You should consider using the configuring:
      <mobileControls>
      <device name=”SilverlightAndAjax” predicateClass=”Company.MobileUser.Capabilities,
      MobileUser”
      predicateMethod=”IsEnhancedDevice”/>
      </mobileControls>
    2. You should consider using the configuring:
      <clientTarget>
      <add userAgent=”SilverlightAndAjax” alias=”Company.MobileUser.Capabilities.IsEnhancedDevice,
      MobileUser” />
      </clientTarget>
    3. You should consider using the configuring:
      <browserCaps>
      <filter match=”SilverlightAndAjax”/>
      <result type=”Company.MobileUser.Capabilities, MobileUser”/>
      <use as=”IsEnhancedDevice”/>
      </browserCaps>
    4. You should consider using the configuring:
      <deviceFilters>
      <filter name=”SilverlightAndAjax” type=”Company.MobileUser.Capabilities, MobileUser”
      method=”IsEnhancedDevice”/>
      </deviceFilters>

    Correct Answer: 4


    Question: You work as a Web Developer at Company.com. You are in the process of creating a mobile Web application. To accomplish this you decide to make use of Microsoft ASP.NET 3.5. The method below is depicted in the code-behind file for a page:

    public bool IsGpsSupported(MobileCapabilities capabilities, String optionalArgument)
    {
    return Request.Headers["GPS"] == Boolean.TrueString;
    } 

    This above method identify whether the device of the browser supports the global positioning system (GPS). You receive an instruction from management to render a mobile Panel control that will meet the following set requirements:

    • The Panel control should render a custom control named TestMap if the device supports GPS or
    • The Panel control should show the following text: “GPS is not supported on this device”.

    It is vital that you declare the mobile Panel control. What should you do?

    1. You should add the following configuration to the Web.config file:
      <deviceFilters>
      <filter name=”IsGpsSupported” argument=”GPS”/>
      </deviceFilters>
      You need to add the following markup to the page:
      <mobile:Panel ID=”_panel” runat=”server”>
      <mobile:DeviceSpecific ID=”_deviceSpecific” runat=”server”>
      <Choice Filter=”Headers”>
      <ContentTemplate>
      <cc1:Map ID=”_map” runat=”server”/>
      </ContentTemplate>
      </Choice>
      <Choice>
      <ContentTemplate>
      GPS is not supported on this devic
    2. </ContentTemplate>
      </Choice>
      </mobile:DeviceSpecific>
      </mobile:Panel>
    3. You should add the following configuration to the Web.config file:
      <deviceFilters>
      <filter name=”IsGpsSupported” compare=”GPS”/>
      </deviceFilters>
      You need to add the following markup to the page:
      <mobile:Panel ID=”_panel” runat=”server”>
      <mobile:DeviceSpecific ID=”_deviceSpecific” runat=”server”>
      <Choice Filter=”IsGpsSupported:true”>
      <ContentTemplate>
      <cc1:Map ID=”_map” runat=”server”/>
      </ContentTemplate>
      </Choice>
      <Choice>
      <ContentTemplate>
      GPS is not supported on this devic
    4. </ContentTemplate>
      </Choice>
      </mobile:DeviceSpecific>
      </mobile:Panel>
    5. You should add the following markup to the page:
      <mobile:Panel ID=”_panel” runat=”server”>
      <mobile:DeviceSpecific ID=”_deviceSpecific” runat=”server”>
      <Choice Filter=”GPS”>
      <ContentTemplate>
      <cc1:Map ID=”_map” runat=”server”/>
      </ContentTemplate>
      </Choice>
      <Choice>
      <ContentTemplate>
      GPS is not supported on this devic
    6. </ContentTemplate>
      </Choice>
      </mobile:DeviceSpecific>
      </mobile:Panel>
    7. You should add the following markup to the page:
      <mobile:Panel ID=”_panel” runat=”server”>
      <mobile:DeviceSpecific ID=”_deviceSpecific” runat=”server”>
      <Choice Filter=”IsGpsSupported”>
      <ContentTemplate>
      <cc1:Map ID=”_map” runat=”server”/>
      </ContentTemplate>
      </Choice>
      <Choice>
      <ContentTemplate>
      GPS is not supported on this devic
    8. </ContentTemplate>
      </Choice>
      </mobile:DeviceSpecific>
      </mobile:Panel>

    Correct Answer: 4

  • Tagged . Bookmark the permalink.

    Leave a Reply