Web Developer Framework 4.0 Sample Questions – 25

Question: You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. The application has two DataTable objects that reference the Customers and Orders tables in the database. The application contains the following code segment. (Line numbers are included for reference only.)
01 DataSet customerOrders = new DataSet();
02 customerOrders.EnforceConstraints = true;
03 ForeignKeyConstraint ordersFK = new ForeignKeyConstraint(“ordersFK”,
04 customerOrders.Tables[“Customers”].Columns[“CustomerID”],
05 customerOrders.Tables[“Orders”].Columns[“CustomerID”]);
06
07 customerOrders.Tables[“Orders”].Constraints.Add(ordersFK);
You need to ensure that an exception is thrown when you attempt to delete Customer records that have related Order records.
Which code segment should you insert at line 06

  1. ordersFK.DeleteRule = Rule.SetDefault;
  2. ordersFK.DeleteRule = Rule.None;
  3. ordersFK.DeleteRule = Rule.SetNull;
  4. ordersFK.DeleteRule = Rule.Cascade;

Correct Answer: 2


Question: You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. The application has two DataTable objects that reference the Customers and Orders tables in the database. The application contains the following code segment. (Line numbers are included for reference only.)
01 Dim customerOrders As New DataSet()
02 customerOrders.EnforceConstraints = True
03 Dim ordersFK As New ForeignKeyConstraint(“ordersFK”,
04 customerOrders.Tables(“Customers”).Columns(“CustomerID”),
05 customerOrders.Tables(“Orders”).Columns(“CustomerID”))
06
07 customerOrders.Tables(“Orders”).Constraints.Add(ordersFK)
You need to ensure that an exception is thrown when you attempt to delete Customer records that have related Order records.
Which code segment should you insert at line 06

  1. ordersFK.DeleteRule = Rule.SetDefault
  2. ordersFK.DeleteRule = Rule.None
  3. ordersFK.DeleteRule = Rule.SetNull
  4. ordersFK.DeleteRule = Rule.Cascade

Correct Answer: 2


Question: You are creating a Windows Communication Foundation (WCF) service to process orders. The data contract for the order is defined as follows.
[DataContract]
public class Order
{
[DataMember]
public string CardHolderName { get; set; }
[DataMember]
public string CreditCardNumber { get; set; }
}

You have the following requirements:
Enable the transmission of the contents of Order from the clients to the service. Ensure that the contents of Credit Card Number are not sent across the network in clear text. Ensure that the contents of Credit Card Number are accessible by the service to process the order. You need to implement the service to meet these requirements. What should you do

  1. Add a Data Protection Permission attribute to the Credit Card Number property and set the Protect Data property to true.
  2. Convert the Data Contract to a Message Contract and set the Protection Level property to Encrypt And Sign.
  3. Change the data type of Credit Card Number from string to Secure String.
  4. Implement the Credit Card Number property getter and setter. In the setter, run the value of the Credit Card Number through the MD5CryptoServiceProvider class Transform Block method.

Correct Answer: 2


Question: A Windows Communication Foundation (WCF) client uses the following service contract. (Line numbers are included for reference only.)
01 [ServiceContract]
02 public interface IService
03 {
04 [OperationContract]
05 string Operation1();
06 [OperationContract]
07 string Operation2();
08 }
You need to ensure that all calls to Operation1 and Operation2 from the client are encrypted and signed. What should you do

  1. Set the ProtectionLevel property in line 01 to EncryptAndSign.
  2. Set the ProtectionLevel property in line 04 and line 06 to Sign.
  3. Add a SecurityCriticalAttribute for each operation.
  4. Add a SecuritySafeCriticalAttribute for each operation.

Correct Answer: 1


Question: You deploy an ASP.NET application to an IIS server. You need to log health-monitoring events with severity level of error to the Windows application event log.What should you do

  1. Run the aspnet_regiis.exe command.
  2. Set the Treat warnings as errors option to All in the project properties and recompile.
  3. Add the following rule to the healthMonitoring section of the web.config file.
    <rules>
    <add name="Failures"
    eventName="Failure Audits"
    provider="EventLogProvider" />
    </rules>
  4. Add the following rule to the healthMonitoring section of the web.config file.
    <rules>
    <add name="Errors"
    eventName="All Errors"
    provider="EventLogProvider" />
    </rules>

Correct Answer: 4

Tagged . Bookmark the permalink.

One Response to Web Developer Framework 4.0 Sample Questions – 25

  1. Lisa Osipov says:

    Very good. Thank you very much

Leave a Reply