PrepAway - Latest Free Exam Questions & Answers

Author: seenagape

Which code segment should you use?

You are implementing an ASP.NET page. Client-side script requires data. Your application includes a
class named Person with a Name property of type string. The code-behind file of the page includes
the following code segment.
Public JsonValue As String
Dim people As List(Of Person) = GetPeopleList()
Dim json As JavaScriptSerializer = New JavaScriptSerializer()
You need to use the JavaScriptSerializer class to serialize only the value of the Name property of
each item in the people list. Which code segment should you use?

You need to configure the ObjectDataSource control to pass the value of the pid field to GetProductsByProductI

You are implementing an ASP.NET page. You add and configure the following ObjectDataSource.
<asp:ObjectDataSource SelectMethod=”GetProductByProductId”
ID=”odc” runat=”server” TypeName=”ProductDAL”>
<SelectParameters>
<asp:Parameter Name=”productId” Type=”Int32″ />
</SelectParameters>
</asp:ObjectDataSource>
The page will be called with a query string field named pid. You need to configure the
ObjectDataSource control to pass the value of the pid field to GetProductsByProductId method.
What should you do?

Which two actions should you perform?

You are developing an ASP.NET Web service. The following code segment implements the service.
(Line numbers are included for reference only.)
01 <WebServiceBinding(
ConformsTo:=WsiProfiles.BasicProfile1_1)>
02 Public Class ProductService
03 Inherits System.Web.Services.WebService
04
05 <WebMethod()>
06 Public Function GetProduct(
07 ByVal name As String) As Product

08
09 End Function
10
11 <WebMethod()>
12 Public Function GetProduct(
13 ByVal id As Integer) As Product
14
15 End Function
16
17 End Class
You need to ensure that both GetProduct methods can be called from a Web client. Which two
actions should you perform? (Each correct answer presents part of the solution. Choose two.)

What should you do?

You are creating a Windows Communication Foundation (WCF) service that responds using
plainold XML (POX). You have the following requirements: You must enable the
/catalog.svc/items operation to respond using the POX, JSON, or ATOM formats. You also
must ensure that the same URL is used regardless of the result type. You must determine
the response format by using the Accepts HTTP header. What should you do?

You need to display the items in a table named Products by using a custom layout

You are implementing an ASP.NET Dynamic Data Web site. The Web site includes a data context that
enables automatic scaffolding for all tables in the data model. The Global.asax.vb file contains the
following code segment.
Public Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.Add(New DynamicDataRoute(“{table}/ListDetails.aspx”) _
With
{
.Action = PageAction.List,
.ViewName = “ListDetails”,
.Model = DefaultModel
})
routes.Add(New DynamicDataRoute(“{table}/ListDetails.aspx”) _
With
{
.Action = PageAction.Details,
.ViewName = “ListDetails”,
.Model = DefaultModel
})
End Sub
You need to display the items in a table named Products by using a custom layout. What should you
do?