Help answer these 70-310 questions

From: David (anonymous_at_discussions.microsoft.com)
Date: 02/22/04


Date: Sun, 22 Feb 2004 01:46:13 -0800

Please help answer these 70-310 questions. Thank you.

1. You create an XML Web service named PostalCode. Your
project source includes a code-behind file and a file
named PostalCode.asmx. During implementation, you use the
Debug class to record debugging log messages, to verify
parameter values, and to report
debugging failures. You want to deploy PostalCode to a
production computer. You do not want any of the debugging
code to execute on the production computer. What should
you do?

a. Set the project's active configuration to Release and
rebuild the DLL.
b. Modify the trace element of the Web.config file by
setting the enabled attribute to "false".
c. Modify the compilation element of the Web.config file
by setting the debug attribute to "false".
d. Add code to the constructor of the PostalCode class to
set the AutoFlush property of the Debug class to false.
e. Add code to the constructor of the PostalCode class to
call the Clear method of the Debug.Listeners property.

2. You are using Visual Studio .NET to develop an
application that uses a non-COM DLL named
UsefuiFunetices.dll. This DLL is written in unmanaged
code. One function in the DLL performs encryption. This
function takes two arguments. One argument is the string
to be encrypted. The other argument is the resulting
encrypted string. The function returns an integer that is
an error code. You must ensure that your application uses
this function correctly. Which code segment should you
use?

a. Public Shared Function encrypt(ByVal input As String,
ByVal out As StringBuilder) As Integer
End Function
Dim input As String = "content to encrypt"
Dim output As New StringBuilder(500)
Dim enCode As Integer = encrypt(input, output)
b. Public Shared Function encrypt(ByVal input As String,
ByVal out As String) As Integer
End Function
Dim input As String = "content to encrypt"
Dim output As New StringBuilder(500)
Dim errCode As Integer = encrypt(input, output.ToString())
c. Public Shared Function encrypt(ByVal input As String,
ByVal out As String) As Integer
End Function
Dim input As String "content to encrypt"
Dim output As String = ""
Dim errCode As Integer = encrypt(input, output)
d. Public Shared Function encrypt(ByVal input As String,
ByRef out As String) As Integer
End Function
Dim input As String = "content to encrypt"
Dim output As String("x")
Dim errCode As Integer = encrypt(input, output)
3. You are creating a serviced component named
EmployeeLocations. This component will return a current
list of employees in a given city. The list of employee
locations changes nightly. EmployeeLocations must load an
XML file named Emploc.xml nightly. EmployeeLocations
contains one method named EmployeeslnCity. EmployeeslnCity
takes a string city code and returns an array of Employee
objects. EmployeeLocations will use the XML data to return
lists of employees for a city throughout each day.
EmployeeLocations must respond to EmployeeslnCity method
calls as quickly as possible. What should you do?

a. Each night, load Emploc.xml into a MemoryStream object.
For each request, use an XmlTextReader to locate the
requested city and then the employees within that city.
b. Each night, load Emploc.xml into an XPathDocument
object.
For each request, use the XPathNavigator.
Select method to create an XPathNodelterator object.
Use the XPathNodelterator object to return the list of
employees.
c. Each night, load Emploxml into an XmlDocument object.
For each request, use the XmlDocument.GetElementsByTagName
method to create an XmlNodeList object, which will
contain the appropriate employee list.
d. Each night, load Emploc.xml into an XmlDataDocument
object.
For each request, use the
XmlDataDocument.GetElementsByTagName method to create an
XmlNodeList object, which will
contain the appropriate employee list.

4. You create a strongly named serviced component. The
component uses a third-party .NET assembly named
Fabrikam.Encryptor.dll to perform encryption and
decryption. Fabrikam.Encryptor.dll is registered in the
global assembly cache. You deploy the serviced component
and Fabrikam.Encryptor.dll to a production computer. A new
version of Fabrikam.Enciyptor.dll becomes available. You
remove the original version and install the new version on
the production computer. The serviced component throws a
System.TypeLoadException when it attempts to use
Fabrikam.Encryptor.dll. You need to correct this problem.
What should you do?

