PrepAway - Latest Free Exam Questions & Answers

Author: seenagape

Which binding expression should you use?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You create a WPF window in the application. You add the following code segment to the application.

Public Class ViewModel
Public Property Data() As CollectionView Get End Get Set End Set End Property End Class Public Class BusinessObject Public Property Name() As String Get End Get Set End Set End Property End Class The DataContext property of the window is set to an instance of the ViewModel class. The Data property of the ViewModel instance is initialized with a collection of BusinessObject objects. You add a TextBox control to the window. You need to bind the Text property of the TextBox control to the Name property of the current item of the CollectionView of the DataContext object. You also need to ensure that when a binding error occurs, the Text property of the TextBox control is set to N/A . Which binding expression should you use?

Which query parts should you use in sequence to complete the expression?

The user interface requires that a paged view be displayed of all the products sorted in alphabetical order.
The user interface supplies a current starting index and a page size in variables named startIndex and pageSize of type int.
You need to construct a LINQ expression that will return the appropriate Parts from the database from an existing
ContosoEntities context object named context. You begin by writing the following expression:
context.Parts

Which query parts should you use in sequence to complete the expression?
(To answer, move the appropriate actions from the list of actions to the answer area and arrange them in the correct order.)

What should you do to to ensure that database users can view the original row values?

You add a table to the database to track changes to part names. The table stores the following row values:
* the username of the user who made the change
* a part ID
* the new part name
* a DateTime value

You need to ensure detection of unauthorized changes to the row values.
You also need to ensure that database users can view the original row values.

Which code segment should you use?

You are implementing an ASP.NET application that uses LINQ to Entities to access and update the database.
The application includes the following method to update a detached entity of type Person.

private NorthwindContext _entities;

public void UpdatePerson(Person personToEdit)
{
}

You need to implement the UpdatePerson method to update the database row that corresponds to the personToEdit object.
Which code segment should you use?

What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Communication Foundation (WCF) Data Services service. The service connects to a Microsoft SQL Server 2008 database. The service is hosted by an Internet Information Services (IIS) 6.0 Web server.

The application works correctly in the development environment. However, when you connect to the service on the production server, attempting to update or delete an entity results in an error. You need to ensure that you can update and delete entities on the production server. What should you do?

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?

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 string JsonValue;
List<Person> people = GetPeopleList();
JavaScriptSerializer json = new JavaScriptSerializer();

You need to use the JavaScriptSerializer class to serialize only the Name property of each item in the people list.
Which code segment should you use?

Which code segment should you insert at line 02?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You use the ADO.NET Entity Framework to model entities. You write the following code segment. (Line numbers are included for reference only.)

01AdventureWorksEntities context = New AdventureWorksEntities (http://localhost:1234/AdventureWorks.svc );
02
03var q = from c in context.Customers
04where c.City == “London”
05orderby c.CompanyName
06select c;

You need to ensure that the application meets the following requirements: “Compares the current values of unmodified properties with values returned from the data source. “Marks the property as modified when the properties are not the same. Which code segment should you insert at line 02?

Which code segment should you insert at line 06?

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 table named dbo.Documents that contains a column with large binary data. You are creating the Data Access Layer (DAL). You add the following code segment to query the dbo.Documents table. (Line numbers are included for reference only.)

01 Public Sub LoadDocuments(cnx As DbConnection)
02 Dim cmd As var = cnx.CreateCommand()
03 cmd.CommandText = “SELECT * FROM dbo.Documents”
04 …
05 cnx.Open()
06
07 ReadDocument(reader)
08 End Sub

You need to ensure that data can be read as a stream.
Which code segment should you insert at line 06?