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

Question: You work as an application developer at Company.com. You are in the process of creating an ASP.NET application in .NET Framework 3.5. The application is configured to use Form Authentication. You activate the ASP.NET AJAX authentication service in the application’s Web.config file. Your application contains a Web form with the code segment shown below:

<asp:ScriptManager ID="ScriptMan1" runat="server" />
<asp:TextBox runat="server" ID="txtEmail" Width="200px" />
<asp:TextBox runat="server" ID="txtPassw" Width="200px" />
<asp:Button runat="server" ID="btnLogin" Text="Login" OnClientClick="login(); return false;" /> 

You add a script to authenticate the user when the user clicks the btnLogin button. The script is shown below:

<script type="text/javascript">
function login() {
var useremail = $get('txtEmail').value;
var userpword = $get('txtPassw').value;
// authentication logic
}
function onPassed(validCredentials, userContext, methodName)
{
// notify user on authentication result
}
function onFailed(error, userContext, methodName)
{
// notify user on authentication exception
}
</script>

You need to add the authentication logic to the script. The authentication logic must ensure that either the onLoginPassed function is called to notify the user when authentication passes, or the onLoginFailed function is called to display an error message when authentication fails.
What should you do?

  1. You should consider adding the code below:
    var auth = Sys.Services.AuthenticationService;
    auth.set_defaultLoginCompletedCallback(onPassed);
    try
    {
    auth.login(useremail, userpword, false, null, null, null, null, null);
    } catch (err) {
    onFailed(err, null, null);
    }
  2. You should consider adding the code below:
    var auth = Sys.Services.AuthenticationService;
    auth.set_defaultFailedCallback(onFailed);
    var validUser = auth.login(useremail, userpword, false, null, null, null, null, null);
    if (validUser)
    onPassed(true, null, null);
    else
    onPassed(false, null, null);
    end if
  3. You should consider adding the code below:
    var auth = Sys.Services.AuthenticationService;
    auth.login(useremail, userpword, false, null, null, onPasses, onFailed, null);
  4. You should consider adding the code below:
    var auth = Sys.Services.AuthenticationService;
    try
    {
    var validUser = auth.login(useremail, userpword, false, null, null, null,
    null, null);
    if (validUser)
    onPassed(true, null, null);
    else
    onPassed(false, null, null);
    end if
    } catch (err) {
    onFailed(err, null, null);
    }

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. A third-party assembly contains custom server controls. This assembly does not contain a strong name and it’s not part of the application’s Microsoft Visual Studio 2008 solution. You have to make sure that the other users are able to use the custom controls. You decide to configure the applications project. What should you do?

  1. You should add a project reference to the project.
  2. You should add a Web reference to the project.
  3. You should add a service reference to the project.
  4. You should add an assembly reference to the project.

Correct Answer: 4


Question: You work as an application developer at Company.com. A previous developer created a Microsoft ASP.NET Web application in Microsoft .NET Framework 3.5. You use the source control repository to acquire the most recent version of the project. However, when you attempt to compile the project on your computer you notice that the assembly reference is missing. You need to make sure that you are able to compile the project.
What should you do?

  1. You need to ensure that the assembly reference for the missing assembly is added manually.
  2. You need to ensure that a reference path for the missing assembly is added in the property pages of the project.
  3. You need to ensure that a working directory for the missing assembly is added in the property pages of the project.
  4. You need to ensure that the output path for the missing assembly is added in the property pages of the project.

Correct Answer: 2


Question: You work as an application developer at Company.com. You are in the process of creating an ASP.NET application that uses Microsoft .NET Framework 3.5. You decide to create a JavaScript file named DataScript.js. The following code segment was written to create this file:

function divide(x, y) {
if (y == 0) {
var errorMsg = Messages.DivideByZero;
alert(errorMsg);
return null;
}
return x/y;
}

The DataScript.js file is inserted as a resource in a Class Library project that uses the namespace Data.Resources. The JavaScript Messages object is used by the DataScript.js in order to retrieve messages from a resource file. This resource file is named TestMsgResources.resx. In the ASP.NET application you add an AJAX Web form as well as referencing the Class Library. Thereafter an ASP.NET AJAX ScriptReference element is added to the AJAX Web form. You receive an instruction from management to make sure that the JavaScript function is able to access the error messages defined in the resource file. You should thus determine the appropriate code segment that should be added to the AssemblyInfo.vb file.
What should you do?

  1. Your best option would be to insert the following code segment:
    <assembly: ScriptResource (“Data.Resources.DataScript.js”, “Data.Resources.TestMsgResources”, “Messages”)>
  2. Your best option would be to insert the following code segment:
    <assembly: ScriptResource (“Data.Resources.DataScript”, “Data.Resources.TestMsgResources.resx”, “Messages”)>
  3. Your best option would be to insert the following code segment:
    <assembly: ScriptResource (“DataScript.js”, “TestMsgResources.resx”, “Messages”)>
  4. Your best option would be to insert the following code segment:
    <assembly: ScriptResource (“DataScript”, “TestMsgResources”, “Messages”)>

Correct Answer: 1


Question: You work as an application developer at Company.com. You make use of .NET Framework 3.5 in order to create a Microsoft ASP.NET application. You decide to create a Web form. You add the subsequent code fragment to the Web form.

<asp:Repeater ID="rpt1" runat="server" DataSourceID="ds1" ItemDataBound="rpt1_b">
<ItemTemplate>
<asp:Label ID="lblQty" runat="server" Text='<%# Eval("Qty") %>' />
</ItemTemplate>
</asp:Repeater> 

The DataSource control named ds1 recovers the Quantity column values from a table named Orders. You create the rpt1_b event handler using the subsequent code fragment. (The line numbers is included for reference purposes)
1 protected void rpt1_b(object sender, RepeaterItemEventArgs e)
2 {
3
4 if(ckLbl != null)
5 if(int.Parse(ckLbl.Text) < 10)
6 ckLbl.ForeColor = Color.Red;
7 }
You receive an instruction from management to recover a reference to the lblQty Label control into a variable. The variable is named ckLbl.
What should you do?

  1. Your best option would be to insert Label ckLbl = e.Item.FindControl(“lblQty”) as Label at line 3.
  2. Your best option would be to insert Label ckLbl = Page.FindControl(“lblQty”) as Label at line 3.
  3. Your best option would be to insert Label ckLbl = rptData.FindControl(“lblQty”) as Label at line 3.
  4. Your best option would be to insert Label ckLbl = e.Item.Parent.FindControl(“lblQty”) as Label at line 3.

Correct Answer: 1

Tagged . Bookmark the permalink.

Leave a Reply