a. Unregister and then re-register the serviced component
in the global assembly cache.
b. Use the Strong Name tool (Sn.exe) to create a new key
file for the serviced component.
c. Create a configuration file named Dllhost.exe.config to
redirect the serviced component to the new version of
Fabrikam.Encryptor.dll.
d. Create a Publisher Policy assembly for
Fabrikam.Encryptor.dll and register the assembly in the
global assembly cache.

5. You write a serviced component named OrderProcessing
that processes customer orders. You cache the product list
and customer list within OrderProcessing to improve
response time.
OrderProcessing has a method named ValidateCache that
validates the contents of the cache. ValidateCache
includes the following method signature: Public Sub
ValidateCache(ByVal name As String) You want to call
ValidateCache during development and testing. You do not
want to call ValidateCache when you release your component
for deployment. You want to accomplish this task by
writing the minimum amount of code. Which code segment
should you use?

a. Public Sub ValidateCache(ByVal name As String)
Debug.Assert(False)
'Method body goes here.
End Sub
b. #If DEBUG Then
Public Sub ValidateCache(ByVal name As String)
' Method body goes here.
End Sub
#End If
c. Public Sub ValidateCache(ByVal name As String)
'Method body goes here.
End Sub
d. <Conditional("DEBUG")> _
Public Sub ValidateCache(ByVal name As String)
' Method body goes here.
End Sub

6. You create an XML Web service named LatLong that
converts street addresses to latitude and longitude
coordinates. Your company charges for this service and
allows only existing customers to use the service. If a
customer ID is not passed as part of a SOAP header, you
want the service to refuse the request. You want these
service refusal messages to be logged to an event log
named LatLongLog. You anticipate that there will be a lot
of these log entries
overtime. A String object named refusalMessage contains
the message to log. Which code segment should you use?

a. Dim log As New EventLog("LatLongLog")
log.WriteEntry(refusalMessage, EventLogEntryType.Error)
b. Dim log As New EventLog()
log.Source = "LatLongLog"
log.WriteEntry(refusalMessage, EventLogEntryType.Error)
c. If Not EventLog.SourceExists("LatLongSource") Then
EventLog.CreateEventSource("LatLongLog")
End If
EventLog.WriteEntry("LatLongSource", refusalMessage,
EventLogEntryType.Error)
d. If Not EventLog.SourceExists("LatLongSource") Then
EventLog.CreateEventSource("LatLongSource", "LatLongLog")
End If
Dim log As New EventLog("LatLongLog")
log.WriteEntry(refusalMessage, EventLogEntryType.Error)

7. You use a serviced component named FabrikamComponent in
three applications on your computer. Over the past six
months,
you have received a number of updates to
FabrikamComponent, all of which you have registered in the
global assembly cache. As a result, you discover that one
application is using version 1.0.2.0, another application
is using version 1.0.3.0, and a third application is using
version 1.0.5.0. You now receive version 2.0.0.0 of
FabrikamComponent, which is a critical update. You
register version 2.0.0.0 in the global assembly cache. You
verify that version 2.0.0.0 is backward compatible. You
need to ensure that all three of your applications use
version 2.0.0.0. You want to accomplish this task without
having to recompile all three applications. What should
you do?

a. Create a Publisher Policy for FabrikamComponent that
redirects all prior versions to version 2.0.0.0.
b. In the Assembly file of each application,set the
assembly version of FabrikamComponent to version 2.0.0.0.
c. In the Machine.config file, configure a binding policy
that sets the CodeBase property of FabrikamComponent to
version
2.0.0.0.
d. In the Machine.config file, configure a binding policy
for FabrikamComponent that redirects all prior versions to
version 2.0.0.0

9. You create a .NET remoting object named DocumentStore.
DocumentStore is a server-activated singleton object. It
uses a TcpChannel to listen on port 9000. The object URI
for DocumentStore. You need to write a client application
to use DocumentStore from a computer named ServerA. Which
code segment should you use?

