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

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 application contains a CapEval class declared using the following code:

public class CapEval
{
public static bool ChkRes(System.Web.Mobile.MobileCapabilities cap, String arg)
{
int _res = cap.ScreenCharactersWidth *
cap.ScreenCharactersHeight;
return _res < int.Parse(arg);
}
} 

The device filter element below is added to the Web.config fil

  • <filter name="Fltr_res" type="MyWebApp.CapEval,MyWebApp" method="ChkRes" /> 

    Management wants you to write a code segment to confirm whether the size of the display is less than 80 characters. You should thus determine the appropriate code segment that will accomplish this. What should you do?

    1. Your best option would be to use the following code segment:
      MobileCapabilities thisMobile;
      thisMobile = Request.Browser as MobileCapabilities;
      if(thisMobile.HasCapability(“Fltr_res”,””).ToString()==”80″)
      {
      }
    2. Your best option would be to use the following code segment:
      MobileCapabilities thisMobile;
      thisMobile = Request.Browser as MobileCapabilities;
      if (thisMobile.HasCapability(“CapEval.ChkRes”, “80”))
      {
      }
    3. Your best option would be to use the following code segment:
      MobileCapabilities thisMobile;
      thisMobile = Request.Browser as MobileCapabilities;
      if (thisMobile.HasCapability(
      “CapEval.ChkRes”, “”).ToString()==”80″)
      {
      }
    4. Your best option would be to use the following code segment:
      MobileCapabilities thisMobile;
      thisMobile = Request.Browser as MobileCapabilities;
      if(thisMobile.HasCapability(“Fltr_res”,”80″))
      {
      }

    Correct Answer: 4


    Question: You work as a Web Developer at Company.com. You are in the process of creating a mobile Web application that uses Microsoft ASP.NET 3.5. You need to add a PhoneCall control to the pag

  • The PhoneCall control must meet the following requirements:
    • On devices that support phone calls the text ‘Call Support’ should be rendered by the control.
    • On the other devices the text ‘Call Support at 1-205-954-7764’should be rendered by the control.
    • The phone number dialed should be 2059547764 on BlackBerry devices.
    • * The phone number dialed should be (205) 954-7764 on other devices.

    You need to declare the PhoneCall control. What should you do?

    1. You should use the declaration:
      <mobile:PhoneCall ID=”phoneCall” runat=”server” TelNo=”(205) 954-7764″
      myBlackBerry:TelNo=”2059547764″ AlternateFormat=”{0} at 1-205-954-7764″>
      Call Support
      </mobile:PhoneCall>
    2. You should use the declaration:
      <mobile:PhoneCall ID=”phoneCall” runat=”server” TelNo=”(205) 954-7764″
      AlternateFormat=”{0} at {1}”>
      <DeviceSpecific>
      <Choice Filter=”myBlackBerry” TelNo=”2059547764″/>
      </DeviceSpecific>
      Call Support
      </mobile:PhoneCall>
    3. You should use the declaration:
      <mobile:PhoneCall ID=”phoneCall” runat=”server” TelNo=”(205) 954-7764″
      myBlackBerry:TelNo=”2059547764″ AlternateFormat=”{0} at {1}”>
      Call Support
      </mobile:PhoneCall>
    4. You should use the declaration:
      <mobile:PhoneCall ID=”phoneCall” runat=”server” AlternateFormat=”{0} at {1}”>
      <DeviceSpecific>
      <Choice Filter=”*” TelNo=”(205) 954-7764″/>
      <Choice Filter=”myBlackBerry” TelNo=”2059547764″/>
      </DeviceSpecific>
      Call Support
      </mobile:PhoneCall>

    Correct Answer: 1


    Question: You work as an application developer at Company.com. You are in the process of creating a Microsoft ASP.NET application that uses Microsoft .NET Framework 3.5. The newly created application contains the code fragment below:

    Public Class CapEval
    Public Shared Function ChkRes( _
    ByVal cap As System.Web.Mobile.MobileCapabilities, _
    ByVal arg As String) As Boolean
    Dim _res As Integer = cap.ScreenCharactersWidth * cap.ScreenCharactersHeight
    Return _res < Integer.Parse(arg)
    End Function
    End Class 

    In the Web.config file of the application you add the device filter element below:

    <filter name="Fltr_res" type="MyWebApp.CapEval,MyWebApp" method="ChkRes" /> 

    Management wants to know when the size of the device display is less than 80 characters. You thus decide to write a code fragment that will accomplish this. What should you do?

    1. Your best option would be to use:
      Dim thisMobile As MobileCapabilities
      thisMobile = TryCast(Request.Browser, MobileCapabilities)
      If thisMobile.HasCapability(“Fltr_res”, “80”) Then
      End If
    2. Your best option would be to use:
      Dim thisMobile As MobileCapabilities
      thisMobile = TryCast(Request.Browser, MobileCapabilities)
      If thisMobile.HasCapability(“CapEval.ChkRes”, “80”) Then
      End If
    3. Your best option would be to use:
      Dim thisMobile As MobileCapabilities
      thisMobile = TryCast(Request.Browser, MobileCapabilities)
      If thisMobile.HasCapability(“Fltr_res”, “”).ToString() = “80” Then
      End If
    4. Your best option would be to use:
      Dim thisMobile As MobileCapabilities
      thisMobile = TryCast(Request.Browser, MobileCapabilities)
      If thisMobile.HasCapability( _
      “CapEval.ChkRes”, “”).ToString() = “80” Then
      End If

    Correct Answer: 1


    Question: You work as a Web Developer at Company.com. You are in the process of creating a Web site using Microsoft ASP.NET 3.5. You decide to create a compact HTML (cHtml) text writer class named CompanyTextWriter. CompanyTextWriter will be used to render to a particular devic

  • The class exists in the App_Code folder. You need to make sure that the Calendar server controls use this text writer when rendering to that devic
  • What should you do? (Choose all that apply)
    1. You should add the following content to the browser definition for the device in a browser file in the App_Browsers folder:
      <controlAdapters markupTextWriterType=”CompanyTextWriter, App_Code”>
      <adapter controlType=”System.Web.UI.WebControls.Calendar”
      adapterType=”CalendarAdapter, App_Code”/>
      </controlAdapters>
    2. You should add the following configuration to the Web.config file:
      <deviceFilters>
      <filter compare=”asp:Calendar” type=”CompanyTextWriter, App_Code”/>
      </deviceFilters>
    3. You should add the following class to the App_Code folder of the application:
      public class CalendarAdapter : System.Web.UI.WebControls.Calendar
      {
      protected override void Render(HtmlTextWriter writer)
      {
      base.Render(new CompanyTextWriter(writer));
      }
      }
    4. You should add the following content to the browser definition for the device in a browser file in the App_Browsers folder:
      <controlAdapters>
      <adapter controlType=”System.Web.UI.WebControls.Calendar”
      adapterType=”CalendarAdapter, App_Code”/>
      </controlAdapters>
    5. You should add the following class to the App_Code folder of the application:
      public class CalendarAdapter : WebControlAdapter
      {
      protected override void Render(HtmlTextWriter writer)
      {
      base.Render(new CompanyTextWriter(writer));
      }
      }

    Correct Answer: 4,5


    Question: You work as a Web Developer at Company.com. Company.com makes use of Microsoft ASP.NET 3.5. You create a Web application. You add the following configuration to the Web.config file:

    <profile>
    <properties>
    <add name="Theme" />
    </properties>
    </profile> 

    You add the following code to the code-behind file for the Default.aspx web page:

    public partial class SetupInfo : System.Web.UI.Page
    {
    } 

    You have to set the theme of the page programmatically to the existing user profile’s Theme property. What should you do?

    1. You should consider using the code segment:
      protected override void OnPreInit(EventArgs e)
      {
      this.Theme = Profile.Theme;
      base.OnPreInit(e);
      }
    2. You should consider using the code segment:
      protected void Page_Load(object sender, EventArgs e)
      {
      this.Theme = Profile.Theme;
      }
    3. You should consider using the code segment:
      protected override void OnPreRender(EventArgs e)
      {
      string theme = this.Theme;
      this.Theme = Context[“Profile.Properties.Theme”];
      base.OnPreRender(e);
      this.Theme = theme;
      }
    4. You should consider using the code segment:
      protected override void OnInit(EventArgs e)
      {
      base.OnInit(e);
      this.Theme = Context[“Profile.Theme”];
      }

    Correct Answer: 1

  • Tagged . Bookmark the permalink.

    Leave a Reply