Web Developer Framework 4.0 Sample Questions – 21

Question: You are creating a Windows Communication Foundation (WCF) service that is implemented as follows. (Line numbers are included for reference only.)
01<ServiceContract()>
02<ServiceBehavior(IncludeExceptionDetailInFaults:=True)>
03Public Class OrderService
04
05<OperationContract()>
06Public Sub SubmitOrder(ByVal anOrder As Order)
07
08Try
09
10Catch ex As DivideByZeroException
11
12 End Try
13 End Sub
14
15 End Class
You need to ensure that the stack trace details of the exception are not included in the error information sent to the client. What should you do

  1. Replace line 11 with the following line.
    Throw
  2. Replace line 11 with the following line.
    Throw New FaultException(Of Order)(anOrder, ex.ToString()) After line 05, add the following line.
    <FaultContract(GetType(FaultException(Of Order)))></li>
  3. Replace line 11 with the following line.
    Throw ex After line 05, add the following line.
    <FaultContract(GetType(FaultException(Of Order)))></li>
  4. Replace line 11 with the following line.
    Throw New FaultException(Of Order)( anOrder, “Divide by zero exception”)

Correct Answer: 4


Question: You are implementing an ASP.NET application that uses data-bound GridView controls in multiple pages. You add JavaScript code to periodically update specific types of data items in these GridView controls. You need to ensure that the JavaScript code can locate the HTML elements created for each row in these GridView controls, without needing to be changed if the controls are moved from one page to another.
What should you do

  1. Replace the GridView control with a ListView control.
  2. Set the ClientIDMode attribute to Predictable in the web.config file.
  3. Set the ClientIDRowSuffix attribute of each unique GridView control to a different value.
  4. Set the @ OutputCache directive’s VaryByControl attribute to the ID of the GridView control.

Correct Answer: 2


Question: You are implementing an ASP.NET application that includes a page named TestPage.aspx.
TestPage.aspx uses a master page named TestMaster.master. You add the following code to the
TestPage.aspx code-behind file to read a TestMaster.master public property named CityName.
protected void Page_Load(object sender, EventArgs e)
{
string s = Master.CityName;
}

You need to ensure that TestPage.aspx can access the CityName property.
What should you do

  1. Add the following directive to TestPage.aspx.
    <%@ MasterType VirtualPath=”~/TestMaster.master” %>
  2. Add the following directive to TestPage.aspx.
    <%@ PreviousPageType VirtualPath=”~/TestMaster.master” %>
  3. Set the Strict attribute in the @ Master directive of the TestMaster.master page to true.
  4. Set the Explicit attribute in the @ Master directive of the TestMaster.master page to true.

Correct Answer: 1


Question: You are creating a Windows Communication Foundation (WCF) service. You do not want to expose the internal implementation at the service layer. You need to expose the following class as a service named Arithmetic with an operation named Sum.
public class Calculator
{
public int Add(int x, int y)
{
}
}

Which code segment should you use

  1. [ServiceContract(Namespace="Arithmetic")]
    public class Calculator
    {
    [OperationContract(Action="Sum")]
    public int Add(int x, int y)
    {

    }
    }
  2. [ServiceContract(ConfigurationName="Arithmetic")]
    public class Calculator
    {
    [OperationContract(Action="Sum")]
    public int Add(int x, int y)
    {
    }
    }
  3. [ServiceContract(Name="Arithmetic")]
    public class Calculator
    {
    [OperationContract(Name="Sum")]
    public int Add(int x, int y)
    {
    }
    }
  4. [ServiceContract(Name="Arithmetic")]
    public class Calculator
    {
    [OperationContract(ReplyAction="Sum")]
    public int Add(int x, int y)
    {
    }
    }

Correct Answer: 3


Question: You are creating a Windows Communication Foundation (WCF) service. You do not want to expose the internal implementation at the service layer. You need to expose the following class as a service named Arithmetic with an operation named Sum.
Public Class Calculator
Public Function Add(ByVal x As Integer,
ByVal y As Integer) As Integer
End Function
End Class

Which code segment should you use

  1. <ServiceContract(Namespace:="Arithmetic")>
    Public Class Calculator
    <OperationContract(Action:="Sum")>
    Public Function Add(ByVal x As Integer,
    ByVal y As Integer) As Integer
    End Function
    End Class
  2. <ServiceContract(ConfigurationName:="Arithmetic")>
    Public Class Calculator
    <OperationContract(Action:="Sum")>
    Public Function Add(ByVal x As Integer,
    ByVal y As Integer) As Integer
    End Function
    End Class
  3. <ServiceContract(Name:="Arithmetic")>
    Public Class Calculator
    <OperationContract(Name:="Sum")>
    Public Function Add(ByVal x As Integer,
    ByVal y As Integer) As Integer
    End Function
    End Class
  4. <ServiceContract(Name:="Arithmetic")>
    Public Class Calculator
    <OperationContract(ReplyAction:="Sum")>
    Public Function Add(ByVal x As Integer,
    ByVal y As Integer) As Integer
    End Function
    End Class

Correct Answer: 3

Tagged . Bookmark the permalink.

One Response to Web Developer Framework 4.0 Sample Questions – 21

  1. Shemaa says:

    Thanks you There are some interesting poitns in time in this article but I don’t know if I see all of them center to heart. There is some validity but I will take hold opinion until I look into it further. Good article , thanks and we want more! Added to FeedBur

Leave a Reply