PrepAway - Latest Free Exam Questions & Answers

Author: admin

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 Web form by using ASP.NET AJAX.
The Web form contains the following code fragment. (Line numbers are included for reference only.)
01 <script type="text/javascript">
02
03 Sys.Application.add_init(initComponents);
04
05 function initComponents() {
06
07 }
08
09 </script>
10
11 <asp:ScriptManager ID="ScriptManager1"
12 runat="server" />
13 <asp:TextBox runat="server" ID="TextBox1" />
You need to create and initialize a client behavior named MyCustomBehavior by using the initComponents function. You also need to ensure that MyCustomBehavior is attached to the TextBox1 Textbox control.
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:
EmployeID
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?

Which code fragment should you insert at line 10?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a Web form in the application by using the following code fragment. (Line numbers are included for reference only.)
01 <script runat="server">
02 Protected Sub Button_Handler(sender As Object, e As EventArgs)
03 ‘ some long-processing operation.
04
05 End Sub
06 </script>
07 <div>
08 <asp:ScriptManager ID="defaultScriptManager"
09 runat="server" />
10
11 <asp:UpdatePanel ID="defaultPanel"
12 UpdateMode="Conditional" runat="server">
13 <ContentTemplate>
14 <!– more content here –>
15 <asp:Button ID="btnSubmit" runat="server"
16 Text="Submit" OnClick="Button_Handler" />
17 </ContentTemplate>
18 </asp:UpdatePanel>
19 </div>
You plan to create a client-side script code by using ASP.NET AJAX.
You need to ensure that while a request is being processed, any subsequent Click events on the btnSubmit Button control are suppressed.
Which code fragment should you insert at line 10?

Which method should you add to the Web page?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create two user controls named UserCtrlA.ascx and UserCtrlB.ascx. The user controls postback to the server.
You create a new Web page that has the following ASPX code.
<asp:CheckBox ID="Chk" runat="server" oncheckedchanged="Chk_CheckedChanged" AutoPostBack="true" />
<asp:PlaceHolder ID="PlHolder" runat="server"></asp:PlaceHolder>
To dynamically create the user controls, you write the following code segment for the Web page.

Public Sub LoadControls()
If ViewState("CtrlA") IsNot Nothing Then
Dim c As Control
If CBool(ViewState("CtrlA")) = True Then
c = LoadControl("UserCtrlA.ascx")
Else
c = LoadControl("UserCtrlB.ascx")
End If
c.ID = "Ctrl"
PlHolder.Controls.Add(c)
End If
End Sub

Protected Sub Chk_CheckedChanged(sender As Object, e As EventArgs)
ViewState("CtrlA") = Chk.Checked
PlHolder.Controls.Clear()
LoadControls()
End Sub

You need to ensure that the user control that is displayed meets the following requirements:
It is recreated during postback It retains its state.
Which method should you add to the Web page?

Which code segment should you insert at line 04?

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 Overrides Sub CreateChildControls()
02 Controls.Clear()
03 Dim oFData As New OrderFormData("OrderForm")
04
05 End Sub

You need to add the OrderFormData control to the MyControl control.
Which code segment should you insert at line 04?

Which markup should you use?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application contains a mobile Web page.
You add the following StyleSheet control to the Web page.

<mobile:StyleSheet id="MyStyleSheet" runat="server">
<mobile:Style Name="StyleA" Font-Name="Arial" Font-Bold="True" Wrapping="NoWrap">
</mobile:Style>
</mobile:StyleSheet>

You need to add a Label control named MyLabel that uses the defined style in the MyStyleSheet StyleSheet control.
Which markup should you use?

Which DeviceSpecific element should you insert at line 02?

You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5.
The application contains the following device filter element in the Web.config file.
<filter name="isHtml" compare="PreferredRenderingType"argument="html32" />
The application contains a Web page that has the following image control. (Line numbers are included for reference only.)

01 <mobile:Image ID="imgCtrl" Runat="server">
02
03 </mobile:Image>

You need to ensure that the following conditions are met:
The imgCtrl Image control displays the highRes.jpg file if the Web browser supports html
The imgCtrl Image control displays lowRes.gif if the Web broser does not support html.
Which DeviceSpecific element should you insert at line 02?

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 clien-script function is called to notify the user.
On failure of authentication, the onLoginFailed clien-script function is called to display an error message.
Which code segment should you insert at line 06?