Microsoft 70-521 practice
QUESTION 1
You are creating a Windows Communication Foundation (WCF) service that is implemented as follows. (Line numbers are included for reference only.)
01
02
03 Public Class OrderService
04
05
06 Public Sub SubmitOrder(ByVal anOrder As Order)
07
08 Try
09 ...
10 Catch 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?
A. Replace line 11 with the following line. Throw
B. Replace line 11 with the following line. Throw New FaultException(Of Order)(anOrder, ex.ToString())
C. After line 05, add the following line. Replace line 11 with the following line. Throw ex
D. After line 05, add the following line.
Replace line 11 with the following line. Throw New FaultException(Of Order)( anOrder, "Divide by zero exception")
Answer: D
A. Public Class Calculator Public Function Add(ByVal x As Integer, ByVal y As Integer) As Integer ... End Function End Class Answer: C
QUESTION 2
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?
B. Public Class Calculator Public Function Add(ByVal x As Integer, ByVal y As Integer) As Integer ... End Function End Class
C. Public Class Calculator Public Function Add(ByVal x As Integer, ByVal y As Integer) As Integer ... End Function End Class
D. Public Class Calculator Public Function Add(ByVal x As Integer, ByVal y As Integer) As Integer ... End Function End Class