PrepAway - Latest Free Exam Questions & Answers

Author: seenagape

You need to ensure that the Product data for each Category object is lazy-loaded

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows
Communication Foundation (WCF) Data Services service. You deploy the data service to the
following URL: http://contoso.com/Northwind.svc.
You add the following code segment. (Line numbers are included for reference only.)
01 Dim uri As var = New Uri(“http://contoso.com/Northwind.svc/”)
02 Dim ctx As var = New NorthwindEntities(uri)
03 Dim categories As var = From c In ctx.Categories _
04 Select c

05 For Each c ategory As var In categories
06 PrintCategory(category)
07
08 For Each product As var In category.Products
09
10 PrintProduct(product)
11 Next
12 Next
You need to ensure that the Product data for each Category object is lazy-loaded. What should you
do?

Which code segment should you use?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to a Microsoft SQL Server database. You use the following SQL statement to
retrieve an instance of a DataSet object named ds.
SELECT CustomerID, CompanyName, ContactName, Address, City
FROM dbo.Customers
You need to query the DataSet object to retrieve only the rows where the ContactName field is not
NULL. Which code segment should you use?

What should you recommend?

You are designing an n-tier Windows solution that includes a data entry application. The
solution uses Microsoft .NET Framework 4 and Microsoft SQL Server 2008. The data entry
application sends customer orders to a middle-tier server. The middle-tier server sends
orders to a set of services that perform operations on the orders. Business rules determine
which services to call and whether to run them in sequence or in parallel. The business
rules are complex and data dependent. The Windows solution must meet the following
requirements: • Optimize application performance by using dynamic load balancing. • Allow
for business rules to be changed at runtime. You need to recommend an approach that
meets the requirements. What should you recommend?

What are two possible ways to achieve this goal?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to a Microsoft SQL Server 2008 database. You create classes by using LINQ to
SQL based on the records shown in the exhibit. (Click the Exhibit button.)

You need to create a LINQ query to retrieve a list of objects that contains the OrderID and
CustomerID properties. You need to retrieve the total price amount of each Order record. What are
two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose
two.)

Which code segment should you insert at line 03?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application contains the following XML document.
<bib>
<book title=”TCP/IP Illustrated” year=”1994″>
<author> Author1 </author>
</book>
<book title=”Programming in Unix” year=”1992″>
<author> Author1 </author>
<author> Author2 </author>
<author> Author3 </author>
</book>
<book title=”Data on the Web” year=”2000″>
<author> Author4 </author>
<author> Author3 </author>
</book>
</bib>
You add the following code fragment. (Line numbers are included for reference only.)
01 Public Function GetBooks(xml As String) As IEnumerable(Of XElement)
02 Dim doc As XDocument = XDocument.Parse(xml)
03
04 End Function
You need to return a list of book XML elements that are authored by Author1. Which code segment
should you insert at line 03?

Which code segment should you insert at line 09?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to a Microsoft SQL Server 2008 database. The database includes a database
table named ProductCatalog as shown in the exhibit. (Click the Exhibit button.)

You add the following code segment to query the first row of the ProductCatalog table. (Line
numbers are included for reference only.)
01 Using cnx As var = New SqlConnection(connString)
02 Dim command As var = cnx.CreateCommand()
03 command.CommandType = CommandType.Text
04 command.CommandText = “SELECT TOP 1 * FROM dbo.ProductCatalog”
05 cnx.Open()
06 Dim reader As var = command.ExecuteReader()
07 If reader.Read() Then
08 Dim id As var = reader.GetInt32(0)
09
10 reader.Close()
11 End If
12 End Using
You need to read the values for the Weight, Price, and Status columns. Which code segment should
you insert at line 09?