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

Question: You work as a Web Developer at Company.com. You are in the process of creating a Web application that uses Microsoft ASP.NET 3.5. The following code is in the code-behind file for a page:

private void Process(Location[] locations)
{
if (_scriptManager.IsInAsyncPostBack)
{
JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
string jsonArray = jsonSerializer.Serialize(locations);
_scriptManager.RegisterDataItem(_locationGridView, jsonArray, true);
}
} 

The above code will create a JavaScript Object Notation (JSON) array from an array of Location instances. Within four nested naming containers the _locationGridView control is contained on the page. The senior developer wants you to access the JSON array from a user script. What should you do?

  1. You should use the code:
    Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(OnLoaded);
    function OnLoaded(sender, args)
    {
    var dataItems = args.get_dataItems();
    var locations = dataItems[‘<%= _locationGridView.ClientID %>’];
    }
  2. You should use the code:
    Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(OnRequest);
    function OnRequest(sender, args)
    {
    var dataItems = args.get_postBackElement();
    var locations = dataItems[‘_locationGridView’];
    }
  3. You should use the code:
    Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(OnLoading);
    function OnLoading(sender, args)
    {
    var dataItems = args.get_dataItems();
    var locations = dataItems[‘_locationGridView’];
    }
  4. You should use the code:
    Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(OnInit);
    function OnInit(sender, args)
    {
    var dataItems = args.get_postBackElement();
    var locations = dataItems[‘<%= _locationGridView.ClientID %>’];
    }

Correct Answer: 1


Question: You work as the system developer at Company.com. You make use of Microsoft ASP.NET 3.5 in order to create a Web application. You are in the process of creating a custom server control named Test Circle. Test Circle exists in the Company.WebControls namespace. TestCircle contains a single read-write property named Radius of type Double. You decide to implement the control as an Asynchronous JavaScript as well as an XML (AJAX) extender control that will permit the Radius property to be set in client script. You then implement the following code in an associated JavaScript file (The line numbers are included for reference purposes):
01 Type.registerNamespace(“Company.WebControls”);
02 Company.WebControls.TestCircle = function(elem)
03 {
04 Company.WebControls.TestCircle.initializeBase(this, elem);
05 this._radius = 0;
06 }
07 Company.WebControls.TestCircle.prototype =
08 {
09 initialize : function()
10 {
11 Company.WebControls.callBaseMethod(this, ‘initialize’);
12 },
13 dispose : function()
14 {
15 Company.WebControls.callBaseMethod(this, ‘dispose’);
16 },
17
18 }
19 Company.WebControls.TestCircle.registerClass(‘Company.WebControls.TestCircle’,
20 Sys.UI.Control);
You need to identify the Radius property in the JavaScript file. You therefore need to determine the code segment that should be inserted at line 17. What should you do?

  1. You should use the following:
    Radius : function()
    {
    return this._radius;
    }
  2. You should use the following:
    get_Radius : function()
    {
    return this._radius;
    },
    set_Radius : function(value)
    {
    this._radius = value;
    }
  3. You should use the following:
    Radius : function()
    {
    return this._radius;
    },
    Radius : function(value)
    {
    this._radius = value;
    }
  4. You should use the following:
    Radius : function(value)
    {
    this._radius = value;
    }

Correct Answer: 2


Question: You work as a Web Application Developer at Company.com. You make use of .NET Framework 3.5 to create an ASP.NET application. You decide to create a Web user control named KingShare. KingShare is compiled as a library. The code segment below is written for KingShare. (The line numbers is included for reference purposes)
1 protected override void OnInit(EventArgs e) {
2 base.OnInit(e);
3
4 }
The master pages in the application contains the <%@ Master Language=”C#” EnableViewState=”false” %> directive. You receive an instruction from the application developer to make sure that the KingShare state is able to persist on the pages that reference the master page. You should thus identify the appropriate code segment you need to add to line 3 to achieve this. What should you do?

  1. Your best option would be to insert Page.RegisterRequiresPostBack(this)
  2. Your best option would be to insert Page.RegisterRequiresControlState(this)
  3. Your best option would be to insert Page.UnregisterRequiresControlState(this)
  4. Your best option would be to insert Page.RegisterStartupScript(“KingShare”,”server”)

Correct Answer: 2


Question: You work as a Web Developer at Company.com. You use Microsoft ASP.NET 3.5 to create a Web application. The application contains the Windows Communication Foundation (WCF) service named CKServic

  • CKService contains a method named CKTime that takes no parameters and returns the current time from a government time server. You decide to register the proxy to the service on a pag
  • The proxy is defined in the Company.Services namespac
  • You need to call the CKTime method and exhibit it in an alert window. What should you do?
    1. You should consider using the code segment:
      function CallService()
      {
      var result = null;
      Company.Services.CKService.CKTime(result);
      window.alert(result);
      }
    2. You should consider using the code segment:
      function CallService()
      {
      var result = Company.Services.CKService.CKTime();
      window.alert(result);
      }
    3. You should consider using the code segment:
      function CallService()
      {
      Company.Services.CKService.CKTime(OnSuccess);
      }
      function OnSuccess(result)
      {
      window.alert(result);
      }
    4. You should consider using the code segment:
      function CallService()
      {
      Company.Services.CKService.CKTime(OnSuccess);
      }
      function OnSuccess()
      {
      window.alert(Company.Services.CKService.result);
      }

    Correct Answer: 3


    Question: You work as a Web Developer at Company.com. You are in the process of creating a Web application that uses Microsoft ASP.NET 3.5. You check the following Asynchronous JavaScript and XML (AJAX)-enabled Windows Communication Foundation (WFC) service that exists in an ASP.NET Web application:

    namespace Company.Information.Services
    {
    [ServiceContract(Namespace="Company.Services")]
    public class SearchService
    {
    [OperationContract]
    public string LookupNum(string telNo)
    {
    // Code omitted for brevity
    }
    }
    } 

    You decide to add the ScriptManager control to a page and reference the servic

  • You then add a TextBox control named _telTextBox. You have to call the LookupNum method in order to pass to it the text display in the TextBox control. The return value of the method should also be displayed in the browser alert window. The naming container of the TextBox control is the pag
  • You need to write the suitable JavaScript code in order to call the LookupNum metho
  • What should you do?
    1. You should use the code segment:
      var telNo = $get(“_telTextBox”).value;
      Company.Information.Services.SearchService.LookupNum(telNo);
      window.alert($get(“ReturnValue”).value);
    2. You should use the code segment:
      var telNo = $get(“_telTextBox”).value;
      var result = Company. Services.SearchService.LookupNum(telNo);
      window.alert(result);
    3. You should use the code segment:
      var telNo = $get(“_telTextBox”).value;
      Company.Services.SearchService.LookupNum(telNo, OnSuccess);
      function OnSuccess()
      {
      window.alert($get(“ReturnValue”).value);
      }
    4. You should use the code segment:
      var telNo = $get(“_telTextBox”).value;
      Company.Services.SearchService.LookupNum(telNo, OnSuccess);
      function OnSuccess(result)
      {
      window.alert(result);

    Correct Answer: 4

  • Tagged . Bookmark the permalink.

    Leave a Reply