a. RemotingConfiguration.Configure("tcp//ServerA:
9000/DocumentStore")
Dim doc As New DocumentStore()
b. Dim t As Type t = GetType(DocumentStore)
RemotingConfiguration.RegisterWellKnownClientType
(t, "TcpChannel, 9000 ServerA")
Dim doc As New DocumenrtStore()
c. Dim t As Type
Dim Temp As Object
Dim doc As DocumentStore
t = GetType(DocumentStore)
temp = Activator.CreateInstance
(t, "tcp://serverA:9000/DocumentStore")
doc = CType(temp, DocumentStore)
d. Dim t As Type
Dim temp As Object
Dim doc As DocumentStore
ChannelServices.RegisterChannel(New TcpChannel(9000))
t = GetType(DocumentStore)
temp = Activator.CreateInstance(t, "ServerA")
doc = CType(temp, DocumentStore)

10. You are creating a serviced component named
UserManager. UserManager adds user accounts to multiple
transactional data sources. The UserManager class includes
the following code segment.
<Transaction(TransactionOption.Required), securityRole
("Admin")> _
Public Class UserManager
Inherits ServicedComponent
Public Sub AddUser(ByVal name As String, ByVal password As
String)
'Code to add the user to data source goes here.
End Sub
End Class
You must ensure that the AddUser method reliably saves the
new user to either all data sources or no data sources.
What should you do?

a. To AddUser, add the following attribute:
<AutoComplete()>
b. To UserManager, add the following attribute:
<JustIntimeActivation(false)>
c. To the end of AddUser, add the following line of code:
ContextUtil.EnableCommit()
d. To the end of AddUser, add the following line of code:
ContextUtil.MyTransactionVote = True

11. You are creating a .NET Remoting object named
PropertyCache. PropertyCache will hold a HashTable object
or name/value pairs. A variety of remote client
application will communicate with PropertyCache to set and
get property values. You need to ensure that properties
set by one client application are also accessible to other
client applications.
Which two actions should you take (Each correct answer
presents part of the solution)? (Choose two)

a. Configure Property to be a client-activated object
b. Configure Property to be a server-activated Singleton
object
c. Configure Property to be a server-activated SinglCall
object
d. Derive the PropertyCache class from MarshalByRefObject
and override InitilizeLifetimeService() to return null.
e. Mark the PropertyCach class with the serializable
attribute Implement the ISponsor interface in the
PropertyCache class
f. Implement the ISerializable and ILease interfaces in
the PropertyCache class. Implement ILease.CurentLeaseTime
to
return Int32.MaxValue.

12. You are creating a serviced component named
TravelItinerary included the following code segment:
<Transaction(TransactionOption.Required)> _
Public Class TravelItinerary
Inherits ServiceComponent
<AutoComplete()> _
Public Function SaveIntenerary(ByVal tavelData As DataSet)
As DataSet
Dim airline As New AirlineAService()
Dim hotel As New HotelService.HotelService()
airline.ReserveFlight(travelData)
'Code to record reservation in database goes here.
hotel.ReserveHotel(travelData)
'Code to record reservation in database goes here.
Return TravelData
End Function
End Class
The TransactionOption property of both ReserveFlight and
ReserveHotel is set to TransactionOption.Required.
You create an application to test TravelItinarary. When
the test application is run, an exception is thrown in
HotelsService.
How are transactions in TravelItinerary and in each Web
service affected by this exception?

a. All transactions are rolled back.
b. Transactions in only HotelService are rolled back.
Transactions in only TravelItinerary and AirelineService
remain committed.
c. Transactions in only HotelsService and TravelItinerary
are rolled back.
Transaction in only AirlineService remain committed.
d. Transactions in only Aireline Service and
TravelItinerary are rolled back.
Transaction in only HotelService remain committed.

13. You have a SqlDataReader object named orderDataReader.
This object contains a column named OrderQuantity as an
integer value. This object also contains one row for each
order received during the previous week. You need to write
code that will process each row in ordersDataReader and
passOrderQuantity to a function named RSFunction. Which
code segment should you use?

a. While ordersDataReader.Read
CallRSFunction(ordersDataReader("OrderQuantity"))
End While.
b. While ordersDataReader.Read.Next
CallRSFunction(ordersDataReader("OrderQuantity"))
End While
c. Dim orderCount As Integer
While orderCount < ordersDataReader.FieldCount
Call RSFunction(ordersDataReader("OrderQuantity"))
orderCount + = 1
ordersDataReader.Read
End While
d. Dim orderCount As Integer
While orderCount < ordersDataReader.FieldCount
Call RSFunction(ordersDataReader("OrderQuantity"))
orderCount += "1"
ordersDataReader.NextResult
End While

14. You are using Visual Studio .NET to develop an
application. You have a comon business logic component
that was created in COM that you want to use until you can
replace it with Visual Studio .NET code. What should you
do?

a. Register the COM component by using Regsvr32.exe.
b. Run The Type Library Exporter (Tlbexp.exe) and pass the
COM component as the filename parameter
c. Use Visual Studio .NET to add a reference to the COM
component.
d. Run the assembly Registration tool (Regasm.exe) and
pass the COM component as thefilename parameter.

15. You create a class named BankAccount that represents a
customer's bank account.
BankAccount includes the following code segment:
Public Class BankAccount
Public ReadOnly Property Accountld() As String
Get Return acctId
End Get
End Property
Public ReadOnly Property Balance() As Decimal
Get Return bal
End Get
End Property
Sub New(ByVal accountId As String, ByVal balance As
Decimal)
acctId = accountId
bal = balance
End Sub
Private acctId As String
Private bal As Decimal
End Class
You are now creating a .NET Remoting object named Teller.
The Teller class returns lists of BankAccount objects. You
anticipate that large numbers of client applications will
use the Teller object to retrieve BankAccount objects. You
want to ensure that network traffic is minimized. What
should you do?

a. Add the Serializable attribute to the BankAccount class.
b. Add the NonSerialized attribute to the BankAccount
class.
c. Derive the BankAccount class from MarshalByRefObject.
d. Implement the ISerializable interface in the
BankAccount class.

16. You create an XML Web service named TimeService. Each
time TimeService is started, it checks for the existence
of an event log named TimeServiceLog. If TimeServiceLog
does not exist, timeService create it. You discover that
when TimerService create TimeServiceLog, it throws a
System.Security.Security.Exception. The exception include
following message: "Requested registry access is not
allowed". You need to resolve this problem What should you
do?

a. Configure Inetinfo.exe to run as the local
administrator user account
b. Create an installer for TimeService, and create the new
event log in the installer code.
c. Modify the Web.config file by adding an identity
element to impersonate the LOGON user specified by Internet
Information Service (IIS).
d. Modify the permission of the
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventl
og registry key to give
full control to the IUSR_computername user account

17. You create an XML Web service named PhoneNumberService
that returns the telephone numbers of people in a
specified geographical region. If an error occurs when the
service is processing requests, a custom application
exception named PhoneNumberException that may be thrown.
You create an ASP.NET application named LSPhoneBook that
contains a Web reference to PhoneNumberService. You need
to wrap any calls made to PhoneNumberService in a
try/catch block to catch any PhneNumberException that may
be thrown Which two code segments are possible ways to
achieve this goal (Each correct answer presents a complete
solution.)? (Choose two)

a. Try
'Code to call PhoneNumberService method goes here.
Catch ex As SoapExeption
'Handle the Exception
End Try
b. Try
'Code to call PhoneNumberService method goes here.
Catch ex As SoapHeaderExeption
'Handle the Exception
End Try
c. Try
'Code to call PhoneNumberService method goes here.
Catch ex As Exeption
'Handle the Exception
End Try
d. Try
'Code to call PhoneNumberService method goes here.
Catch ex As ApplicationExeption
'Handle the Exception
End Try



Relevant Pages

  • Re: Help answer these 70-310 questions
    ... One argument is the string ... > Dim output As New StringBuilder ... > EmployeeLocations. ... You create a strongly named serviced component. ...
    (microsoft.public.cert.exam.mcad)
  • Help answer these 70-310 questions
    ... One argument is the string ... Dim output As New StringBuilder ... EmployeeLocations. ... You create a strongly named serviced component. ...
    (microsoft.public.cert.exam.mcsd)
  • Search pattern
    ... Dim strfile As String ... Dim bAddressFound As Boolean ... Dim strCurrentChar As String ...
    (comp.databases.ms-access)
  • Auto Write Name and Merge across
    ... Dim Sheetname01 As String ... Dim WeekName01 As String ...
    (microsoft.public.excel.misc)
  • Re: multiplatform (pocketPC & desktopPC) (Daniel !!)
    ... Friend Versione As String ... Public Sub GetMyConnectionPalmare() ... Dim errorMessages As String ... Private Function GetDS_Desktop(ByVal SQL As String) As DataSet ...
    (microsoft.public.dotnet.framework.compactframework)