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

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. Your application contains a Web form that includes AJAX-enabled controls. You make use of the code below to create the Web form:

<asp:ScriptManager ID="scMan1" runat="server" />
<asp:UpdatePanel runat="server" ID="updPanel1" UpdateMode="Conditional">
<ContentTemplate>
<asp:TextBox runat="server" ID="txtBox1" />
<asp:Button runat="server" ID="btnSubmit" Text="Submit" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel runat="server" ID="updPanel2" UpdateMode="Conditional">
<ContentTemplate>
...
</ContentTemplate>
</asp:UpdatePanel> 

A client script is dynamically registered as soon as the updFirstPanel UpdatePanel control is update

  • The Web form contains a code-behind fil
  • The code below is written in the file: (The line numbers is included for reference purposes)
    1 Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    2 If Not IsPostBack Then
    3 Dim genScript As String = ScriptGenerator.GenerateScript()
    4
    5 End If
    6 End Sub
    Management wants you to make sure that a client script code is only registered if an asynchronous postback is issued on the updPanel1 UpdatePanel control. You should thus determine the appropriate code fragment that should be added in line 4. What should you identify?

    1. You should consider adding:
      ScriptManager.RegisterClientScriptBlock(txtBox1, GetType(TextBox),_
      “txtBox1_Script”, genScript, False)
    2. You should consider adding:
      ClientScript.RegisterClientScriptBlock(GetType(TextBox), _
      “txtBox1_Script”, genScript)
    3. You should consider adding:
      ScriptManager.RegisterClientScriptBlock(Me, _
      GetType(Page), “txtBox1_Script”, genScript, False)
    4. You should consider adding:
      ClientScript.RegisterClientScriptBlock(GetType(Page), _
      “txtBox1_Script”, genScript)
    5. You should consider adding:
      ClientScript.RegisterClientScriptBlock(GetType(), _
      “txtBox1_Script”, genScript);

    Correct Answer: 1


    Question: You work as an application developer at Company.com. The Company.com network consists of a Microsoft ASP.NET Framework 1.0 application. The current application is configured to run Microsoft IIS 6.0. The current application is not using any of the features that are deprecated in Microsoft .NET Framework 3.5. You receive an instruction from management to configure the application to use ASP.NET Framework 3.5. You need to achieve this without recompiling the application. What should you do?

    1. Your best option would be to edit the ASP.NET runtime version in IIS 6.0.
    2. Your best option would be to add the supportedRuntime configuration element in the Web.config fil
    3. Thereafter the version attribute should be set to v3.5.
    4. Your best option would be to edit the System.Web section handler version number in the machine.config fil
    5. Your best option would be to add the requiredRuntime configuration element to the Web.config fil
    6. Thereafter the version attribute should be set to v3.5.

    Correct Answer: 1


    Question: You work as a Web Developer at Company.com. You are in the process of creating a custom control that will be consumed by a Microsoft ASP.NET 3.5 application. The control is implemented in a separate assembly. Tscking is the default namespace of the assembly. You decide to add a JavaScript file named CKValidation.js to a project folder named TestScripts. You need to configure the image as an embedded resourc

  • You want to programmatically reference the script on the containing page when the page is renedere
  • What should you do? (Choose all that apply)
    1. You should add the following attribute to the AssemblyInfo.cs file:
      [assembly:WebResource(“Company.Scripts.CKValidation.js”, “text/javascript”)]
    2. You should consider overriding the OnLoad method of the control to:
      protected override void OnLoad(EventArgs e)
      {
      Type type = this.GetType();
      string resource = “Company.Scripts.CKValidation.js”;
      Page.ClientScript.GetWebResourceUrl(type, resource);
      base.OnLoad();
      }
    3. You should consider overriding the OnInit method of the control to:
      protected override void OnInit(EventArgs e)
      {
      Type type = this.GetType();
      string resource = “Company.Scripts.CKValidation.js”;
      Page.ClientScript.RegisterClientScriptResource(type, resource);
      base.OnInit();
      }
    4. You should consider overriding the OnPreInit method of the control to:
      protected override void OnPreInit(EventArgs e)
      {
      Type type = this.GetType();
      string resource = “Company.Scripts.CKValidation.js”;
      string script = Page.ClientScript.GetWebResourceUrl(type, resource);
      Page.ClientScript.RegisterClientScriptBlock(type, “JavaScript”, script);
      base.OnPreInit();
      }
    5. You should add following attribute to the AssemblyInfo.cs file:
      [assembly:WebResource(“Validation.js”, “text/javascript”, PerformSubstitution=true)]

    Correct Answer: 1,3


    Question: You work as a Web Developer at Company.com. You make use of Microsoft ASP.NET 3.52 to create a Web application. You decide to add a JavaScript script file named CKScripts.js as an embedded resourc

  • This file will exist in a project subfolder named TestScripts. The name of the application’s assembly is Company. The default namespace of the application is Company.We
  • Management wants you to ensure that the ScriptManager control is used to register the script for usage in the Web application. What should you do?
    1. You should use the declaration:
      <asp:ScriptManager ID=”_scriptManager” runat=”server”>
      <Scripts>
      <asp:ScriptReference Assembly=”Company.dll” Name=”TestScripts.CKScripts.js”/>
      <Scripts>
      </asp:ScriptManager>
    2. You should use the declaration:
      <asp:ScriptManager ID=”_scriptManager” runat=”server”>
      <Scripts>
      <asp:ScriptReference Assembly=”Company” Name=”Company.Web.TestScripts.CKScripts.js”/>
      <Scripts>
      </asp:ScriptManager>
    3. You should use the declaration:
      <asp:ScriptManager ID=”_scriptManager” runat=”server”>
      <Scripts>
      <asp:ScriptReference Assembly=”Company” Name=”Company.Web.CKScripts.js”/>
      <Scripts>
      </asp:ScriptManager>
    4. You should use the declaration:
      <asp:ScriptManager ID=”_scriptManager” runat=”server”>
      <Scripts>
      <asp:ScriptReference Assembly=”Company.dll” Name=”CKScripts.js”/>
      <Scripts>
      </asp:ScriptManager>

    Correct Answer: 2


    Question: You work as a Web Developer at Company.com. You are currently creating a custom control that will be consumed by a Microsoft ASP.NET 3.5 application. In a JavaScript file named CKScript.js the following code exist:

    function OnHeaderClicked(contentDivID)
    {
    var img = event.srcElement;
    var contentDiv = window.document.getElementById(contentDivID);
    if (contentDiv.style.display == "none")
    {
    img.src = "<%= WebResource(ImageUp.gif)%>";
    contentDiv.style.display = "block";
    }
    else
    {
    img.src = "<%= WebResource(ImageDown.gif)%>";
    contentDiv.style.display = "none";
    }
    } 

    You configured the JavaScript file as an embedded resource in a project folder named DataScripts. The default namespace of the project is Company. You have to configure the script as a Web resourc

  • What should you do?
    1. You should use the code segment:
      [assembly:WebResource(“CKScript.js”, “text/javascript”)]
    2. You should use the code segment:
      [assembly:WebResource(“Company.DataScripts.CKScript.js”, “text/javascript”,
      PerformSubstitution=true)]
    3. You should use the code segment:
      [assembly:WebResource(“Company.CKScript.js”, “text/javascript”, PerformSubstitution=false)]
    4. You should use the code segment:
      [assembly:WebResource(“DataScripts.CKScript.js”, “text/javascript”)]

    Correct Answer: 2

  • Tagged . Bookmark the permalink.

    Leave a Reply