PrepAway - Latest Free Exam Questions & Answers

Author: seenagape

Which code segment should you insert at line 16?

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft
ADO.NET. The application uses Microsoft SQL Server 2005.You write the following code
segment. (Line numbers are included for reference only.)
01 String myConnString = “User
02 ID=<username>;password=<strong password>;Initial
03 Catalog=pubs;Data Source=myServer”;
04 SqlConnection myConnection = new
05 SqlConnection(myConnString);
06 SqlCommand myCommand = new SqlCommand();
07 DbDataReader myReader;
08 myCommand.CommandType =
09 CommandType.Text;
10 myCommand.Connection = myConnection;
11 myCommand.CommandText = “Select * from Table1; Select * from Table2;”;
12 int RecordCount = 0;
13 try
14 {
15 myConnection.Open();
16
17 }
18 catch (Exception ex)
19 {
20 }
21 finally
22 {
23 myConnection.Close();
24 }
You need to compute the total number of records processed by the Select queries in the
RecordCount variable.Which code segment should you insert at line 16?

Which code segment should you insert at line 08?

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 [ServiceContract(Namespace=”http://uri.contoso.com”)] 02 public interface IMyService
03 {
04 [OperationContract]
05 string ProcessDetails(string s);

06 [OperationContract(Action=”UpdateStatus”)]
07 void UpdateStatus();
09 }

If the existing operation contract is unable to process a request made to the service, a generic operation contract must attempt to process the request. You need to create the generic operation contract. Which code segment should you insert at line 08?

What should you do?

You work as the Microsoft.NET developer at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers in the domain run Windows Server 2003. The configuration and customization of Web Service applications forms part of your responsibilities at Domain.com. Domain.com operates as a real estate and property management company.
A class named PropertyManagement holds a shared method named ObtainProperties. ObtainProperties is configured to accept a String parameter that identifies a client and return a DataSet instance that holds all the properties that are managed by that client. The client identifier is a Microsoft Windows Active Directory user name.
You received instruction to create an Extensible Markup Language (XML) Web Service that makes use of Windows Authentication to expose this functionality to the Internet. However, you need to ensure that your solution also enhances the Web server performance. To this end you need to save the property results in memory on the Web server.

What should you do? (Choose the correct code segment.)

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 fragment. (Line numbers are included for reference only.)

01 <asp:RequiredFieldValidator
02 ID=”rfValidator1″ runat=”server”
03 Display=”Dynamic” ControlToValidate=”TextBox1″
04
05 >
06
07 </asp:RequiredFieldValidator>
08
09 <asp:ValidationSummary DisplayMode=”List”
10 ID=”ValidationSummary1″ runat=”server” />

You need to ensure that the error message displayed in the validation control is also displayed in the validation summary list.

What should you do?

segment should you insert at line 11?

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 analyzes large amounts of transaction data that are stored in a different database.
You write the following code segment. (Line numbers are included for reference only.)
01 using (SqlConnection connection = new SqlConnection(sourceConnectionString))
02 using (SqlConnection connection2 = new SqlConnection(destinationConnectionString))
03 using (SqlCommand command = new SqlCommand())
04 {
05 connection.Open();
06 connection2.Open();
07 using (SqlDataReader reader = command.ExecuteReader())
08 {
09 using (SqlBulkCopy bulkCopy = new
SqlBulkCopy(connection2))
10 {
11
12 }
13 }
14 }
You need to copy the transaction data to the database of the application. Which code
segment should you insert at line 11?

What should you do?

You are creating a distributed application by using Microsoft .NET Framework 3.5. You use Windows Communication Foundation to create the application. You plan to perform the following tasks:

Authenticate the client applications by using Microsoft ASP.NET membership provider. Authorize the client applications by using Microsoft ASP.NET role provider. You write the following code segment.

[ServiceContract]
public interface IService
{
[OperationContract]
void Remove(int id);
}
public class Service : IService
{
public void Remove(int id)
{}
}

You need to ensure that only those client applications that provide credentials belonging to the AdminGroup role can access the Remove method. What should you do?

What should you do?

You work as the Microsoft.NET developer at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers in the domain run Windows Server 2003. The configuration and customization of Web Service applications forms part of your responsibilities at Domain.com.
You are currently busy developing an Extensible Markup Language (XML) Web service. This XML Web service is intended to allow the traffic department to perform driver license verifications in particular geographic areas. To this end you created the following Extensible Markup Language (XML) Web Service class definition as illustrated in the exhibit.

<WebService()> public class LicenseService : WebService
{
private LicenseVerifier _licenceVerifier;
<WebMethod()> public string GetRecentInvalidLicenseHistory()
{
ArrayList invalidLicenses = CType(MyBase.Application.Item(InvalidLicenses”), ArrayList);
return CType(invalidLicenses.ToArray(GetType(String)), String());
}
<WebMethod()> public bool VerifyLicense(string state, string licenseNumber)
bool isValid = Me._licenseVerifier.Verify(geoArea, licenseNumber)

if (! isValid)
{
ArrayList invalidLicenses = Ctype(MyBase.Application.Item(“InvalidLicenses”),ArrayList) invalidLicenses.Aff(LicenseNumber);
}
return isValid;
}
}

The VerifyLicence Web method will verify an individual’s driver license in a particular geographic area.
The ObtainRecentInvalidLicenseHistory will return a list of all the driver licenses that has been revoked regardless of geographic area. You are required to modify the two Web methods so as to prevent them from throwing exception of type NulReferenceException.

What should you do?

Which code segment should you insert at line 03?

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

The application has a Web form file named MovieReviews.aspx.

The MovieReviews.aspx file connects to a LinqDataSource DataSource named LinqDataSource1 that has a primary key named MovieID.

The application has a DetailsView control named DetailsView1.

The MovieReviews.aspx file contains the following code fragment. (Line numbers are included for reference only.)

01 <asp:DetailsView ID=”DetailsView1″ runat=”server”
02 DataSourceID=”LinqDataSource1″
03
04 />
05 <Fields>
06 <asp:BoundField DataField=”MovieID” HeaderText=”MovieID”
07 InsertVisible=”False”
08 ReadOnly=”True” SortExpression=”MovieID” />
09 <asp:BoundField DataField=”Title” HeaderText=”Title”
10 SortExpression=”Title” />
11 <asp:BoundField DataField=”Theater” HeaderText=”Theater”
12 SortExpression=”Theater” />
13 <asp:CommandField ShowDeleteButton=”false”
14 ShowEditButton=”True” ShowInsertButton=”True” />
15 </Fields>
16 </asp:DetailsView>

You need to ensure that the users can insert and update content in the DetailsView1 control.
You also need to prevent duplication of the link button controls for the Edit and New operations.

Which code segment should you insert at line 03?