PrepAway - Latest Free Exam Questions & Answers

Author: seenagape

Which code segment should you use?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code fragment.
<asp:ScriptManager ID=”ScriptManager1″ runat=”server” />
<asp:UpdatePanel ID=”updateLabels” runat=”server” UpdateMode=”Conditional”>
<ContentTemplate>
<asp:Label ID=”Label1″ runat=”server” />
<asp:Label ID=”Label2″ runat=”server” />
<asp:Button ID=”btnSubmit” runat=”server” Text=”Submit”
onclick=”btnSubmit_Click” />
</ContentTemplate>
</asp:UpdatePanel>
<asp:Label id=”Label3″ runat=”server” />

You need to ensure that when you click the btnSubmit Button control, each Label control value is asynchronously updatable.

Which code segment should you use?

Which task should your code perform?

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft
ADO.NET. The application connects to a Microsoft SQL Server 2005 database.The
application uses a SqlConnection object that is active for the lifetime of a user session.You
need to ensure that the application gracefully handles all the exceptions that cannot be
recovered.Which task should your code perform?

02 new Uri (?http://localhost:8000/ExamService?

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You write the following code segment. (Line numbers are included for reference only.)

01 Uri baseAddress=
02 new Uri (?http://localhost:8000/ExamService?);
03 Uri mexAddress=new Uri(“”);
04 ServiceHost serviceHost=new ServiceHost(typeof( 05 ExamService), baseAddress);
06 ServiceMetadataBehavior smb=
07 serviceHost.Description.Behaviors.
08 Find<ServiceMetadataBehavior>();
09 if (smb != null)
10 {
12 }
13 else
14 {
15 smb=new ServiceMetadataBehavior();
16 serviceHost.Description.Behaviors.Add(smb);

17 }
18 smb.HttpGetUrl=mexAddress;
When you browse to the base address of the service, you receive the following message:
“Metadata publishing for this service is currently disabled.” You debug the code and discover that the ServiceMetadataBehavior behavior was previously nonexistent. You need to enable metadata publishing. What should you do?

What should you do?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You write the following code segment to create a client-script function. (Line numbers are included for reference only.)

01 function updateLabelControl(labelId, newText) {
02 var label = $find(labelId);
03 label.innerHTML = newText;
04 }

The client script function uses ASP.NET AJAX and updates the text of any Label control in the Web form.

When you test the client script function, you discover that the Label controls are not updated. You receive the following JavaScript error message in the browser: “‘null’ is null or not an object.”

You need to resolve the error.

What should you do?

Which code fragment should you insert at line 04?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework
version 3.5.The application contains a DataSourceControl named CategoriesDataSource that
is bound to a Microsoft SQL Server 2005 table. The CategoryName column is the primary
key of the table. You write the following code fragment in a FormView control. (Line
numbers are included for reference only.)
01 <tr>
02 <td align=”right”><b>Category:</b></td>
03 <td><asp:DropDownList ID=”InsertCategoryDropDownList”
04
05 DataSourceID=”CategoriesDataSource”
06 DataTextField=”CategoryName”
07 DataValueField=”CategoryID”
08 RunAt=”Server” />
09 </td>
10 </tr>
You need to ensure that the changes made to the CategoryID field can be written to the
database.Which code fragment should you insert at line 04?

Which code segment should you insert at line 06?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create a login Web form by using the following code fragment.

<asp:ScriptManager ID=”ScriptManager1″ runat=”server” />
<asp:TextBox runat=”server” ID=”txtUser” Width=”200px” />
<asp:TextBox runat=”server” ID=”txtPassword” Width=”200px” />
<asp:Button runat=”server” ID=”btnLogin” Text=”Login” OnClientClick=”login(); return false;” />

When a user clicks the btnLogin Button control, the login() client-side script is called to authenticate the user. The credentials provided in the TextBox controls are used to call the client-side script.

You also add the following client-script code fragment in the Web form. (Line numbers are included for reference only.)

01 <script type=”text/javascript”>
02 function login() {
03 var username = $get(‘txtUser’).value;
04 var password = $get(‘txtPassword’).value;
05
06 // authentication logic.
07 }
08 function onLoginCompleted(validCredentials, userContext,
09 methodName)
10 {
11 // notify user on authentication result.
12 }
13
14 function onLoginFailed(error, userContext, methodName)
15 {
16 // notify user on authentication exception.
17 }
18 </script>

The ASP.NET application is configured to use Forms Authentication. The ASP.NET AJAX authentication service is activated in the Web.config file.

You need to ensure that the following workflow is maintained:

* On successful authentication, the onLoginCompleted client-script function is called to notify the user.
* On failure of authentication, the onLoginFailed client-script function is called to display an error message.

Which code segment should you insert at line 06?

Which code fragment should you use?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework
version 3.5.You create a FormView control to access the results of a query. The query
contains the following fields:
EmployeeID
FirstName
LastName
The user must be able to view and update the FirstName field.You need to define the control
definition for the FirstName field in the FormView control.Which code fragment should you use?

What should you do?

You create an application by using Microsoft Visual Studio .NET 2008 and the .NET Framework 3.5. The application communicates with other systems by using a proprietary messaging format. The company must monitor the response-time of the communication. The monitoring strategy of the application must meet the following requirements:

Information must be logged to a central location.
Historical data must not be overwritten without administrator action.
Information can be displayed in real time.

Information can be displayed in graphical format.
Information can be displayed along with system-supplied performance data.

You need to design a strategy that monitors response-times to meet the requirements. What should you do?

Which code segment should you insert at line 06?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create the following controls:

* A composite custom control named MyControl.
* A templated custom control named OrderFormData.

You write the following code segment to override the method named CreateChildControls() in the MyControl class. (Line numbers are included for reference only.)

01 protected override void
02 CreateChildControls() {
03 Controls.Clear();
04 OrderFormData oFData = new
05 OrderFormData(“OrderForm”);
06
07 }

You need to add the OrderFormData control to the MyControl control.

Which code segment should you insert at line 06?