|
|
- Your
Microsoft SQL Server database contains a table named Orders. Orders is used to
store new purchase orders as they are entered into an order-entry application.
To keep up with customer demand, the order fulfillment department wants to
know at 15 mininute intervals when new orders are entered.
You need to
develop an application that reads Orders every 15 minutes and sends all new
orders to the order fulfillment department. The application will run on a
computer that is used by several users who continuously log on to and log off
from the network to perform miscellaneous tasks.
Which type of .NET
application should you use?
[A] Windows Form [B] Windows
service [C] XML Web service [D] .NET Remoting object
Correct
Answer 1 - B
- You
develop an application named myApp. This application needs to run on the same
computer as a Windows service named myService.
You want to ensure that
myService starts from myApp if myService is not already running. Which
code segment should you use?
[A] Dim myServiceController As New
ServiceController("myService") If myServiceController.Status =
ServiceControllerStatus.Stopped Then myServiceController.Start( ) End
If
[B] Dim myServiceController As New
ServiceController("myService") myServiceController.Start( )
[C] Dim
myServiceController As New ServiceController() Dim myArgs(1) As String
myArgs(0) = "myService" If myServiceController.Status =
ServiceControllerStatus.Stopped Then
myServiceController.Start(myArgs) End If
[D] Dim
myServiceController As New ServiceController() Dim myArgs(1) as String,
myArgs(0) = "myService" myServiceController.Start(myArgs)
Correct
Answer 2 - A
- You are developing a Windows
application that requires the use of a calculation function named
CalculateValue. Thisfunction includes the following
signature:
CalculateValue(x As Integer) As Integer
CalculateValue is
located in an unmanaged DLL named UsefulFunctions.dll, and is not part of a
COM interface. You need to be able to use CalculateValue in your
application.
Which action or actions should you take? (Choose all that
apply.)
[A] Use Regsvr32.exe to register
UsefulFunctions.dll. [B] Use Visual Studio .NET to add a reference to
UsefulFunctions.dll [C] To your application, add the following code
segment: Imports UsefulFunctions [D] To your application, add the following
code segment: Declare Function CalculateValue_Lib "UsefulFunctions.dll" (x
As Integer) As Integer
Correct Answer 3 - B-D
- You are using Visual Studio .NET to
develop a new application to replace an older COM-based application. The new
application will use some of the old COM components until they can be replaced
by Visual Studio .NET code.
Your application uses a COM DLL named
OurCOM.dll. The Visual Studio .NET assembly for OurCOM.dll must be named
OurDotNetCOM. You must use the name "ProjectX" for the namespace of the COM
components. You must ensure that your application uses these naming
guidelines.
What should you do?
[A] Reference OurCOM. dll
from Visual Studio .NET. Change the assembly name in Solution Explorer. Change
the namespace name by editing the assembly.
[B] Reference OurCOM.dll
from Visual Studio .NET. Change the assembly name in Solution Explorer. Change
the namespace name by using the Namespace property of a CodeNamespacelmport
object.
[C] Run the Type Library importer (Tlbimp.exe) with the
/namespace and /out options to create the assembly.
[D] Run the Type
Library Importer (Tlbimp.exe) with the /out option to create the assembly.
Change the namespace name by using the Namespace property of a
CodeNamespacelmport object.
Correct Answer 4 - C
- You
are using Visual Studio .NET to develop an application that uses a non-COM DLL
named UsefulFunctions.dll. This DLL is written in unmanaged code.
The
DLL contains a function that parses a string into an array of string words and
an array of numbers. A call to the function includes the following pseudo
code:
Input = "A string with 6 words and 2 numbers" words =
Nothing numbers = Nothing Parse(input, words, numbers)
After
execution, words contains all string words found in input and numbers contains
all integers found in input. You need to enable your application to call this
function.
Which code segment should you use?
[A] Declare
Function Parse Lib "UsefulFunctions.dll" _ (ByVal input As String, ByVal
words() As String, _ ByVal numbers() As Integer) As Integer
[B]
Declare Function Parse Lib "UsefulFunctions.dll" _ (ByVal input As String,
ByRef words() As String, _ ByRef numbers() As Integer) As
Integer
[C] Declare Function Parse Lib "UsefulFunctions.dll" _
(ByRef input As String, ByVal words() As String, _ ByVal numbers() As
Integer) As Integer
[D] Declare Function Parse Lib
"UsefulFunctions.dll" _ (ByRef input As String, ByRefwords() As String,
_ ByRef numbers() As Integer) As Integer
Correct Answer 5 - B
- You
are developing an application by using Visual C# .NET and Visual Basic .NET.
The application will use functions from a DLL written in unmanaged
code.
One function requires the calling application to allocate unmanaged
memory, fill it with data, and pass the address of the memory to the function.
On returning from the function, the calling application must deallocate the
unmanaged memory.
You need to decide how your application will handle
unmanaged memory.
What should you do? [A] Use a byte
array.
[B] Use the methods of the Marshal class.
[C] Use the
methods of the MemoryStream class.
[D] Derive a new class from the
Stream class, and override the allocation methods.
Correct Answer 6
- B
- You
create a serviced component named StockQuote that implements the lStockQuote
interface. The StockQuote class includes the following code
segment:
Public Class StockQuote Inherits ServicedComponent
Implements IStockQuote Public Function GetQuote(stock as Ticker) as Price
Implements IStockQuote.GetQuote() 'Implementation code goes
here. End Function End Class
You want to secure StockQuote so
that it can only be accessed by users in the Customers and Managers
roles.
Which two actions should you take?
(Each correct answer
presents part of the solution. Choose two.)
[A] To the StockQuote
class, add the following attribute:
[B] To the StockQuote class, add
the following attribute:
[C] Implement the ISecurityCallContext COM
interface at the StockQuote class. Implement the IsCaller method for the
Customers and Managers roles.
[D] To the StockQuote class, add the
following attribute:
[E] To the beginning of the GetQuote method, add
the following code segment: If Not ContextUtil.IsCaller Then Throw New
SecurityException("Access is denied.") End If
Correct Answer 7 -
A-D
- You
create a serviced component earned BankTransfer. BankTransfer is in a COM+
application named Woodgrove Bank.
BankTransfer is secured by using the
SecurityRole attribute for the Tellers and Managers roles. You want members of
the WoodgroveBankTellers group to be assigned to the Tellers role.
What should you do?
[A] Add another SecurityRole attribute
to the BankTransfer class for the WoodgroveBankTellers group.
[B]
Modify the Tellers SecurityRole attribute on the BankTransfer class to include
the WoodgroveBankTellers group.
[C] Use the Component Services tool to
add a new role named WoodgroveBankTellers.
[D] Use the Component
Services tool to add the WoodgroveBankTellers group to the existing Tellers
role.
Correct Answer 8 - D
- 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:
Public Class UserManager Inherits
ServicedComponent Public Sub AddUser(ByVal name As String, By Val password
As String) 'Code to add the user to data sources 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:
[B] To
UserManager, add the following attribute:
[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
Correct Answer 9 - C
- You create a serviced component named
HealthInfo. The component exposes patienthealth records. You declaratively
secure HealthInfo by using role-based security.
You must ensure that
the security checks are enforced. You want to prevent HealthInfo from
executing if administrators turn off security for the COM+
application.
What should you do?
[A] To the project source code,
add the following attribute:
AccessChecksLevelOption.ApplicationComponent)>
[B] To all
methods, add the following attribute:
[C] To the beginning of all
methods, add the following code segment: If Not
ContextUtil.IsSecurityEnabled Then ContextUtil.DisableCommit() End
If
[D] To the beginning of all methods, add the following code segment:
If Not ContextUtil.IsSecurityEnabled Then Throw New
SecurityException("Security must be enable") End If
Correct Answer
10 - D
- You
create a serviced component named Workitem that implements an interface named
IWorkItem You want to ensure that calls to the serviced component through
IWorkltem are queued.
What should you do? [A] To WorkItem, add the
following attribute:
[B] To WorkItem, add the following attribute:
Isolation:=TransactionIsolationLevel.Serializable)>
[C] To the
WorkItem assembly, add the following attribute:
QueueListenerEnabled:=True)>
[D] In the WorkItem implementation,
override the Activate method from the ServicedComponent class. In the Activate
method, add the following code segment: Dim q As New Queue()
q.Enqueue(Me)
- You create a serviced component named
Tracker that uses attributes to dynamically register itself for COM+ services.
Tracker is in an assembly file named Fabrikam.dll. Tracker uses transactions
and role-based security. The roles and the application identity for Tracker
are configured on the development computer.
You are preparing to hand
off Tracker to an administrator for deployment to production computers. You
want all the COM+ configuration information for Tacker to be installed on the
production computers.
What should you do?
[A] Use the Component
Services tool to export Tracker to an .msi file. Provide to the administrator
the .msi file with instructions to run the installer.
[B] Provide to
the a the Fabrikam.dll file. Instruct the administrator to copy Fabrilcam.dll
to all production computers and to install it in the global assembly
cache.
[C] Provide to the administrator the Fabrikam.dll file. Instruct
the administrator to use the .NET Services Installation tool (Regsvcs.exe) to
install Tracker.
[D] Add a new merge module to your solution. Add
Fabrikam.dll to the merge module. Provide to the administrator the .msm file
with installation instructions.
Correct Answer 12 - A
- You
are using Visual Studio .NET to develop an application to replace a COM-based
application. A former colleague began writing a .NET class for the new
application. This class will be used by client applications as a COM object.
You are assigned to finish writing the class.
The class includes the
following code segment: Public Class MyClass Public Sub
New() 'Implementation code goes here. End Sub
Public Function
MyMethod(ByVal param As String) As Integer Return True End
Function
Protected Function MyOtherMethod() As Boolean Return
True End Function
Public ReadOnly Property MyProperty() As
Integer Get Return 0 End Get End Property 'More implementation
code goes here. End Class
When this code runs, it will expose one or
more methods to the client applications through COM. Which member or members
will be exposed? (Choose all that apply.)
[A] MyMethod
[B]
MyOtherMethod
[C] MyProperty
[D] MyClass
constructor
- You
are using Visual Studio NET to develop an application to replace a COM-based
application. You are assigned to write a .NET class that will be used by
client applications as a COM object. Your class code is being moved and
modified while development continues on the new application. You want to
minimize any possible disruption to the COM interface as a result of code
changes.
Which code segment should you use?
[A] _ Public
Class MyClassToExpose Public Function Calc()as Integer ' Implementation
code goes here. End Function End Class
[B] _ Public
Interface IMyClassToExpose Public Function Calc() as Integer End
Interface Public Class MyClassToExpose Implements IMyClassToExpose
Public Function Calc() as Integer ' Implementation code goes here.
End Function End Class
[C] ComVisible(true)> _
Public Class MyClassToExpose Public Function Calc()as Integer '
Implementation code goes here. End Function End Class
[D] _
Public Class MyClassToExpose Public Function Calc() as Integer '
Implementation code goes here. End Function End Class
- You
are creating a serviced component that will perform several distributed
transactions across different databases. The serviced component will be called
from managed and unmanaged client applications.
You create a new class
library project. You write code in the class modules to implement the logic.
You want to detect and correct any registration errors before any client
applications use the component. What should you do next?
[A] Assign
a strong name to the assembly. Compile the assembly. Run the .NET Services
Installation tool (Regsvcs.exe) to add the component to Component
Services.
[B] Run the Type Library Exporter (Tlbexp.exe) to export the
definition for the assembly.
[C] Assign a strong name to the assembly.
Compile the assembly. Run the Global Assembly Cache tool (Gacutil.exe) to add
the component to the global assembly cache.
[D] Use the Assembly
Registration tool (Regasm.exe) to create entries in the registry that describe
the assembly.
Correct Answer 15 - A
- You
create a class named Billings that stores billing information. Billings
connects to a local Microsoft SQL Server database to store the billing
information. Billings must run under a local user account to connect to the
database.
The Billings class includes the following code:
Public
Class Billings Public Sub Submit(ByVal name As String, _ ByVal date As
DateTime, ByVal hours As Double) 'Method implementation goes here. End
Sub 'Private implementation goes here. End Class
You want to
ensure that client applications on other computers can use Billings by using
.NET Remoting.
What should you do?
[A] Derive the Billings
class from MarshalByRefObject.
[B] Implement the ISerializable
interface in the Billings class.
[C] Implement the IRemoteDispatch
interface in the Billings class.
[D] To the Billings class, add the
following attribute:
Correct Answer 16 - A
- You
create a .NET Remoting object named Patientinfo that exposes medical patient
information Because of the confidential nature of the information, you must
ensure that the data remains secure. You want client applications to connect
to Patientinfo over a secure communication channel. You want to accomplish
this task by writing the minimum amount of code.
What should you
do?
[A] Create your own host application and use a TcpChannel and a
BinaryFormatter.
[B] Create your own host application and use an
HttpChannel and a SoapFormatter.
[C] Install PatientInfo in an Internet
Information Services (IIS) virtual directory. Configure PatientInfo to use a
TcpChannel and a BinaryFormatter. Configure IIS to use SSL.
[D] Install
PatientInfo in an Internet Information Services (IIS) virtual directory.
Configure Patientinfo to use an HttpChannel and a SoapFormatter. Configure IIS
to use SSL.
Correct Answer 17 - D
- You
are creating a .NET Remoting object named PropertyCache. PropertyCache will
hold a Hashtable object of name/value pairs.
A variety of remote client
applications 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 PropertyCache to be a client-activated
object
[B] Configure PropertyCache to be a server-activated Singleton
object.
[C] Configure PropertyCache to be a server-activated SingleCall
object.
[D] Derive the PropertyCache class from MarshalByRefObject and
override InitializeLifetimeService() to return null.
[E] Mark the
PropertyCache class with the Serializable attribut Implement the ISponsor
interface in the PropertyCache class.
[F] Implement the ISerializable
and ILease interfaces in the PropertyCache class. Implement
ILease.CurrentLeaseTime to return Int32.MaxValue.
- You
have a .NET Remoting object named BatchOrder. The BatchOrder class allows
remote client applications to submit orders in batches. Each BatchOrder object
holds state information that is specific to each remote client application.
The BatchOrder class has overloaded constructors for initializing an
object.You want to develops server application to host BatchOrder objects.
What should you do? [A] Create a Windows service, and register
BatchOrder as a client-activated object.
[B] Create a Windows service,
and register BatchOrder as a server-activated Singleton object.
[C]
Host BatchOrder in Internet Information Services (IIS) and create a Web.config
file to register BatchOrder as a server-activated SingleCall
object.
[D] Host BatchOrder in Internet Information Services (IIS) and
create a Web.config file to register BatchOrder as a server-activated object
with an infinite lease.
Correct Answer 19 - A
- You
have a .NET Remoting object named ProductLoader. The ProductLoader class is a
server-activated Singleton object. The ProductLoader class loads product data
into a Microsoft SQL Server database. The Load method of the ProductLoader
class is a time-consuming method to call.
You are developing a client
application that uses the ProductLoader class. You want to ensure that the
client application can continue to respond to user input while the Load method
of the ProductLoader class is called.
What should you do? [A] Use an AsyncDelegate instance to
call the Load method.
[B] Modify the ProductLoader class to be derived
from IAsyncResult.
[C] Configure the ProductLoader class to be a
client-activated .NET Remoting object.
[D] Configure the client
application to have its own remoting channel that matches the server's channel
and formatter.
Correct Answer 20 - A
- You have a .NET Remoting object named
Promotions. The Promotions class allows remote client applications to add new
product promotions to an online catalog application. The Promotions class is
in an assembly file named Fabrikam.dll.
You have an Internet
Information Services (IIS) virtual directory named PromotionsObject. The
Fabrikam.dll file is in the PromotionsObject\bin directory. You want to host
the Promotions class in IIS.
What should you do?
[A] Create a
Web.config file that includes the following code segment: type="Fabrikam,
Promotions"/>
[B] Create a Weconfig file that includes the following
code segment: type="Fabrikam, Promotions"/>
[C] Create a
Web.config file that includes the following code
segment: <WELLKNOWN mode="SingleCall",
objectUri="Promotions.rem" type = "Promotions,
Fabrikam"/> </CHANNELS </APPLICATION? </SYSTEM.RUNTIME.REMOTING
[D]
Create a Web.config file that includes the following code
segment: <WELLKNOWN mode="SingleCall"
objectUri="Promotions.rem" type="Promotions,Fabrikaim"/>
- 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.
Correct Answer 22 - D
- You create a class named User that
provides user information from a variei of data sources. Different instances
of User connect to different data sources to load the data. User is a
read-only representation of user information and does not support writing
changes back to a data source.
The User class includes the following
code segment: Public Class User Public Sub New(String connectionString)
Me.connectionString = connectionString 'Additional construction code
goes here. End Sub
Friend ReadOnly Property ConnectionString() As
String Get return connectionString End Get End
Property
Private connectionString As String 'Other methods and
properties go here. End Class
Once a User object has been
populated, it no longer needs the connectionString member variable. You have a
.NET Remoting object named Project that returns User objects. You want to
prevent remote client applications from being able to view the contents of the
connectionstring member variable.
What should you do?
[A] Make
the ConnectionString property private. [B] Remove the connectionString
parameter from the constructor. [C] Add the NonSerialized attribute to the
ConnectionString property. [D] Add the NonSenalized attribute to the
connectionString member variable.
- You are creating an XML Web se that
retrieves customer-order data. Customer orders are retrieved by specii a
customer ID or family name. You write two overloaded Web methods to retrieve
this data. The Web method signatures are shown in the following code
segments:
Public Function Load(ByVal customerID As Integer) As
DataSet 'Code to retrieve and return order data goes here. End
Function
Public Function Load(ByVal familyName As String) As
DataSet 'Code to retrieve and return order data goes here. End
Function
You need to ensure that the Web service engine can map
requests to the appropriate method.
What should you do?
[A] Set the Description property of
each WebMethod attribute to a unique description.
[B] Set the
MessageName property of each WebMethod attribute to a unique message
name.
[C] Add the Overloads keyword to both signatures between the
Public keyword and the Function keyword.
[D] Add the Overloads keyword
to only the second signature between the Public keyword and the Function
keyword.
Correct Answer 24 - C
- You are creating an XML Web service
that will consist of a class named Stock. Stock will expose the following
public fields:
Symbol, CompanyName, and CurrentPrice.
When
serialized by the XMLSerializer, Stock will take the following form: You
need to construct the Stock class. Which code segment should you
use?
[A] Public Class Stock Public Symbol As String _ Public
CompanyName As String Public CurrentPrice As Double End Class
[B]
Public Class Stock Public Symbol As String Public CompanyName As
String Public CurrentPrice As Double End Class
[C] Public Class
Stock Public Symbol As String _ Public CompanyName As
String Public CurrentPrice As Double End Class
[D] Public Class
Stock Public Symbol As String _ Public CompanyName As
String _ Public CurrentPrice As Double End Class
Correct
Answer 25 - C
- You
are creating an XML Web service that processes highly confidential messages.
The service exposes a Web method named RetrieveMessage that takes as input a
cede name and returns an encrypted message.
You create a SOAP extension
and override the extension's ProcessMessage method so that you can encrypt the
message before it is sent back to the caller. You need to encrypt only the
data within the RetrieveMessageResult node of the SOAP response. You create a
function named EncryptMessage that encrypts the RetrieveMessageResult node.
You need to ensure that this method gets called before sending the message
back to the caller.
During which SoapMessageStage should you call
EncryptMessage?
[A] BeforeSerialize
[B]
AfterSerialize
[C] BeforeDeserialize
[D]
AfterDeserialize
- You develop a Windows-based application
named MyWinApp that contains a Windows Form named Form1. To MyWinApp, you add
a Web reference to an XML Web service named Service1. Service1 exposes two Web
methods named Authenticate and RetrieveData. Both methods have sessions
enabled. Authenticate authenticates a caller. If the caller is authenticated,
Authenticate generates a unique key, stores that key by using the Session
object, and returns that key.
RetrieveData expects a valid key that has
been generated by Authenticate as input before it will return data. If the key
matches the key in the current session, RetrieveData will return data to the
customer. You write the following code segment in the Page_Load event of
Form1. (Line numbers are included for reference only.)
01 Dim service1
As New localhost.Service1() 02 Dim key As String 03 Dim userData As
DataSet 04 'Insert new code. 05 key = service1.Authenticate(myUser,
myPassword) 06 userData = service1.RetrieveData(key) 07
DataGrid1.DataSource = userData
You run the application. When line 06
executes, the Web service returns an exception, which indicates that the key
is invalid. To ensure that the application runs without exceptions, you must
insert additional code on line 04.
Which code segment should you
use?
[A] service1.PreAuthenticate = True
[B]
service1.InitializeLifetimeService()
[C] service1.CookieContainer = New
System.Net.CookieContainer()
[D] Dim cookie As New
System.Net.Cookie("Key", key) Correct Answer 27 - A
- You
are creating an XML Web service named HousingService that exposes two Web
methods name SearchHouses and BuyHouses. Prior to deploying the service, you
want to customize the default template that is displayed when a customer makes
a request through the browser.
You create a Web Form named
HousingServiceDescription.aspx that is a customized version of the default
template. You place the Web Form in the bin directory of the HousingService
project. The Web Form needs to override the default template when a request is
made. You need to ensure that customers who request HousingService through a
browser view HousingServiceDescription.aspx.
What should you
do?
[A] Create a SOAP extension to redirect the user to
HousingServiceDescription
[B] Set the Namespace property of the
WebService attribute to the Iocation of
HousingServiceDescription.aspx.
[C] In the Web.config file, enable
tracing and set the TraceMode node to
bin\HousingServiceDescription.aspx.
[D] In the Web.config file, set the
HRef property of the wsdlHelpGenerator node to
bin\HousingServiceDescription.aspx.
Correct Answer 28 - D
- You are creating an ASP.NET application
named MyWebApp. To MyWebApp, you add a Web reference to an XML Web service
named UserService. UserService consists of a Web method named RetrieveUserInfo
This Web method takes a user ID as input and returns a DataSet object
containing user information. If the user IP is not between the values 1 and
1000, a System.ArgumentException is thrown. In MyWebApp, you write a try/catch
block to capture any exceptions that are thrown by UserService. You invoke
RetrieveUserInfo and pass 1001 as the user ID.
Which type of exception
will be caught?
[A] System.ApplicatioinException [B]
System.ArgumentException [C]
System.Web.Service.Protocols.SoapException [D]
System.Web.Service.Protocols.SoapHeaderException
- You
are creating a serviced component named TravelItinerary. TravelItinerary
includes the following code segment:
Public Class
TravelItinerary Inherits ServicedCoinponent Public Function Save
travelData _ As DataSet) As DataSet Dim airline As New
AirlineServer.AirlineService() Dim hotel As New
HotServer.HotelService() '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 TravelItinerary.
When the test application is run, an exception is thrown in
HotelService.
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 AirlineService remain
committed
[C] Transactions in only HotelService and TravelItinerary are
rolled back. Transactions in only AirlineService remain committed.
[D]
Transactions in only AirlineService and TravelItinerary are rolled back.
Transactions in only HotelService remain committed.
Correct Answer 30 -
B
- You create an XML Web service project
named LocalizationService. LocalizationService consists of two XML Web
services named ContentService and UserService. Each service contains a Web
method named Save.
The Web method signatures are shown in the following
code segments:
Public Function Save(ByVal contentinfo As DataSet) As
DataSet Public Function Save(ByVal userinfo As DataSet) As
DataSet
You are developing an ASP.NET application that will consume
LocalizationService. You add a Web reference to the services. You discover
that UserService is missing from the resulting proxy class that is generated
by Visual Studio .NET. You need to correct the problem in
LocalizationService.
What should you do? [A] Set the Name property
of the WebService attribute on ContentService and UserService to a unique
name.
[B] Set the Namespace property of the WebService attribute on
ContentService and UserService to a unique URI.
[C] Set the Description
property of the WebMethod attribute on ContentService and UserService to a
unique description.
[D] Set the MessageName property of the WebMethod
attribute on ContentService and UserService to a unique message name. Correct Answer 31 - B
- You
are creating an XML Web service named FlightService that provides flight
information to its users. To retrieve flight information, a user first must be
authenticated by FlightService. Once authenticated, a key that identifies that
user is returned to the caller. This key then will be presented in the SOAP
header on all subsequent flight information requests to validate that user.
You need to construct FlightService so that it can receive the key in a SOAP
header. First, you add a class to FlightService by writing the following code
segment:
Public Class UserKeyHeader Inherits SoapHeader Public
key As String End Class
Next, you add a Web method to FlightService
by writing the following code segment:
Public keyHeader As
UserKeyHeader
Public Function RetrieveFlightlnforniation() As
DataSet 'Code to check SOAP header goes here. 'Code to retrieve flight
information goes here. End Function
You attempt to build
FlightService, and discover that it does not compile. You need FlightService
to compile.
What should you do?
[A] Change the declaration of
the keyHeader variable from public to private. [B] Set the memberName
parameter of the SoapHeader attribute to "keyHeader". [C] Set the Direction
property of the SoapHeader attribute to SoapHeaderDirection.In. [D] Set the
Direction property of the Soaplleader attribute to
SoapHeaderDirection.Out.
Correct Answer 32 - B
- You
develop an ASP.NET application that consumes a third-party XML Web service
named CreditService. CreditService contains a Web method named Cha ChargeCard
takes as input a credit card number, a billing address, and a monetary amount
and returns a Boolean, variable that indicates whether or not the card was
charged.
Calls to ChargeCard take one minute to complete. You do not
want users to have to wait while ChargeCard executes. You want users to be
taken automatically to the next Web page of the application.
Which code
segment should you use to call CreditService?
[A]
CreditService.ChargeCard(ccNumb, billAddress,
amount) Server.Transfer("process.aspx") [B]
CreditService.ChargeCard(ccNumb, billAddress,
amount) Response.Redirect("process.aspx")
[C]
CreditService.BeginChargeCard(ccNumb, billAddress, _ amount, New
AsyncCallback(AddressOf CCResponse),
Nothing) Server.Transfer("process.aspx") Private Sub CCResponse(ByVal
aRes As lAsyncResult) CreditService.EndChargeCard(aRes) End
Sub
[D] Dim AsyncResult As IAsyncResult AsyncResult =
CreditService.BeginChargeCard(ccNumb, _ billAddress, amount, Nothing,
Nothing) AsyncResult.AsyncWaitHandle.WaitOne() CreditService.EndChargeCard(AsyncResult) Server.Transfer("process.aspx")
Correct
Answer 33 - C
- Your company provides a credit card
processing application for its customers. The current application supports
only computers that run on a Microsoft Windows operating system. You are asked
to rewrite the current application as a .NET application. This .NET
application does not need to be backward compatible with the current
application. You must ensure that this new application meets the following
requirements:
Must support asynchronous processing. Must be able to
pass data through firewalls. Must pass only SOAP-compliant formatted data
validated by using an XSD schema. Must not be limited to client computers
running on a Microsoft operating system. · · · · · · · You want to
accomplish this task by using the minimum amount of development effort. Which
type of .NET application should you use?
[A] Windows service [B] XML
Web service [C] serviced component [D] .NET Remoting object
- You are creating an XML Web service
named ListBoxService. This service provides content, such as states,
countries, and geographical regions, for use in drop-down list boxes.
ListBoxService contains a Web method named RetrieveR.egionsListBox. This
method returns a DataSet object that contains every geographical region in the
world. RetrieveRegionsListBox calls a Microsoft SQL Server database to load
the DataSet object with region data. You want to minimize the amount of time
the method takes to return to the caller.
What should you
do?
[A] Use a stored procedure to return the data.
[B] Store
each DataSet object by using the Session object.
[C] Set the
BufferResponse property of the WebMethod attribute to false.
[D] Set
the CacheDuration property of the WebMethod attribute to an interval greater
than zero.
Correct Answer 35 - B
- You
are creating an XML Web service named LegalService. This service exposes two
Web methods named SendMessage and ReceiveMessage.
SendMessage is used to
send highly confidential messages to its customers.
ReceiveMessage is
used to receive highly confidential messages from its customers and to process
these messages for future use.
You need to ensure that these messages
cannot be intercepted and viewed by anyone other than LegalService and the
customers who access LegalSeivice. Which security mechanism should you
use?
[A] SSL [B] authorization [C] authentication [D]
impersonation
Correct Answer 36 - A
- You
are creating an XML Web service named myService. This service has a !iinction
named WriteMessage that writes messages to a flat file in the C:\myServiceLog
directory. You want to implement security for WriteMessage so that
WriteMessage and all the code it calls can write messages only to the
myServiceLog directory.
Which code segment should you use? [A] Dim
filePermission As New FileIOPermission _ (FileIOPermissionAccess.Write,
"C:\myServiceLog") filePermissionDemand()
[B] Dim filePermission As
New FileIOPerniission _ (FileIOPermissionAccess.Write, "C:\myServiceLog")
filePermission.Deity()
[C] Dim filePermission As New
FileIOPermission _ (FileIOPermissionAccess.Write,
"C:\myServiceLog") filePermission.PermitOnly()
[D] Dim
filePermission As New FileiOPermission _ (FileIOPermissionAccess.Write,
"C:\myServiceLog") filePermission.Assert()
Correct Answer 37 - C
- You are creating an XML Web service
named Accountlnformation for a community bank. Accounth exposes a Web method
named GetAccountBalance that returns the account balance as a string. You must
limit access to GetAccountBalance to users who have credentials stored in your
Microsoft SQL Server database.
You need to design GetAccountBalance to
receive encrypted user credentials by using two custom fields named Username
and Password in the SOAP header. To accomplish this goal, you must write the
code for GetAccountBalance.
Which code segment should you
use?
[A] Public Class AuthenticateUser: Inherits SoapHeader
Public Username As String Public Password As String End
Class
'In the AccountInformation class add this code:
Public
authenticateUserHeader As AuthenticateUser
Public Function
GetAccountBalance() As String If(authenticateUserHeader Is "")
Then Return "Please supply credentials." Else 'Code to authenticate
the user and 'return the account balance goes here. End If End
Function
[B] Public Class AuthenticateUser Public Username As
String Public Password As String End Class
'In the
AccountInformation class add this code:
Public authenticateUserHeader
As AuthenticateUser _ Public Function GetAccountBalance() As
String If (authenticateUserHeader Is "") Then Return "Please supply
credentials." Else 'Code to authenticate the user and return 'the
account balance goes here. End If End Function
[C] Public Class
AuthenticateUser Inherits SoapHeader Public Username As
String Public Password As String End Class
'In the
AccountInformation class add this code:
Public authenticateUserHeader
As AuthenticateUser _ Public Function GetAccountBalance()As String
If (authenticateUserHeader Is "") Then Return "Please supply
credentials." Else 'Code to authenticate the user and return 'the
account balance goes here. End If End Function
[D] Public Class
AuthenticateUser Public Username As String Public Password As
String End Class
'In the AccountInformation class add this
code:
Public authenticateUserHeader As AuthenticateUser Public
Function GetAccountBalance()as String If (authenticateUserHeader Is "")
Then Return "Please supply credentials." Else 'Code to authenticate
the user and return 'the account balance goes here. End If End
Function
Correct Answer 38 - A
- You
are developing an ASP.NET application that consumes an XML Web service named
Mcount Accountlnformation exposes a Web method named GetAccountBalance that
expects enciypted user credentials to be passed in the SOAP
header.
AccountInformation also exposes a public class named
AuthenticateUser. AuthenticateUser has two properties named Username and
Password that are both defined as string. In the application, you create two
local variables named encryptedUsername and encryptedPassword that you will
use to pass user credentials to GetAccountBalance. You need to write cede that
will execute the GetAccountBalance Web method.
Which code segment
should you use?
[A] Dim myAccountInformation As New Account() Dim
myAuthenticateUser As New AuthenticateUser() myAuthenticateUser.Username =
encryptedUsername myAuthenticateUser.Password = encryptedPassword
myAccountInformation.AuthenticateUserValue = myAuthenticateUser Dim
accountBalance As String accountBalance
myAccountInformation.GetAccountBalance()
[B] Dim myAccountinformation
As New Account() Dim myAuth As New
AuthenticateUser() myAuthenticateUser.Username = encryptedUsemame
myAuthenticateUser.Password = encryptedPassword Dim accountBalance As
String accountBalance = myAccountInformation.GetAccountBalance
[C]
Dim myAccountInformation As New AccountInformation() Dim myAuthenticateUser
As New AuthenticateUser() Dim Username As New
SoapHeaderAttribute("Username") Username.MemberName = encryptedUsername
Dim Password As New SoapHeaderAttribute("Password")
Password.MemberName = encryptedUserPassword Dim accountBalance As
String accountBalance = myAccount [D] Dim myAccountInformation As New
AccountInformation() Dim myAuthenticateUser As New
AuthenticateUser() myAuthenticateUser.Username = encryptedUsername
myAuthenticateUser. Password = encryptedPassword Dim
mySoapHeaderCollection As New
SoapHeaderCollection() mySoapHeaderCollection.Add(myAuthenticateUser)
Dim accountBalance As String accountBalance = myAccount
- You are creating an XML Web service
named SalesInformation. This service provides sales information to regional
managers and directors by using a virtual private network (VPN).
Saleslnformation exposes a Web method named GetSalesInfo that returns sales
information to the caller. You must use role-based security to restrict access
to GetSaleslnfo to only members of the two Windows groups named Manager and
Director. You configure SalesInformation to use Integrated Windows
authentication.
You write the following code to create permissions in
GetSaleslnfo:
Dim myPermission1 As New PrincipalPermission(Nothing,
"Manager") Dim myPennission2 As New PrincipalPermission(Nothing,
"Director")
You need to write the remaining code in GetSalesInfo to
ensure that only users in the Manager group and the Director group can access
Sales Which code segment should you use?
[A]
myPermission1.Intersect(myPermission2).Demand()
[B]
myPermission1.Union(myPermission2).Demand()
[C] myPermission1.Demand()
myPermission2.Demand()
[D] myPermission2 = myPermission1.Copy()
myPermission2.Demand()
Correct Answer 40 - B
- You are creating an XML Web service
named myWebService. Callers must be authenticated by using credentials passed
in the SOAP header of each Web service call. You want to use role-based
security to secure each method on myWebService. The roles that users are
assigned are stored in a custom database table. You need to write code that
will allow you to dynamically change which roles can execute specific methods
at run time.
What should you do?
[A] Create a WindowsIdentity
object and a WindowsPrincipal object. Then implement declarative role-based
security.
[B] Create a WindowsIdentity object and a WindowsPrincipal
object. Then implement imperative role-based security.
[C] Create a
GenericIdentity object and a GenericPrincipal object. Then implement
declarative role-based security.
[D] Create a GenericIdentity object
and a GenericPrincipal object. Then implement imperative role-based
security.
Correct Answer 41 - D
- You are creating an XML Web service
named myWebService. This service will be used to exchange highly confidential
information over the Internet with your company's business partner named
Fabrikam, Inc. You want only callers from Fabrikam, Inc., to be able to access
myWebService. You do not want to have to accept a user name and password from
callers.
Once callers are authenticated, you want to use Windows user
accounts to authorize access to the Web methods exposed by the Web service.
You set up two Windows user accounts named FabrikamAssociate and
FabrikamManager. You need to configure myWebService to meet these security
requirements.
Which type of authentication should you use?
[A]
Basic
[B] Digest
[C] Anonymous
[D] Client
Certificate
- You
are creating an XML Web service named Healthinfo. Healthinfo exposes patient
health records for your clinical customers. To the beginning of each
Healthinfo method, you add the following code segment:
Dim uiPerm As New
UIPermission(UIPermissionWindow.AllWindows, _
UIPermissionClipboard.AllClipboard) Dim filePerm As New
FileIOPermission(PermissionState.None) filePerm.AllFiles = File
As
one part of making Healthinfo as secure as possible, you must ensure that the
Healthinfo Web methods do not perform any file I/O or access the user
interface. Which code segment should you use?
[A] uiPemi.Deny()
filePerm.Deny()
[B] uiPerm.Deny() uiPerm.RevertAssert()
filePerm.Deny()
[C] uiPerm.Deny() uiPerm.RevertDeny
filePerm.Deny()
[D] Dim permSet As New PermissionSet(
PermissionState.None)
permSet.AddPermission(uiPerm) permSet.AddPermission(filePerm)
permSet.Deny()
Correct Answer 43 - D
- You create an XML Web service named
ReportService for an application on your company's intranet. You configure
Internet Information Services (IIS) and ReportService to use Integrated
Windows authentication. You configure the Access Control List (ACL) for
ReportService to allow access to only members of a Windows group named
FieldAgents. You test and confirm that only members of the FieldAgents group
can use ReportService.
ReportService includes a method named
SubmitSurveillance that calls a serviced component named ReportData.
ReportData uses COM+ role-based security to restrict component access to
members of the COM+ Agents role. The COM+ Agents role is configured to include
the FieldAgents group. You call SubmitSurveillance. However, when the call to
ReportData is attempted, an exception is thrown indicating that access is
denied. You need to correct this problem.
What should you
do?
[A] In IIS, enable Anonymous access.
[B] In the section of
the Weconfig file, add the following line of code:
[C] In the section
of the Web.config file, add the following line of code:
[D] In the
section of the Web.config file, add the following line of code:
Correct Answer 44 - B
- Your
Microsoft SQL Server database contains a table named Customers. Customers
contains three columns named PamilyName, PersonalName, and Address. You
instantiate a SqlCommand object named myCommand that you will use to populate
a DataReader object named customersDataReader. You need to initialize
myCommand to load customersDataReader to include FamilyNarne and PersonalName
for all rows in Customers.
Which code segment should you
use?
[A] myCommand.CommandText = "SELECT FamilyName," _ &
"PersonalName FROM Customers"
[B] myCommand.CommandType = "SELECT
FamilyName," _ & "PersonalName FROM Customers"
[C]
myCommand.Parameters.Add("SELECT FamilyName," _ & "PersonalName FROM
Customers")
[D] myCommand.ExecuteNonQuery
- Your Microsoft SQL Server database
contains a table that consists of more than 1 million rows. You need to
develop an application that reads each row in the table and writes the data to
a flat file. The application will run only once each day. You want the
application to process the data as quickly as possible.
Which class
should you use to retrieve the data?
[A] DataSet [B]
DataTable [C] DataReader [D] DataAdapter
Correct Answer 46 - C
- You
have a SqlDataReader object named ordersDataReader. 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 ordersDataReadet and pass OrderQuantity to
a function named myFunction. Which code segment should you use?
[A]
While ordersDataReader.Read Read Call
myFunction(ordersDatafleader("OrderQuantity")) End While
[B] While
ordersDataReader.NextResult Call
myFunction(ordersDataReader("OrderQuantity")) End While
[C] Dim
orderCount As Integer While orderCount < ordersDataReader.FieldCount
Call myFunction(ordersDataReader("OrderQuantity")) orderCount += 1
ordersDataReader.Read End While
[D] Dim orderCount As
Integer While orderCount < ordersDataReader.FieldCount Call
myFunction(ordersDataReader("OrderQuantity")) orderCount + 1
ordersDataReader.NextResult End While
- You
are developing an application that loads two DataReader objects from a
Microsoft SQL Server database. The DataReader objects are named
customersDataReader and productaDataReader. The customersDataReader object is
loaded from the Customers table. The productsDataReader object is loaded from
the Products table.
You create a SqlCommand object named myCommand and
a SqlConnection object named myConnection. You write the following code
segment. (Line numbers are included for reference only.)
01
myCommand.Connection myConnection 02 Dim customersDataReader As Sqlb 03
Dim productsDataReaderAs SqldataReader 04 myCommand.CommandText "SELECT *
FROM Customers" 05 myConnection.Open() 06 customersDataReader
myCommand.ExecuteReader 07 'Code to process the data reader goes
here. 08 'Insert new code. 09 myCowmand.CosnmandText = "SELECT * FROM
Products" 10 productsDataReader myCommand.ExecuteReader 11' Code to
process the data reader goes here.
You run the application and an
exception is thrown on line 10. To correct the problem, you need to insert
additional cede on line 08.
Which code segment should you
use?
[A] myConnnand.ResetCommandTimeout()
[B]
myCommand.Dispose()
[C] customersDataReader.NextResult()
[D]
customersDataReader.Close()
- Your
Microsoft SQL Server database contains a table named Orders. Due to a recent
increase in product sales, Orders now contains more than 500,000 rows. You
need to develop an application to produce a report of all orders in the table.
You need to ensure that the application processes the data as quickly as
possible.
Which code segment should you use?
[A] Dim
myOleDbConnection As New OleDbConnection _ ("Data Source=(local);"
_ & "Initial Catalog=Northwind" _ & "Integrated
Security=true") Dim myOleDbCommand As New OleDbCommand _ ("SELECT * FROM
Orders", myOleDbConnection)
Dim ordersDataReader As
OleDbDataReader myOleDbConnection.Open() ordersDataReader =
myOleDbCommand.ExecuteReader
[B] Dim myOleDbConnection As New
OleDbConnection _ ("Provider=SqlOleDb;Data Source=(local);" _ &
"Initial Catalog=Northwind;" _ & "Integrated Security=true")
Dim
myOleDbCommand As New OleDbCommand _ ("SELECT * FROM Orders",
myOleDbConnection)
Dim ordersDataReader As
OleDbDataReader myOleDbConnection.Open() ordersDataReader =
myOleDbCommand.ExecuteReader
[C] Dim myConnection As New
SqlConnection _ ("Data Source=(local);Initial CatalogNorthwind;" _
& "Integrated Security=true")
Dim myCommand As New SqlCommand
_ ("SELECT * FROM Orders", myConnection)
Dim ordersDataReader As
SqlDataReader myConnection.Open() ordersDataReader =
myCommand.ExecuteReader
[D] Dim myConnection As New SqlConnection
_ ("Data Source=(local);Initial Catalog=Northwind" _ & "Integrated
Security=true")
Dim myCommand As New SqlCommand("SELECT * FROM
Orders") Dim ordersDataReader As SqlDataReader
myConnection.Open() ordersDataReader =
myCommand.ExecuteReader
Correct Answer 49 - C
- You
have a SqlDataReader object named ptoductsDataReader. The productsDataReader
object contains three columns in the following order:
ProductID as
Integer ProductName as nvarchar(40) UnitsInStock as Integer
You
want to use productsDataReader to create an inventory management report. You
define the following three variables:
myProductID as
integer myProductName as String myUnits as Integer
You need to
ensure that the report runs as quickly as possible. Which code segment should
you use?
[A] myProductID = productsDataReader.Item(1) myProductName
= productsDataReader.Item(2) myUnits =
productsDataReader.Item(3)
[B] myProductID = productsDataReader.Item(0)
myProductName = productsDataReader.Item(1) myUnits =
pmductsDataReader.Item(2) [C] myProductID =
productsDataReader.Item("ProductlD") myProductName =
productsDataReader.Item("ProductName") myUnits =
productsDataReader.Item("UnitsInStock")
[D] myProductID =
productsDataReader.GetName("ProductID") myProductName =
productsDataReader.GetName("ProductName") myUnits =
productsDataReader.GetName("UnitsInStock")
- You
develop an application that uses a Microsoft SQL Server database and a
SqlClient data provider. Your application includes the following four code
segments, which are each called once:
Dim myConnection1 As New
SqlConnection() myConnectionl.ConnectionString = "Data Source" _ &
"ProdServer;Initial Catalog=Billing;" _ & "Integrated
Security=true" myConnection1 .Open()
Dim myConnection2 As New
SqlConnection() myConnection2.ConnectionString = "Data Source=" _ &
"ProdServer;Initial Catalog=Billing;" _ & "Integrated Security=true"
myConnection2.Open()
Dim myConnection3 As New
SqlConnection() myConnection3.ConnectionString = "Data Source=" _ &
"SearchServer;lnitial Catalog=Search;" _ & "Integrated Security=true"
myConnection3.Open()
Dim myConnection4 As New
SqlConnection() myConnection4.ConnectionSlting = "Data Source=" _ &
"ProdServer,Initial Catalog=OrderEntry;" _ & "Integrated
Security=true" myConnection4.Open()
You verify that your
application is the only application that is using SQL Server, Your application
runs all code segments by using the same identity. You run the application.
Connection pooling is enabled, and the entire application runs within the
connection timeout parameter. How many connection pools are
created?
[A] one [B] two [C] three [D] four Correct Answer
51 - C
- You
create an XML Web service that retrieves data from a Microsoft SQL Server
database. You instantiate a SqlConnection object named myConnection and set
the Max Pool Size property of the connectionString to 50. All 50 connections
are now in use. However, a request for connection number 51 is
received.
What is the most likely result?
[A] An exception is
immediately thrown.
[B] The current connection pool is expanded by 50
additional connections.
[C] A new connection pool is created that has
the same maximum number of connections.
[D] The request is queued until
a connection becomes available or until the timeout limit is
reached
Correct Answer 52 - D
- You
have a DataSet object named cnstomersDataSet that contains a DataTable object
named Customers. Customers retrieves information from a Microsoft SQL Server
database. Customers contains a column named Region.
You want to create
a DataView object named customersDataView that contains only customers in
which the value in the Region colunm is France.
Which code segment
should you use?
[A] Dim customersDataView As New _
DataView(customersDataSet.Tables("Customers"))
customersDataView.FindRows("Region = France")
[B] Dim
customersDataView As New _ DataView(customersDataSet.Tables("Customers"))
customersDataView.FindRows("Region = France")
[C] Dim
customersDataView As New _ DataView(customersDataSet.Tables("Customers"))
customersDataView.RowFilter = ("Region = France")
[D] Dim
customersDataView As New _ DataView(customersDataSet.Tables("Customers"))
customersDataView.RowFilter = ("Region = 'France'")
- You
are developing an order-processing application that retrieves data from a
Microsoft SQL Server database. The database contains a table named Customers
and a table named Orders. Customers has a primary key of CustomerID. Each row
in Orders has a CustomerID that indicates which customer placed the
order.
Your application uses a DataSet object named ordersDataSet to
capture customer and order information before it is applied to the database.
The ordersDataSet object has two DataTable objects named Customers and
Orders.
You want to ensure that a row cannot exist in the Orders
Datalable object without a matching row existing in the Customers DataTable
object.
Which two actions should you take? (Each correct answer
presents part of the solution, Choose two.)
[A] Create a foreign key
constraint named ConstraintOrders that has Orders.CustomerlD as the parent
column and Customers.CustomerlD as the child column.
[B] Create a
foreign key constraint named ConstraintCustomers that has Customers.CustomerlD
as the parent column and Orders.CustomerlD as the child column.
[C]
Create a unique constraint named UniqueCustomers by using the
Customers.CustomerlD.
[D] Add ConstraintOrders to the Orders
DataTable.
[E] Add ConstraintOrders to the Customers
DataTable.
[F] Add ConstraintCustomers to the Orders
DataTable.
[G] Add ConstraintCustomers to the Customers
DataTable.
[H] Add UniqueCustomers to the Customers
DataTable.
Correct Answer 54 - B-F
- You are developing an application that
retrieves a list of geographical regions from table in a Microsoft SQL Server
database. The list of regions is displayed in a drop-down list box on a
Windows Form.
You want to populate the list box with data from a
DataSet object. You want to fill the DataSet object by using a SqlDataAdapter
object. You create a SqlConnection object named myConnection and a SQL query
string named regionSQL. You need to write the code to create the
SqlDataAdapter object.
Which code segment should you use?
[A]
Dim myDataAdapter As New SqlDataAdapter()
myDataAdapter.SelectCommand.Connection = myConnection
myDataAdapter.SelectCommand = regionSQL
[B] Dim myDataAdapter As
New SqlDataAdapter(regionSQL, myConnection)
[C] Dim SqlCmd As New
SqlCommand(regionSQL) Dim myDataAdapter As New
SqlDataAdapter() myDataAdapter.SelectCommand.Connection = myConnection
myDataAdapter.SelectCommand = SqlCmd
[D] Dim SqlCmd As New
SqlCommand() Dim myDataAdapter As New
SqlDataAdapter() SqlCmd.SqlCommandText = regionSQL
myDataAdapter.SelectCommand.Connection = myConnection
myDataAdapter.SelectCommand = SqlCmd
- You
have a DataSet object named loanCustomersDataSet that contains customers
serviced by the loan department of your company. You receive a second DataSet
object named assetCustomersDataSet that contains customers serviced by the
asset management department of your company. Both objects have the same
structure.
You want to merge assetCustomersDataSet into
loanCustomersDataSet and preserve the original values in loanCustomersDataSet.
Which code segment should you use?
[A]
loanCustomersDataSet.Merge(assetCustomersDataSet)
[B]
loanCustomersDataSet.Merge(assetCustomersDataSet, True)
[C]
assetCustomersDataSet.Merge(loanCustomersDataSet)
[D]
assetCustomersDataSet.Merge(loanCustomersDataSet, True)
Correct Answer
56 - B
- You are planning to create a DataSet
object named myDataSet to be used in a bond-trading application. Several
developers will need to write code to manipulate myDataSet, and you want to
ensure that myDataSet is easy for them to use. You decide to create myDataSet
as a strongly typed data set.
Which two actions should you take? (Each
correct answer presents part of the solution. Choose two.)
[A] Create
an XSD schema that defines myDataSet.
[B] Create an XDR. schema that
defines myDataSet.
[C] Create a class for myDataSet that is based on
the schema and that inherits from the DataSet class.
[D] Create a class
for myDataSet that is based on the schema and that inherits from the XmlSchema
class.
[E] Create a key pair for myDataSet by using the Strong Name
tool (Sn.exe).
Correct Answer 57 - A-C
- You
have a strongly typed DataSet object named myDataSet. This object contains
three DataTable objects named Customers, Orders, and OrderDetails. Customers
and Orders have a data column named CustomerlD. Orders and OrderDetails have a
data column named OrderlD. Orders has a foreign key constraint between
Customers and Orders on CustomerlD. OrderDetails has a foreign key constraint
between Orders and OrderDetails on OrderlD.
You want to populate
Customers, Orders, and OrderDetails with data from a Microsoft SQL Server
database.
In which order should you fill the DataTable
objects?
[A] Customers OrderDetails Orders
[B]
OrderDetails Orders Customers
[C]
Customers Orders OrderDetails
[D]
Orders OrderDetails Customers
- You
have a strongly typed DataSet object named customersDataSet. This object
contains a single DataTable object named Customers. Customers has an integer
data column named CustomerlD. You want to access the CustomerlD value by using
the type-safe code conventions provided by customersDataSet. You want to
assign the value to a string variable named customerlD.
Which code
segment should you use?
[A] customerlD = customersDataSet.Customers
(0).CustomerID.ToString()
[B] customerlD =
customersDataSet.Customers.Columns_ ("CustomerID").ToString()
[C]
customerlD = customersDataSet.Tables("Customers").
_ Columns("CustomerID").ToString()
[D] customerlD =
customersDataSet.Tables("Customers").
_ Rows(0)("CustomerID").ToString()
Correct Answer 59 - A
- You have a DataSet object that contains
a single DataTable object named Employees. Employees has a column named
EmployeelD. EmployeelD contains no duplicate data. You are creating a function
that accepts a parameter of EmployeeiD and searches Employees to return the
DataRow object for the specified EmployeelD.
You want to use the Find
method of the rows collection in Employees to return the requested DataRow
object from the function. You need to ensure that you can use the Find method
to accomplish this goal
What should you do?
[A] Ensure that
EmployeelD is the first column in Employees.
[B] Ensure that EmployeelD
is unique for each row in Employees.
[C] Ensure that Employees has a
primary key on EmployeelD.
[D] Ensure that Employees is sorted in
ascending order on EmployeelD
- You
are creating a data access component for an XML Web service. You need to
populate and process a DataSet object with data from a table named Customers
in a Microsoft SQL Server database.
You write the following code
segment:
Dim myConnection As New
SqlConnection(myConnectionString) Dim myDataAdapter As New SqlDataAdapter
_ ("SELECT * FROM Customers", myConnection) Dim myDataSet As New
DataSet() Dim customerName As String
You want to capture all SQL
Server errors and general exceptions that occur. You want to process SQL
Server errors separate from general exceptions
Which code segment
should you use?
[A] Try myDataAdapter.Fill(myDataSet, "Customers")
customerName = myDataSet.Tables(0).Rows(0).Item("CustomerName") Catch
mySqlException As SqlException Throw New SqlException("Sql exception
occurred") Catch myException As Exception' 'Code to process general
exceptions goes here. End Try
[B] Try myDataAdapter.Fill(myDataSet,
"Customers") customerName =
myDataSet.Tables(O).Rows(O).Item("CustomerName") Catch mySqlException As
SqlException For Each mySqlException In mySqlException.Errors ' Code
to process SQL Server errors goes here. Next Catch myException As
Exception ' Code to process general exceptions goes here. End
Try
[C] Try myDataAdapter.Fill(myDataSet, "Customers") customerName
= myDataSet.Tables(O).Rows(O).Item("CustomerName") Catch mySqlException As
SqlException Dim mySqlError As SqlError For Each mySqlError In
mySqlException.Errors 'Code to process SQL Server errors goes here.
Next Catch myException As Exception 'Code to process general
exceptions goes here End Try
[D] Try myDataAdapter.Fill(myDataSet,
"Customers") customerName =
myDataSet.Tables(O).Rows(O).Item("CustomerName") Catch myException As
Exception Throw New Exception("General exception occurred") Catch
mySqlException As SqlException Dim mySqlError As SqlError For Each
mySqlError In mySqlException.Errors' 'Code to process SQL Server errors
goes here. Next End Try
- You
use a function to maintain a table named Categories in a Microsoft SQL Server
database. The function creates a DataTable object named Categories in a
DataSet object named categoriesDataSet. These two objects capture all
insertions, updates, and deletions to the Categories table.
The
function instantiates a SqlDataAdapter object named myDataAdapter. This object
is configured to select, Insert, update, and delete rows in the Categories
DataTable object.
You need to update the database to include the
changes in the Categories DataTable object and capture all data errors in a
batch after all rows have been processed.
Which code segment should you
use?
[A] Try myDataAdapter.Update(categoriesDataSet,
"Categories") Catch mySqlException As SqlException Dim myDataRow() As
DataRow = _ categoriesDataSet.Tables(O).GetErrors End Try 'Code to
process errors goes here.
[B] myDataAdapter.ContinueUpdateOnError =
True Try myDataAdapter.Update(categoriesDataSet, "Categories") Catch
mySqlException As SqlException Dim myDataRow() As DataRow =
_ categoriesDataSet.Tables(O).GetErrorsQ End Try 'Code to process
errors goes here.
[C] myDataAdapter.Update(categoriesDataSet,
"Categories") If categoriesDataSet.Tables(O).HasErrors Then Dim
myDataRow() As DataRow = _ categoriesDataSetSables(O).GetErrors() 'Code
to process error's goes here. End If
[D]
myDataAdapter.ContinueUpdateOnError = True
myDataAdapter.Update(categoriesDataSet, "Catogories") If
categoriesDataSet.Tables(O).HasErrors Then Dim myDataRow() As DataRow =
_ categoriesDataSet.Tables(O).GetErrors() 'Code to process errors goes
here. End If
Correct Answer 62 - D
- You
are creating an XML Web service that generates a SOAP message. Parameter
information in the SOAP message must be encrypted. You write the appropriate
code to modify the SOAP message. You also write a method named Encrypt. This
method takes a string as an argument, encrypts the string, and returns a new
string that contains the encrypted string. Before encryption, the Body element
of the SOAP message will be written in the following format:
some
data After encryption, the Body element must be written in the following
format:
154371461941792321392842 184202 16418
You write code to
isolate the XML node in an XmlNode object named theNode. You now need to write
code to encrypt the parameter information. Which code segment should you
use?
[A] Dim encrypted As String = Encrypt(theNode.InnerText)
theNode.OuterXml = encrypted
[B] Dim encrypted As String =
Encrypt(theNode.InnerXml) theNode.OuterXml = encrypted [C] Dim
encrypted As String = Encrypt(theNode.InnerXml) theNode.InnerXml =
encrypted
[D] Dim encrypted As String = Encrypt(theNode.OuterXml)
theNode.OuterXml = encrypted
[E] Dim encrypted As String =
Encrypt(theNodInnerText) theNodInnerText = encrypted
Correct Answer
63 - C
- Your
company buys and sells used refrigerators. External vendors frequently send
you XML documents that list one type of used appliances for sale. The
documents that you receive contain either only washers or oniy refrigemtors as
in the following example:
All incoming XML documents are loaded into a
MemoryStream object named usedList. You need to automate a process that will
discover which XML documents contain refrigerator elements. As soon as you
ascertain that a document contains refrigerators, you can stop processing the
document.
You decide to use Visual Studio .NET to develop an
application that will contain a Boolean variable named hasRefrigerator. A
value of True for this variable means that a document contains refrigerator
elements. A value of False means that it does not. You want to ensure that the
discovery process occurs as quickly as possible.
What should you
do?
[A] Create an XmlDocument object and load ft from usedList. Use
the SelectSingleNode method to search the XmlDocument object for the
saleListlrefrigerators node. If this node is found, set hasRefrigerator to
True. Otherwise, set hasRefrigerator to False.
[B] Create an
XmlXPathDocument object and lüad it from usedList. Use an XPathNavigator
object to search the XmlXPathDocument for the saleListlrefrigerators node.
If this node is found, set hasRefligeratorto True. Otherwise, set
hasRefrigerator to False.
[C] Create an XmlTextReader object on
usedList. Loop through usedList by the MoveToContent method of the
XmlTextReader object and comparing for the saleList/refrigerators node. If
this node is found, set basRefrigerator to True. Otherwise, set
hasReftigerator to False. [D] Create a DataSet object and use its ReadXml
method to load usedList into the object. If the Count property of the Rows
collection of the "refrigerators" entry in the object is not equal to zero,
set hasRefrigerator to True. Otherwise, set hasRefrigerator to
False.
- You
are developing an application that queries a Microsoft SQL Server database.
The application will package the results of the query as XML data. The XML
data will be retrieved directly from the database and transmitted
electronically to a business partner.
The query must retrieve all rows
and all columns from a database table named Customers.
Which query
should you use?
[A] SELECT * FROM Customers FOR XML AUTO
[B]
SELECT * FOR XML FROM Customers
[C] SELECT * FROM Customers as
XMLDATA
[D] SELECT * FROM OPENXML( '', '/RootlCustomer', 1) with
(CustomerID varchar(10))
Correct Answer 65 - A
- You are developing an application that
receives product information from external vendors in the form of XML
documents. The information will be stored in a Microsoft SQL Server
database.
The application must validate all incoming XML data. It uses
an Xml ValidatingReader object to read each XML document. If any invalid
sections of XML are encountered, the inconsistencies are listed in a single
document.
You must ensure that the validation process runs as quickly
as possible.
What should you do?
[A] Set the ValidationType
property of the Xml ValidatingReader object to Schema.
[B] Set the
CanResolveEntity property of the XmlValidatingReader object to True. [C]
Create and register a ValidationEventHandler method.
[D] Use a
try/catch block to catch validation exceptions.
Correct Answer 66 -
C
- You
are troubleshooting a Visual Studio .NET application that was developed by a
former colleague. The application contains a NextToken function. This function
reads product names from a file. You find the following code segment within a
large assembly:
Dim xwriter As New XmllextWriter("productNames.xml",
_ System.Text.Encoding.UTF8) xwriter.WriteStartDocument(True) xwriter.WriteStartElement("data",
"www.contoso.com")
Dim val As String = NextToken() While val
<> "" xwriter.WriteElementString("item", _ "www.contoso.com",
val) val = NextToken () End While
xwriter.WriteEndElement() xwriter.WriteEndDocument() xwriter.Close()
You
find that productNames.xml contains only two entries: prodO and prod1 Which
XML output is produced by this code segment?
[A]
[B] prod0
prod1
[C] prod0 prod 1
[D] prod0 prod1
- You
are creating an XML Web service named DistributionService. This service must
be able to access and manipulate data in a table named Inventory in a
Microsoft SQL Server database.
Some functions within
DisttibutionService need the inventory data to be exposed as XML data. Other
functions within DistributionService nee the inventory data to be exposed as a
DataSet object.
You need to create the object that will provide this
data access.
Which object should you use?
[A]
XmlDocument
[B] XmlDocumentFragment
[C] XPathDocument
[D]
XmlDataDocument
- You
are creating an XML Web service named CustomerService. This service receives
an XML file of customer information in the following format:
1234
Adventure Works
2345 Coho Winery
You want to parse the
XML file to build a flat file that will be used by another application. The
flat file should be in the followIng format:
CustomerlD= 1234
CompanyName=Adventure Works
CustomerlD=2345 CompanyNanie=Coho
Winery
You write the following code:
Dim myXMLDoc As New
XmlDocument() myXMLDoc.Load("C:\TableSchemaXML.xml") Dim myRootNode As
XmlNode = myXMLDoc.FirstChild Dim customerOutput As String Dim curNode
As XmlNode Dim i As Integer You need to write the code that will parse
the document and build the customerOutput string that will be used to write
each row in the file.
Which code segment should you use?
[A] Dim
myNodeList As XmlNodeList = _
myRootNode.SelectNodes("/CustomerData/Customers")
For Each cw In
myNodeList If curNode.HasChildNodes Then customerOutput = ""
For i = 0 To curNode.ChildNodes.Count - 1 customerOutput =
curNode.ChildNodes(i).Name & _ "=" +
curNode.ChildNodes(i).InnerText ' to write the output file goes here.
Next i End If Next
[B] Dim myNodeList As XmlNodeList = _
myRootNode.SelectNodes("/CustomerData/Customers")
For Each curNode
In myNodeList If curNodeHasChildNodes Then customerOutput =
""
For i =0 To curNode.ChildNodes.Count - 1 customerOutput =
curNode.ChildNodes(i).Name & _ "=" + curNode.ChildNodes(i).Value
'Code to write the output file goes here. Next i End If
Next
[C] Dim myNodeList As XmlNodeList =
_ myRootNode.SelectNodes("/Customers")
For Each curNode In
myNodeList If curNode.HasChildNodes Then customerOutput = ""
For i = 0 To curNode.ChildNodes - 1 customerOutput =
curNode.ChildNodes(i).Name & _ "=" +
curNode.ChildNodes(i).InnerText ' to write the output file goes here.
Next i End If Next
[D] Dim myNodeList As XmlNodeList =
_ myRootNode.SelectNodes("/Customers")
For Each curNode In
myNodeList If curNode.HasChildNodes Then customerOutput =
""
For i =0 To curNode.CbildNodes.Count - 1 customerOulput =
curNode.ChildNodes(i) _ .Attributes(0).value + "=" & _
curNode.ChildNodes(i).Attributes(1).Value ' Code to write the output
file goes here. Next i End If Next
- You
create an XML Web service that calculates taxes. You deploy the service to a
production computer named Production. The URL of the production XML Web
service is http://Production/WSIFaxCalc.asmx.
The service does not
support all international tax rates. You want to find out which unsupported
tax rates are being requested by users. If a user requests a tax rate that is
not supported, the service records the request by using a trace message. You
want to view the unsupported rates that have been requested.
Which
two actions should you take? (Each correct answer presents part of the
solution. Choose two.)
[A] Modify the trace element in the Web.config
file of the service by setting the pageOutput attribute to "true"
[B]
Modify the trace element in the Weconfig file of the service by setting the
enabled attribute to "true".
[C] To the constructor of the TaxCalc
class, add the following code segment: Public Sub
New() InitializeComponent() Trace.AutoFlush = True End Sub
[D]
To the constructor of the TaxCalc class, add the following code
segment: Public Sub New() InitializeComponent() Trace.Flush() End
Sub
[E] View the page at http:/iPreduction/WS/FaxCalc.asmx.
[F]
View the page at http//ProductioniWS/Trace.axd.
Correct Answer 70 -
B-F
- You
create an XML Web service that uses an existing COM component. You implement
the service so that it does not return COM exceptiais to its callers. Instead,
the service translates the COM exceptions into more specific exception types
based on the HRESULT, as shown inthe following code
segment:
Try 'Code to call the COM component goes here. Catch cc
As COMException Select Case ce.ErrorCode Case &R80070005 Throw
New SecurityException("Access denied", ce) 'Additional case statements go
here. End Select End Try
You want to record the original COM
exception that was thrown.
What should you do?
[A] At the
beginning of the catch block, add the following code segment:
Console.WriteLine(" {O} COMException caught.", ce)
[B] At the
beginning of the catch block, add the following code segment:
Context.Trace.Write(ce, "COMException caught.")
[C] Within each
case statement, add the following code segment: ce.ToString()
[D]
Within each case statement, add the following code segment:
Console.WriteLine(" (0) COMException caught.",
ce.StackTrace)
Correct Answer 71 - B
- You
create an XML Web service that uses the Trace class to output error messages,
warning messages, and informational messages to a log file. The service uses a
TraceSwitch object to filter the trace output.
The DisplayName property
of the TraceSwitch object is "globalSwitch". On a development computer, all
trace output appears in the log file.
You move the service to a
production computer. You must configure the production XML Web service to
output only error messages to the log file.
What should you
do?
[A] To the Web.config file, add the following code segment:
[B] To the Weconfig file, add the following code segment:
[C]
To the Web.config file, add the following code segment:
[D] To the
Web.conflg file, add the following code segment:
Correct Answer 72 -
A
- You
are creating a .NET Remoting object. You want to add code to the object to log
error messages and warning messages. You want the log messages written to both
a log file and to the Windows application log.
Which code segment
should you use?
[A] Dim eventLog As New EventLog("remobj") Dim
fileLog As FileStream File.Create("remobj.log") Trace.WriteLine(eventLog,
"sample message") Trace.WriteLine(fileLog, "sample message")
[B] Dim
eventLog As New EventLog("remobj") Dim fileLog As FileStream =
File.Create("remobj.log") Trace.Write(eventLog)
Trace.Write(fileLog) Trace.WriteLine("sample message")
[C]
Trace.Listeners.Add(new
EventLogTraceListener("remobj")) Trace.Listeners.Add(new
TextFileTraceListener("remobj.log")) Trace.WriteLine("sample
message")
[D] Trace.Listeners.Add(new
EventLogTraceListener()) Trace.Listeners.Add(new
TextFileTraceListeser("remobj.log")) Trace.WriteLine("sample
message")
- You
are creating an XML Web service named Tracker to track orders for your
company. Tracker includes a Web method named OrderStatus for tracking the
status of individual orders. You anticipate that many client applications will
use the service. You want administrators Tracker to be able to monitor the
requests per second for OrderStatus.
Which code segment bould you
use?
[A] Dim counter As New PerformanceCounter("Tracker", "OrderStatus
req/sec", False)
[B] PerformanceCounterCategory.Create("Tracker",
"catogory", "OrderStatus req/sec", "req/sec")
[C] Dim counterData() As
CounterCreationData = {New CounterCreationData( _ "OrderStatus req/sec",
"help", PerformanceCounterType.RateOfCountsPerSecond32)} Dim collection As
New
CounterCreationDataCollection(counterData) PerformanceCounterCategoiy.Create("Tracker",
"Tracker performance counters", collection)
[D] Dim counterData() As
CounterCreationData = _ {New CounterCreationData("Int32",
"second",PerformanceCounterType.AverageTimer32)) Dim collection As New
CounterCreationDataCollection(counterData) PerformanceCounterCategory.Create("OrderStatus",
"requests per second", collection))
- 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 Weconfig 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.
Correct Answer 75 - C
- You create a Windows service named
FxListener that performs financial transactions by using files in a drop
directory. When a new XML file appears in the drop directory, FxListener opens
the file and performs the financial transaction contained within the XML
code.
You want updates to each XML file to be logged in the Windows
applieation log. A String object named myMessage contains the message to be
logged.
Which code segment should you use?
[A]
EventLog.WriteEntry("FxListener", myMessage)
[B] Dim log As New
EventLog("Application") log.WriteEntry(myMessage)
[C] Dim log As New
EventLog("Application") Trace.WriteLine(log, myMessage)
[D] Dim log
As New EventLog("FxListener") log.Source =
"Application" log.WriteEntry(myMessage,
EventLogEntryType.SuccessAudit)
- 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 creates it.
You discover
that when TimeService creates TimeServiceLog, it throws a
System.Security.SecurityException. The exception includes the 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 Services (IIS).
[D] Modify
the permissions for the
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog registry key to
give full control to the IUSR_computername user account.
Correct Answer
77 - A
- You
create an XML Web service named Service1 that exposes your company's inventory
data. This data is used by other companies to place orders. Service1 must
conform to existing formatting standards for inventory data.
You deploy
Service1. You discover that some client applications are rejecting your XML
formatting because the XML is inconsistent with the expected standard. You
want to debug this problem by tracing the XML responses.
What should
you do?
[A] In the Web.config file, enable tracing by setting the
enabled attribute of the trace element to "true".
[B] Inside each Web
method, use the Debug class to write the contents of the inherited
Context.Response property to a log file.
[C] Create a SOAP extension to
log the SoapMessageStage.AfterSeralize output to a log file.
[D] On
each Web method, use the SoapHeader attribute to map all SOAP headers to a
member variable for the Service1 class. Then use the Trace. WriteLine method
to log the headers to a log file.
- You
create a collection of serviced components that performs bank transfers. All
the components are marked with the Transaction(TransactionOption.Required)
attribute. All the methods in the components are marked with the
AutoComplete() attribute.
You discover that incorrect balance amounts are
being transferred. You decide to debug the components. During debugging, a
System. Runtime.InteropServices.COMException is thrown. The HRESULT for the
exception is 0x8004E002. The exception includes the following message: "The
root transaction wanted to commit, but transaction aborted."
You find
that this exception occurs only during the debugging session, and not when the
components run outside of the debugger. This exception is preventing you from
continuing to debug the components. You need to resolve this
problem.
What should you do?
[A] Remove the AutoComplete
attribute from each method. Within each method implementation, add calls to
the ContextUtil.SetComplete() and ContextUtil.SetAbort() methods.
[B]
Remove the AutoComplete attribute from each method. Within each method
implementations add calls to the ContextUtil.MyTransactionVote and
ContextUtil.DeactivateOnReturn properties.
[C] Increase the transaction
timeout in the Component Services tool by using the Properties dialog box for
My Computer.
[D] Replace each method implementation with the following
code segment:
Try 'The original method implementation goes
here. Finally ContextUtil.SetComplete() End Try
Correct Answer
79 - C
- You
create a .NET Remoting object named AdminService, which is hosted in Internet
Information Services (IIS). The object uses an HtlpChannel and a
BinaryFormatter. AdminService is in an assembly named AdminService.dll. The
URL for AdminService is http://LocalHost/AdminService/AS.rem. You write a test
console application named Tester.exe to test the AdminService interface.
Tester.exe includes the following code segment:
Module Tester Sub
Main() Dim service As New AdminService() End Sub End
Module
You write a configuration file for Tester.exe. The configuration
file is named Tester.exe.config and includes the following code
segment:
type="AdminService, AdniinService" />
You run
Tester. exe. The application immediately throws a
System.NullReferenceException. The exception includes the following message:
"Object reference not set to an instance of an object". You need to resolve
this exception.
What should you do?
[A] To the application
element of the Tester.exe.config file, add the following code
segment:
[B] Replace the use of the AdminService constructor in
Tester.exe with the following code segment: Dim o As Object o =
Activator. Createlnstance(GetType(AdminService)) service = CType(o,
AdminService)
[C] At the
beginning of the Main method in Tester.exe, add the following line of
code: RemotingConfiguration.Configure("Tester.exe.config")
[D]
Rename the configuration file from Tester.exe.config to
Tester.config.
- You
create an XML Web service that provides stock information to its customers.
You successfully test the service. You are now ready to deploy the service to
a new virtual directory on a production computer.
You want to deploy
the service without having to manually configure any settings on the
production computer.
Which deployment mechanism should you
use?
[A] FTP
[B] Xcopy command
[C] Web setup
project [D] Copy Project command
- You are creating an XML Web service
that processes credit card information. This service will be consumed by
computers that run on Microsoft Windows operating systems, as well as
computers that run on other operating systems.
You must ensure that
client credentials passed to the service are secure and cannot be compromised.
You are not as concerned with the length of time that Web method calls take to
maintain this level of security. You need to configure authentication for this
service.
Which type of authentication should you use?
[A] Basic
[B] Forms
[C]
Client Certificate
[D] Integrated Windows
Correct Answer 82 -
C
- You
are creating an XML Web service named InventoryService for a national
automobile dealership. Each branch of the dealership will build its own client
application to consume InventoryService. Each branch connects to the main
office of the dealership by using a virtual private network (VPN). All
computers in the Dealership run on Microsoft Windows operating
systems.
You need to ensure that callers of InventoryService are
authenticated based on their Windows logon name and password. You configure
Internet Information Services (IIS) according to your security needs. You need
to configure the authentication type in the Web.config file.
Which code
segment should you use?
[A]
[B]
[C]
[D]
Correct Answer 83 - D
- You
are preparing to deploy an XML Web service named InventoryService. This
service queries a Microsoft SQL Server database and returns information to the
callers. You use Visual Studio .NET to create a setup project. You need to
install InventoryService. You also need to run a script to create the
necessary SQL Server database and tables to store the data. To accomplish
this, you need to configure the project to have administrator rights to the
SQL Server database.
You add a custom dialog box to the project that
prompts the user for the administrator user name and password that are used to
connect to the SQL Server database. You need to make the user name and
password available to a custom Installer class that will execute the
script.
What should you do?
[A] Add a launch condition that
passes the user name and password to the Install subroutine.
[B] Add a
merge module to the project that captures the user name and password. Use the
merge module to access these values in the Install subroutine.
[C]
Retrieve the user name and password from the savedState object in the Install
subroutine.
[D] Create a custom install action. Set the
CustomActionData property to the entered user name and password. Then access
these values in the Install subroutine.
Correct Answer 84 - D
- You
create an XML Web service project that consists of three services earned
BronzeService, SilverService, and GoldService. All three services are located
in the same virtual directory on a production computer. When customers
subscribe to your services they select only one of the three available
services.
A new customer subscribes to SilverService. You need to
create a discovery document that enables this customer to use only
SilverService.
Which discovery document should you
create?
[A]
[B]
[C]
[D]
Correct Answer 85 - A
- You
create an XML Web service named myService. This service exposes a Web method
named MyMethod. You need to register myService in UDDI. First, you add a new
business name and a new tModel. You now need to list a valid access point to
myService.
Which URL should you use?
[A]
http://YourServer/AppPath/myService
[B]
http://YourServer/AppPath/myService?wsdl
[C] [D]
http://YourServer/AppPath/myService.asmx?MyMethod
Correct Answer 86 -
C
- You
are creating a Windows-based application named MyWinApp. To the application,
you add a Windows Form named MyForm and a reference to a SingleCall .NET
Remoting object named TheirObject.
You need to ensure that MyForm
creates an instance of TheirObject to make the necessary remote object
calls.
Which code segment should you use?
[A]
RemotingConfiguration.RegisterActivatedClientType( _ GetType(TheirObject),
"http://TheirServer/TheirAppPath/TheirObject.rem") Dim theirObject As New
TheirObject()
[B] RemotingConfiguration.RegisterWellKnownClientType( _
GetType(TheirObject),
"http:/ITheirServer/TheirAppPathlTheirObject.rem") Dim theirObject As New
TheirObject()
[C] RemotingConfiguration.RegisterActivatedServiceType( _
GetType(TheirObject)) Dim theirObject As New TheirObject()
[D]
RemotingConfiguration.RegisterWellKnownServiceType( _ GetType(TheirObject),
"http://TheirServer/TheirAppPath/TheirObject.rem", _
WellKnownObjectMode.Singleton) Dim theirObject As New
TheirObject()
Correct Answer 87 - B
- You
are creating a serviced component named MyComponent that will be distributed
to your customers. You are also creating a setup project that will register
the component in the global assembly cache on each customer's
computer.
You anticipate that there will be future updates to
MyComponent that you will provide to your customers. All updates to
MyComponent will be backward compatible. You will create similar setup
projects for each update of MyComponent that will register the updated
assembly in the global assembly cache.
You need to ensure that any
applications on your customers' computers that reference MyComponent use the
most recent version of the component.
Which action or actions should
you take? (Choose all that apply.)
[A]
[B] Compile MyComponent
as a satellite assembly.
[C] Include a publisher policy file that is
registered in the global assembly cache on your customers'
computers.
[D]
[E] Add an application configuration file to
MyComponent that includes assembly binding information that redirects prior
versions to the updated version.
Correct Answer 88 - A-C-D
- You
create version 1.0.0.0 of an assembly named MyAssembly. You register the
assembly in the global assembly cache. MyAssembly consists of two .NET
Remoting objects named MyRemoteObject1 and MyRemoteObject2. These objects are
configured in the App.config file of MyAssembly as shown in the following code
segment:
objectUri="MyRemoteObject2.rem" type="MyAssembly.MyRemoteObject2,
MyAssembly, Version=1 .0.0.0, Culture PublicKeyToken=28dckd83491duj"
/>
You create an application named MyApp that resides on a different
computer than MyAssembly. MyApp references version 1.0.0.0 of MyAssembly.
MyApp contains code that activates instances of MyRemoteObject1 and
MyRemoteObject2 to use their services. Due to changes in businses needs, you
must update MyAssembly. You create version 2.0.0.0 of MyAssembly, which is
backward compatible, but you do notupdate any information in the App.config
file of MyAssembly. You register version 2.0.0.0 of MyAssembly in the global
assembly cache. You then rebuild MyApp.
Which version of the remte
objects will MyApp activate?
[A] version 1.0.0.0 of MyRemoteObject1;
version 1.0.0.0 of MyRemoteObject2
[B] version 1.0.0.0 of
MyRemoteObject1; version 2.0.0.0 of MyRemoteObject2
[C] version 2.0.0.0
of MyRemoteObject1; version 1.0.0.0 of MyRemoteObject2
[D] version
2,0.0,0 of MyRemoteObject1; version 2.0.0.0 of MyRemoteObject2
Correct
Answer 89 - B
- You
have an application named MyApp that contains a reference to version 1.0.0.0
of a strongly named serviced component named FabrikamComponent. This component
is located in the bin directory of MyApp.
You receive version 2.0.0.0
of FabrikamComponent, which you install in the global assembly cache. You
reconfigure the application configuration file to redirect calls to version
2.0.0.0.
You now receive version 3.0.0.0 of FabrikamComponent, which
you install in the global assembly cache. You do not reeonfigwn the
application configuration file. You then run MyApp.
Which version of
FabrikamComponent is loaded and from which location is it loaded?
[A]
version 1.0.0.0 from the bin directory
[B] version 2.0.0.0 from the
global assembly cache
[C] version 2.0.0.0 from the bin
directory
[D] version 3.0.0.0 from the global assembly cache
- You
create a Windows service that processes XML messages placed in an MSMQ queue.
You discover that the service is not functioning properly. You need to debug
the service to correct the problem.
What should you do?
[A]
Start the Windows service. Then attach a debugger to the process.
[B]
Attach a debugger to the Windows service. Then start the Windows
service.
[C] Start the Windows service. Then run the .NET Services
Installation tool (Regsvcs.exe).
[D] Place a breakpoint in the Main
method of the Windows service. Then run the application within the Visual
Studio .NET integrated development environment (IDE).
Correct Answer
91 - A
- You
create a Windows service named myService that queries a table named Orders in
a Microsoft SQL Server database. You want myService to check every 30 seconds
for new rows in Orders.
You create the following method in
myService:
Private Sub ProcessOrders(ByVal source As Object, _ ByVal
eventArguments As Timers.ElapsedEventArgs) 'Code to process orders goes
here. End Sub
You need to add additional code to myService to
invoke the ProeessOrders method.
What should you do?
[A] To the
OnStart method, add the following code segment: Dim myTimer As New
Timers.Timer() AddHandler myTimer.Elapsed, AddressOfProcessOrders
myTimer.Interval = 30000 myTimer.Enabled = True
[B] To the
OnCustomCommand method, add the following code segment: Dim myTimer As New
Timers.Timer() AddHandler myTimer.Elapsed, AddressOfProcessOrders
myTimerinterval = 30000 myTimer.Enabled True
[C] To the OnStart
method, add the following code segment: Dim myTimer As New
Timers.Timer() AddHandler myTimer.Elapsed, AddressOfProcessOrders
myTimer.Interval = 30000 myTimer.AutoReset = True
[D] To the
OnCustomCommand method, add the following code segment: Dim myTimer As New
Timers.Timer() AddHandler myTimer.Elapsed, AddressOfProcessOrders
myThner.Interval = 30000 myTimer.AutoReset = True
- You
create three Windows services named myService1, myService2, and myService3.
You want to install all three services on a computer named Computer1 by using
the Installer tool (Installutil.exe).
On the command line of Computer1
enter and run the following command: Installutil myService1 myService2
myService3. During the installation process, myService3 throws an installation
error. The installation process completes.
How many of the three
services are now installed on Computer1?
[A] [B] [C] [D]
Correct Answer 93 - A
- You
are developing a Windows-based application that requires the use of a
calculation function named CalculateValue. This function includes the
following signature:
CalculateValue(x As Integer) as
Interger
CalculateValue is located in an unmanaged DLL named
UsefulFunctions.dll, and is not part of a COM interface. You need to be able
to use CalculateValue in your application. Your project directory contains a
copy of UsefulFunctions.dll.
While you are working in Debug mode, you
attempt to run your application. However, a System.DllNotFoundException is
thrown. Yon verify that you are using the correct function name. You also
verify that the code in the DLL exposes Calculatevalue. You have not modified
the project assembly, and you have not modified machine-level security. You
need to test your application immediately.
What should you
do?
[A] Move UsefulFunctions.dll to your project's bin
directory.
[B] Move UsefulFunctions.dll to your project's Debug
directory.
[C] Immediately before the declaration of CalculateValue,
add the following code segment:
[D] Immediately before the call to
CalculateValue, add the following code segment: Dim perm As New
SecurityPermission(SecurityPermissionFlag.UnmanagedCode) perm.Assert()
Correct
Answer 94 - D
- 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)
Correct Answer 95 -
A
- You
are using Visual Studio .NET to develop an application, You have a common
business logic component that was created in COM that you want to use until
you can replace it with Visual Studio .NET code You create the Visual Studio
.NET solution for the new application. You want to use the COM component in
your Visual Studio. NET solution.
What should you do?
[A]
Register the COM component by using Regsvr32
[B] [C] Use Visual
Studio .NET to add a reference to the COM component.
[D]
Correct Answer 96 - D
- You
create a serviced component named Trader that processes stock trades. Trader
uses multiple transactional data sources to verify and execute a stock trade.
The Trader class includes the following code segment:
Public Class
Trader Inherits ServicedComponent Public Sub PurchaseStock(ByVal c As
Customer, ByVal o As Order) 'Method implementation goes here. End
Sub End Class
You want to ensure that the PurchaseStock method
either successfully completes the trade or reliably aborts the
trade.
Which two actions should you take? (Each correct answer presents
part of the solution. Choose two.)
[A] Implement the ITransaction
interface in the Trader class.
[B] To the PurhaseStock method, add the
following attribute:
[C] To the Trader class, add the following
attribute:
[D] To the Trader class, add the following attribute:
[E] To the PurchaseStock method, add the following code segment:
If(ContextUtil.IslnTransaction) Then ContextUtil.SetComplete() End
If
Correct Answer 97 - B-C
- You
create an assembly that contains a collection of serviced components. You want
to secure these components by using a collection of COM+ roles. Different
groups of roles will secure different components.
You need to ensure
that role-based security is enforced in the assembly. You want to accomplish
this goal by adding an attribute to the project source code.
Which
attribute should you use? [A]
[B]
[C]
[D]
Correct Answer 98 - D
- You
create a serviced component named OrderStatus that is in an assembly named
NorthwindOrders. OrdcStatus is in its own COM+ application named Northwind
Traders.
OrderStatus is used by multiple client applications to look up
the status of orders. Because you anticipate that client applications will
frequently access OrderStatus, you need to ensure that the method calls are
processed as quickly as possible.
What should you do?
[A]
Configure OrderStatus to require a transaction.
[B] Configure Northwind
Traders to be a library application.
[C] Add the AutoComplete attribute
to all methods in OrderStatus.
[D] Configure NorthwindOrders to be a
shared assembly, and install it in the global assembly cache.
Correct
Answer 99 - B
- You
are preparing to deploy a serviced component named ProductAvailability. This
con will be used by multiple client applications to look up the current
availability of products. Some of these client applications were written by
other developers and are installed on computers at other locations.
You
need to maximize the security on the deployment computer. You want to
configure the component's COM+ application to run under a restricted user
account named OutsideUser.
What should you do?
[A] Implement the
ISecurity interface in ProductAvailability.
[B] Use the Component
Services tool to manually set the Identity property of the COM+ application to
OutsideUser.
[C] To the ProductAvailability assembly, add the following
attributes: ImpersonationLevelOption.Impersonate)>
[D] To the
ProductAvailability assembly, add the following attributes:
ImpersonationLevelOption.Identify)> <ASSEMBLY:APPLICATIONNAME("OUTSIDEUSER")
Correct
Answer 100 – B
- You
create two serviced components named OrderPipeline and OrderAdmin. Each
component is registered in a separate COM+ server application. Both components
use pricing data. OrderPipeline reads the pricing data for placing user
orders. OrderAdmin modifies the pricing data.
You want to ensure that
OrderPipeline accesses the pricing data as quickly as possible, while still
being able to immediately retrieve any pricing changes made by
OrderAdmin.
What should you do?
[A] Store the pricing data in
the Shared Property Manager.
[B] Store the pricing data in a Microsoft
SQL Server database.
[C] Store the pricing data in a Hashtabie object
within OrderAdmin. Expose the Hashtable object through a property on
OrderAdmin.
[D] Store the pricing data in an XmlDocuznent object within
OrderAdmin. Expose the XmlDocument object through a property on
OrderAdmin.
Correct Answer 101 - C
- You create a queued component named
OrderProcess that implements an interface named lOrderProcess. OrderProcess
and lOrderProcess are both in the Proseware namespace.
lOrderProcess
inchtdes the following code segment:
Public Interface
IOrdexProcess Sub PlaceOrder(ByVal account As Account, _ ByVal items As
ItemList) End Interface
You have an Account object named account and
an ItemList object named items. You need to write code to use OrderProcess to
place an order.
Which code segment should you use?
[A] Dim order
AS Proseware.IOrderProcess; order = New Proseware.OrderProcess()
order.PlaceOrder(account, items)
[B] Dim order As
Proseware.IOrderProcess Dim t As Type Dim temp As Object t
GetType(Proseware.OrderProcess) temp = Activator.CreateInstance(t)
order = CType(temp, Proseware.IOrderProcess) order.PlaceOrder(account,
items)
[C] Dim order As Proseware.IOrderProcess Dim temp As Object
temp = Marshal.BindToMoniker( _ "queued:/new:Proseware.OrderProcess")
order = CType(temp, Proseware.IOrderProcess) order.PlaceOrder(account,
items)
[D] Dim t As Type Dim a As Assembly Dim temp As
Object Dim order As Proseware, IOrderProcess t =
GetType(Proseware.IOrderProcess) a = Assembly.GetAssembly(t) temp =
a.Createlnstance( orders, _ CType(temp, Proseware.IOrderProcess)
order.PlaceOrder(account, items)
Correct Answer 102 - C
- You are creating a serviced component
named Itemlnventory. An online catalog application will use Itemlnventory to
display the availability of products in inventory. Additional serviced
components written by other developers will continuously update the inventory
data as orders are placed. The Itemlnventory class includes the following code
segment:
Public Class Itemlnventory Inherits
ServicedComponent 'Method code goes here. End Class Iteminventory is
configured to require transactions. You want Iteminventory to respond to
requests as quickly as possible, even if that means displaying inventory
values that are not up to date with the most recent orders.
What should
you do?
[A] To the Iteminventory class, add the following
attribute:
[B] To all methods of the Itemlnventory class, add the
following attribute:
[C] Modify the Transaction attribute of the
Itemlnventory class to be the following attribute:
[D] Modify the
Transaction attribute of the Itemlnventory class to be the following
attribute:
IsolationLevel:=
TransactionlsolationLevel.ReadUncommitted)>
- You
are creating a strongly named assembly. This assembly inquires a unique name
so it can be identified for security purposes. You run the following
command-line tools:
sn -k myKey.snk gacutil.exe /i myDll.dll · ·
· · · Gacutil.exe terminates, and you receive the following error message:
'Pailure adding assembly to the cache: Attempt to install an assembly without
a strong name. You need to cerrect ibis problem.
What should you
do?
[A] Run A1.exe with the /delay+ option.
[B] Run sn -I to
load the key file into the Cryptographic Service Provider.
[C] Insert
an AssemblyKeyFile attribute into the assembly to reference
myKey.snk.
[D] Insert an AssemblyKeyName attribute into the assembly to
reference the assembly name.
- You
create a .NET Remoting object named ChatServer. ChatServer is the central
server for a group of chat client applications. Client applications send
string chat messages to ChatServer. ChatServer then broadcasts each message to
all registered chat client applications. ChatServer uses an HTTP remoting
channel to communicate with the client applications.
The ChatServer
class in the following code segment:
The event class code follows.
Serializable( _ Public Class SubmissionEventArgs Inherits
EventArgs
Public Property User() As String 'Property code goes
here. End Property
Public Property Messsge() As String 'Property
code goes beta. End Property
'Remaining implementation goes here.
End Class
'The delegate code follows. Public Delegate Sub
SubmissionEventHandler( _ ByVal sender As Object, _ ByVal
submissionArgs As SubmissionEventArgs)
' The event code follows'
appears within the ChatServer class.
Public Event
SubmissionEventHandler( _ ByVal sender As Object, _ ByVal submissionArgs
As SubmissionEventArgs)
You need to write a client application that
includes a class named ChatClient to communicate with ChatServer. You want
ChatClient to send and display chat messages.
What should you
do?
[A] Implement the IDeserializationCallback interface in ChatClient.
Implement an event handler for the Submission event.
[B] Derive
ChatClient from System.Object. Implement the ISerializable interface.
Implement an event handler for the Submission event. [C] Implement the
ISerializable interface in ChatClient. Implement an event handler for the
Submission event. Host ChatClient in Internet Information Services (IIS) by
using a Web.config file.
[D] Derive ChatClient from MarshalByRefObject.
Implement an event handler for the Submission event. Configure ChatClient to
listen on an HttpChannel.
- You
are creating a .NET Remoting object named PropertyCache. PropertyCache will
hold a Hashtable object of name/value pairs.
A variety of remote client
applications 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 PropertyCache to be a client-activated
object.
[B] Configure PropertyCache to be a server-activated Singleton
object.
[C] Configure PropertyCache to be a server-activated SingleCall
object.
[D] Derive the PropertyCache class from MarshalByRelObject and
overide InitializeLifetimeService() to return null.
[E] Mark the
PropertyCache class with the Serializable attribut Implement the ISponsor
interface in the PropertyCache class.
[F] Implement the ISerializable
and ILease interfaces in the PropertyCache class. Implement
ILease.CurrentLeaseTime to return Int32.MaxValue.
- You
are creating a .NET Remoting object named BankOps. BankDps exposes methods for
creating, fmding, and modifying objects in a class named BankCustomer.
BankCustomer has a large number oftead/write properties.
You expect a
large number of remote client applications to frequently connect to BankOps.
You expect these remote client applications to use many of the BankCustomer
properties. You wantto ensure that network traffic is minimized. What
should you do?
[A] Add the Serializable attribute to the BankCustomer
class.
[B] Implement the IDisposable interface in the BankCustomer
class.
[C] Derive the BankCustomer class from
ContextBoundObject
[D] Derive the BankCustomer class from
MarshalByRefObject Override the inherited InitializeLifetimeService method
to return null.
Correct Answer 107 - A
- You
create a .NET Remoting object named DocumestStore. DocumentStore is a
server-activated Singleton object It uses a TcpChannel to listen on port 9000.
The object URI for DocumentStore is DocumentStore.
You need to write a
client application to use DocumentStore from a computer named
Production.
Which code segment should you use?
[A]
RemotingConfiguration.Configure( _
"tcp://Production:9000/DocumentStore") Dim doc As New
DocumentStore()
[B] Dim t As Type t =
GetType(DocumentStore) RemotingConfiguration.RegisterWellKnownClientType( _
t, "TcpChannel,9000,Production") Dim doc As New
DocumentStore()
[C] Dim t As Type Dim temp As Object Dim doc As
DocumentStore t = GetType(DocumentStore) temp =
Activator.CreateInstance(t, _
"tcp://Production: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,
"Production") doc = CType(temp, DocumentStore) Correct Answer 108 - D
- You
have a .NET Remoting object named Utils. The Utils class is a client-activated
.NET Remoting object. You want to write a client application that creates and
uses a Utils object. You want the client application to hold onto a reference
to a Utils object for the duration of its execution.
What should you
do?
[A] Construct the Utils object, and hold the object in a member
variable.
[B] Construct the Utils object, and set the
LifetimeServices.LeaseTime to 0.
[C] In the client application, create
an implementation of the ISponsor interface. Implement the Renewal method to
extend the lease.
[D] In the client application, create an
implementation of the ILease interface. Implement the CurrentLeaseTime pm to
return Int32.MaxValue.
Correct Answer 109 - C
- You
are creating a .NET Remoting object named Payroll. The Payroll class allows
remote client applications to access payroll data for your company. Client
applications are developed by using Windows Forms and Web Forms
You
must ensure that remote client applications are securely authenticated prior
to gaining access to Payroll objects. You want to accomplish this task by
writing the minimum amount of code.
What should you do?
[A] Use
a TcpChannel and a BinaryFormatter for the Payroll class.
[B] Use an
HttpChannel and a SoapFormatter for the Payroll class.
[C] Host the
Payroll class in Internet Information Services (IIS) and implement Basic
authentication.
[D] Host the Payroll class in Internet Information
Services (IIS) and implement Integrated Windows authentication.
Correct
Answer 110 - D
- You
have a .NET Remoting object named Scheduler. The Scheduler class is in an
assembly file named TaskScheduler.dll. The Scheduler class is hosted by an
application named SchedulerServer.exc. This application is configured by using
a file named SchedulerServer.exe.conflg. This file configures the Scheduler
class to baa client-activated object by using a TcpChannel and a
BinaryFormatter.
You want to deploy the Scheduler object to a computer
named Computer1 so that client applications can begin to use it. You copy
TaskScheduler.dll, SchedulerServer.exe, and SchedulerSirver.exe.config to a
directory on Computer1.
What should you do next?
[A] Install
TaskScheduler.dll in the global assembly cache.
[B] Use the Assembly
Registration tool (Regasm.exe) on Computer1 to register
SchedulerServer.exe.
[C] Use the Assembly Registration tool
(Regasm.exe) on Computer1 to register TaskScheduler.dll.
[D] Configure
Computer1 to execute SchedulerService each time Computer1 is restarted. Then
manually execute SchedulerServer.exe on Computer1.
Correct Answer 111 -
D
- You
create a .NET Remoting object named Time. The Time class is in the Utils
namespace and is in an assembly file named Fabrikam.dll. The Time class is
hosted in an Internet Information Services (IIS) virtual directory named
UtilsSvr. The Time class is configured to be a server-activated object and
uses a URI named Time.rem.
You use a client application named Testexe
to test the Time object Test.exe creates instances of the Time object by using
the following method signature:
Public Function Createinstance() As
Time RemotingConfiguration.Configure("Test.exe.config") Return New
Time() End Function
You want Testexe to create instances of the Time
class on a computer named Hosting. What should you do? [A] Create a
Test.exe.config file that includes the following code segment:
url="tcp://Hosting:8O/UtilsSvr/Time.rem"/>
[B] Create a
Test.exe.config file that includes the following code segment:
url="http:/IHostinglUtilsSvrlTime.rem"/>
[C] Create a
Testexe.config file that includes the following code segment:
[D]
Create a Test.exe.config file that includes the following code segment:
- You
create an XML Web service named AutoPartsService that processes automobile
part orders. This service exposes a Web method named PlaceOrder, which is
shown in the following code segment:
Public Function PlaceOrder(ByVal
orderData As DataSet) As DataSet Dim brakes As New
Server1.BrakesService() Dim parts As New
Server2.PartsService()
'Call OrderBrakes to order only brakes.
brakes.OrderBrakes(orderData.Tables("Brakes"))
'Call OrderParts to
order all other auto
parts. parts.OrderParts(orderData.Tables("Parts") End
Function
BrakesService and PartsService are XML Web services. The
TransactionOption property of Oiderflreaks and OrderParts is set to
TransactionOption.Required.
You develop a Windows Forms application
named MyPartOrderApp that consumes AutoPartsService. You run MyPartOrderApp
and place an order for three sets of brakes and four wheels. While PlaceOrder
is placing the order for The wheels, you close MyPartOrderApp.
What is
the most likely result?
[A] OrderParts stops processing the order, and
all orders are cancelled.
[B] OrderParts continues processing the
order, and all orders are placed.
[C] OrderParts stops processing the
order, the brakes are ordered, but the wheels are not ordered.
[D]
OrderParts stops processing the order; the brakes are not ordered, but the
wheels are ordered
Correct Answer 113 - B
- You
are creating an XML Web service named ShoppingCartService. All requests made
to Web methods of ShoppingCartService require that callers present a valid key
as input. This key indicates that the user has been authenticated to make
ShoppingCartService requests. To obtain a valid key, the callers must first
call GetKey.
You write the following code segment. (Line numbers are
included for reference only.)
01 _ 02 Public Function (SetKey(ByVal
caller As String) As String 03 Dim key As String 04 If Not Context.
Session("key") Is Nothing 05 key Context.Session("key") 06 Return
key 07 Else 08 Dim isAuthenticated As Boolean 09 ' Code to validate
the caller goes here. 10 If isAuthenticated Then 11 ' Code to generate
"key" goes here. 12 Context.Session("key") = key 13 Return key 14
Else 15 Throw New Exception("User not authenticated") 16 End If 17
End If 18 End Function
You run the code, and an exception is thrown
on line 04. You want this code to run without exceptions.
What should
you no?
[A] Delete lines 04 through 07 and delete line 17.
[B]
Delete "Context." from lines 04, 05, and 12.
[C] [D] Correct
Answer 114 - C
- You
are creating an XML Web service that provides a daily quotation from literary
works to its customers. This quotation is requested in many different
languages, thousands of times every day, and by thousands of Web sites
operating on many different platforms.
A Web method named GetQuotes
takes a language ID as input. GetQuotes uses this language ID to retrieve a
translated version of the daily quotation from a Microsoft SQL Server database
and to return that quotation to the customer.
You want to minimize the
time that it takes to return the translated version. What should you
do?
[A] Store each translated quotation by using the Cache
object
[B] Store each translated quotation by using the Session
object.
[C] Set the BufferResponse property of the WebMethod attribute
to false. [D] Set the CacheDuration property of the WebMethod attribute to
an interval greater than zero.
Correct Answer 115 - A
- You
are creating an XML Web service named TransferService to process the transfer
of money from a bank account at Bankl to a bank account at Bank2.
TransferService contains a Web method named SaveTransfer.
SaveTransfer
includes the following code
segment:
TransactionOption:=TransactionOption.Required)> _ Public
Function SaveTransfer(ByVal transferData As DataSet) As DataSet Dim bank1
As New Bank1Server.Bank1Service() Dim bank2 As New
Bank2Server.Bank2Service() Bank1(.RemoveMoney(transferData)) bank2.AddMoney(transferData) 'Code
to record transaction in database goes here. End
Function
RemoveMoney removes the funds from the bank account at Bank1.
AddMoaey adds the funds to the bank account at Bank2. SaveTransfer then
records the transaction in a local Microsoft SQL Server database.
The
TransactionOption property of AddMoney is set to TransactionOption.Required.
The TransactionOption property of RemoveMoney is set to
TransactionOption.RequiresNew.
In a test application, you invoke
SaveTransfer. When SaveTransfer is invoked, the money is removed from Bank 1
and added to Bank2. However, an exception is thrown when SaveTransfer attempts
to record this transaction in the local database. No exception- handling code
catches this exception.
How are transactions in each Web service
affected by this exception?
[A] All transactions are rolled
back.
[B] Transactions in only SaveTransfer and AddMoney are rolled
back. Transactions in only RemoveMoney remain committed.
[C]
Transactions in only AddMoney and RemoveMoney are rolled back. Transactions in
only SaveTransfer remain committed.
[D] Transactions in only
SaveTransfer are rolled back. Transactions in only AddMoney and RemoveMoney
remain committed.
Correct Answer 116 - D
- You
develop an ASP.NET application that consumes an XML Web service named
CounterService. CounterService contains two Web methods named
UpdateSessCounter and UpdataAppCounter.
UpdateSessCounter has session
state enabled. UpdateAppCounter does not have session state enabled. Each time
that UpdateSessCounter is invoked, the value 1 is added to a session item
named HitCounter and the new value of HitCounter is returned.
Each time
that UpdateAppCounter is invoked, the value 1 is added to an application item
named HitCounter and the new value of HitCounter is returned. You create a Web
Form that haS two buttons, ButtonSess and ButtonApp, and two labels, LabelSess
and LabelApp. The Click event of ButtonSess invokes UpdateSeasCounter. The
Click event of ButtonApp invokes UpdateAppCounter.
The Web Form's
code-behind file includes the following code segment:
Private Sub
ButtonSess_Click(ByVaI sender As _ System.Object, ByVal e As
System.EventArgs) _ Handles ButtonSess.Click Dim service As New
RemoteServer.CounterService() LabelSess.Text =
CStr(service.UpdateSessCounter()) End Sub
Private Sub
ButtonApp_Click(ByVal sender As _ SystemA)bject ByVal e As
System.EventArgs) _ Handles ButtonApp.Click Dim service As New
RemoteServer.CounterService() LabelA =
CStr(service.UpdateAppCounter() End Sub
You run the application, and
click ButtonSess 50 times and click ButtonApp 50 times.
What are the
resulting values of LabelSess.Text and LabelApp.Text?
[A]
LabelSess.Text = 1; LabelApp.Text = 1
[B] LabelSess.Text = 1;
LabelApp.Text =50
[C] LabelSess.Text = 50; LabeL&pp.Text =
1
[D] LabelSess.Text = 50; LabelApp.Text =50
- You
are creating an XML Web service named WeatherService that provides the current
weather conditions for cities around the world. Your development cycle
includes three stages: development, testing, and production. In each stage,
WeatherService will be deployed on a different server.
For testing, you
create an ASP.NET application named WeatherTest. To WeatherTest, you add a Web
reference to WeatherService. You then build a user interface and add the
necessary code to test the service.
The WeatherService interface will
not change between testing and deployment. You want to ensure that you do not
have to recompile WeatherTest every time WeatherService is moved from one
server to another.
What should you do?
[A] Each time
WeatherService is moved, set the URL property of the generated proxy class to
the new location.
[B] Each time WeatherService is moved, set the Web
Reference URL property of the generated proxy class to the new
location. [C] Set the URLBehavior property of the generated proxy class to
dynamic. Each time WeatherService is moved, update the appropriate key in the
Web.config file to indicate the new location.
[D] Take the location of
WeatherService as input to WeatherTest, and set the Proxy property of all
proxy class instances to that location.
Correct Answer 118 - C
- You are creating an XML Web service
named StockService. The service contains a Web method named RetrieveStockinfo.
RetrieveStocldnfo takes as input a stock symbol and returns a DataSet object
that contains information about that stock. You want to capture all incoming
SOAP messages in RetrieveStockinfo and write the messages to a file for future
processing.
What should you do?
[A] Enable sessions in
RetrieveStocklnfo.
[B] Create a SOAP extension for
RetrieveStocklnfo.
[C] Apply a SoapHeader attribute to
RetrieveStocklnfo.
[D] Apply a SoapRpcMethod attribute to
RetrieveStocklnfo.
Correct Answer 119 - B
- You
are creating an XML Web service named TradeService that processes stock
transactions. TradeService exposes a Web method named BuyStock that takes as
input a stock symbol and the number of shares to buy.
You know that
callers who consume this service will require that SOAP messages be formatted
as document-literal SOAP messages or RPC-encoded SOAP messages.
You
need to create a solution that will return both types of SOAP messages. You
want to accomplish this task by writing the minimum amount of
code.
Which code segment should you use?
[A] Public Function
BuyStock(ByVal symbol As String, _ ByVal shares As Integer) As
String
[B] _ Public Function BuyStock(ByVal symbol As String, _
ByVal shares As Integer) As String
[C] _ Public Function
BuyStock(ByVal Val symbol As String, _ ByVal shares As Integer) As
String
[D] _ Public Function BuyStockRpc(ByVal symbol As String,
_ ByVal shares As Integer) As String
Public Function
BuyStockDoc(ByVal symbol As String, ByVal shares As Integer) As
String
Correct Answer 120 - D
- You create an XML Web service named
WeatherService. This service contains a Web method named RetrieveWeather.
Retrieve Weather takes as input a city name and returns the current weather
conditions for that city. You need to provide callers of this service with the
URL they need to issue an HTF P-GET against WeatherService.
Which URL
should you provide?
[A]
http://ServerName/AppPath/WeatherService.asmx/cityname=somecity
[B]
http://ServerName/AppPath/WeatherService.asmxl/RetrieveWeather?cityname=somecity
[C]
http://ServerName/AppPath/WeatherService/RetrieveWeather.asmx?cityname=somecity
[D]
http://ServerName/AppPathlWeatherService/RetrieveWeath&cityname=somecity
Correct
Answer 121 - B
- You are creating an XML Web service
that tracks employee information. The service contains a Web method named
RetrieveEmployees. The service also contains a base class named Employee and
two classes named Manager and Engineer, which are derived from
Employee.
RetrieveEmployees takes a role ID as input that specifies the
type of employee to retrieve, either Manager or Engineer. RetrieveEmployees
returns an array of type Employee that contains all employees that are in the
specified role.
You want to ensure that Manager and Engineer object
types can be returned from RetrieveEmployees.
What should you
do?
[A] Set the TypeName property of the XmlType attribute to Employee
for both Manager and Engineer.
[B] Apply two XmlInclude attributes to
RetrieveEmployees, one of type Manager and one of type Engineer.
[C]
Apply an XmlRoot attribute to the Employee class. Apply an XmlAtlribute
attribute to the Manager and engineer classes.
[D] Apply an XmlRoot
attribute to the Employee class. Apply an XmlElement attribute to the Manager
and Engineer classes.
Correct Answer 122 - B
- You
are developing an ASP.NET application named MySportApp. This application
contains a Web Form named SportsPage.aspx that displays sports data to its
users. You obtain the sports data to display from an XML Web service named
SportsService, which is registered in UDDI.
If calls to SportsService
fail, you will have no sports data to display in MySportApp. To prevent this,
the company that hosts SportsService has configured the service to run on a
backup server if the primary server is unavailable.
You write code in
SportsPage.aspx that interacts with UDDI at run time and detects any change in
the location of SportsService. This code returns the new location of
SportsService. You must then ensure that future calls to SportsService are
directed to this new location.
What should you do?
[A] Set the
URL property of the UDDI Inquire object to the new server location.
[B]
Set the AccessPoint property of the UDDI BindingTemplate object to the new
server location.
[C] Set the URL property of all SportsService proxy
class instances to the new server location.
[D] Set the URLBehavior
property of the generated SportsService proxy class to dynamic, and update the
appropriate key in the Web.config file.
Correct Answer 123 - C
- 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 is thrown.
You create an ASP.NET application named
MyPhoneBook that contains a Web reference to PhoneNumberService. You need to
wrap any calls made to PhoneNumberService in a try/catch block to catch any
PhoneNumberException 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 SoapException 'Handle the
exception. End Try
[B] Try 'Code to call PhoneNumberService
method goes here. Catch ex As SoapHeaderException 'Handle the
exception. End Try
[C] Try 'Code to call PhoneNumberService
method goes here. Catch ex As Exception 'Handle the exception. End
Try
[D] Try 'Code to call PhoneNumberService method goes
here. Catch ex As ApplicationException 'Handle the exception. End
Try Correct Answer 124 - C-D
- You
are creating an XML Web service named InventoryService for a nationwide
clothing retailer. The service provides near real time inventory information
to individual store managers by using a virtual private network
(VPN).
InventoryService exposes a Web method named Retrieveinventory
that returns inventory information to the caller. You configure Internet
Information Services (IIS) and InventoryService to use Integrated Windows
authentication.
You need to write code in InventoryService to ensure
that only members of the Manager group can access
Retrievelnventory
What should you do?
[A] To the section of the
Web.config file, add the following element:
[B] To the section of the
Weconfig file, add the following element:
[C] In Retrievelnventory, add
the following code segment: If User.Identity.Name.Equals("Manager") Then
'Code to retrieve inventory data goes here. End If
[D] In
Retrievelnventoiy, add the following code segment: If
User.Identity.AuthenticationType.Equals("Manager") Then 'Code to retrieve
inventory data goes here. End If
Correct Answer 125 - A
- You
are creating a .NET Remoting object named Dealer for an automobile dealership.
Dealer exposes a method named SaveSales that saves sales information for the
dealership. Dealer is configured to use Integrated Windows authentication to
authenticate its callers. You must ensure that all users of SaveSales are
members of the Manager group before allowing the code within SaveSales to
run.
Which code segment should you use?
[A] _ Public
Function SaveSales(ByVal sales As DataSet) As DataSet 'Code to save sales
data goes here. End Function
[B] _ Public Function
SaveSales(ByVal sales As DataSet) As DataSet 'Code to save sales data goes
here. End Function
[C] _ Public Function SaveSales(ByVal sales
As DataSet) As DataSet 'Code to save sales data goes here. End
Function
[D] Public Function SaveSales(ByVal sales As DataSet) As
DataSet Dim role As String = "Manager" Dim principalPerm As New
PrincipalPermission(Nothing, role) 'Code to save sales data goes here.
End Function
Correct Answer 126 - A
- You
are creating an XML Web service named A that is available only on your
company's intranet. The service exposes a Web method named Close that updates
the status of open woth orders to "closed."
You configure
ApproveService to use only Integrated Windows authentication. You must ensure
that access to specific functionality within the service is based on a user's
membership in specific Windows groups. You want to accomplish this by using
role-based security.
You want to allow all members of the Reviewers
group and of the Admins group to be able to execute the Close method without
creating a third group that contains members 1mm both groups.
Which
code segment should you use?
[A] (SecurityAction.Demand,
Role:="Reviewers, Admins")> _ Public Sub Close() 'Code for the Close
method goes here. End Sub
[B] (SecurityAction.Demand,
Role:="Reviewers", Role:="Admins")> Public Sub Close() 'Code for the
Close method goes here. End Sub
[C] Public Sub Close() Dim
myPermission1 As New PrincipalPermission(Nothing, "Reviewers") Dim
myPermission2 As New PrincipalPermission(Nothing,
"Adimins") myPermission1.Demand() myPermission2.Demand() 'Code for
the Close method goes here. End Sub
[D] Public Sub Close() Dim
myPermission As New PrincipalPermission(Nothing, "Reviewers",
"Admins") myPermission.Demand() 'Code for the Close method goes here.
End Sub
Correct Answer 127 - B
- You
are creating a Visual Studio .NET assembly, which will run as a shared
assembly with other applications. The assembly will be installed *fl the
global assembly cache. You will distribute the assembly to many customers
outside your company.
You must ensure that each customer receives your
assembly without alteration, in a way that reliably specifies the origin of
the code.
What should you do?
[A] Sign the assembly by using a
strong name. Do nothing further.
[B] Sign the assembly by using File
Signing tool (Signcode.exe). Do nothing further.
[C] First sign the
assembly by using a strong name. Then sign the assembly by using File Signing
tool (Signcode.exe).
[D] First sign the assembly by using File Signing
tool (Signcode.exe). Then sign the assembly by using a strong
name.
Correct Answer 128 - C
- You
are creating an XML Web service named ViewOrders that is available to
customers over the Internet. ViewOrders exposes a Web method named
ViewShippingDetail that requires additional security. You decide to use
generic role-based security to secure ViewShippingDetail.
You need to
write code to ensure that once the caller is authenticated, a user identity
named Generic is created. This user identity has membership in a group named
Shipping to allow access to ViewShippingDetail.
Which code segment
should you use?
[A] Dim myIdentity As IIdentity = New
GenericIdentity("Generic", "Custom") Dim Roles As String() =
{"Shipping"} Dim myPrincipal = New GenericPrincipal(myIdentity, Roles)
myIdentity = WindowsIdentity.GetCurrent
[B] Dim myIdentity As
GenericIdentity = New GenericIdentity("Generic", "Custom") Dim Roles As
String() = {"Shipping"} Dim myPrincipal = New GenericPrincipal(myIdentity,
Roles) Thread.CurrentPrincipal = myPrincipal
[C] Dim myIdentity As
IIdentity = New Generic {"Shipping"} Dim myPrincipal As IPrincipal = New
WindowsPrincipal(myIdentity) Thread.CurrentPrincipal =
myPrincipal
[D] Dim myGenericIdent As IIdentity = New
GenericIdentity("Generic", "Custom") Dim myId As WindowsIdentity =
myGenericIdent Dim Roles As String() = {"Shipping"} Dim myPrincipal =
New GenericPrincipal(myIdentity, Roles) Windows
Correct Answer 129 -
B
- You
are creating an XIvIL Web service named myWebService that is available only on
your company's intranet. Callers of myWebService must be authenticated before
they can access any Web methods within the service.
You configure
Internet Information Services (IIS) and myWebService to use Integrated Windows
authentication. You want to use the Windows groups associated with the callers
to authorize access to the Web methods. You need to add cede to the Web.config
file to accomplish this goal.
Which code segment should you
use?
[A]
[B]
[C]
[D] Correct Answer 130 -
A
- You
are creating an XML Web service that will be accessed by callers who cannot
use SSL encryption because of firewall restrictions. To protect sensitive
data, you want to encrypt a portion of the data returned from the service by
using objects in the Cryptography namespace.
The service will use a
standard encryption routine to encrypt the data befbre it is sent to the
caller. The caller will decrypt the data by using instructions provided by
you. You need to write code to encrypt the sensitive data that is in a local
variable named myData. First, you create an instance of a Cryptography Service
Provider.
What should you do next?
[A] Create an Encryptor
object that passes in a key and an initialization vector (IV) as parameters.
Call the GetHashCode method of the Enryptor object to generate a new hash
code; Convert the generated hash code to a stream and use the CryptoStream
object to write the value of the hash cede to an encrypted stream. Convert the
output stream to a string.
[B] Create a UnicodeEncoding object and use
It to encode the value of myData into a byte array. Use the ComputeHash method
of the Cryptography Service Provider to create a hash from the encoded byte
array. Convert the output of ComputeHash from a byte array to a
string.
[C] Create a UnicodeEncoding object and use it to encode the
value of myData into a byte array. Use the GetHashCode method of the
Cryptography Service Provider to create a hash from the encoded byte array.
Convert the output of GetHashCode from a byte array to a string.
[D]
Create an Encryptor object that passes in a key and an initialization vector
(IV) as parameters. Create a CryptoStream object that passes in an output
stream and the Encryptor object as parameters. Convert myData to a stream and
use the CryptoStream object to write the value of myData to an encrypted
stream. Convert the output stream to a string.
Correct Answer 131 -
D
- You
are developing a COM+ application named ContosoLib that contains a serviced
component to manage student grades. This component exposes a method named
AssignGrade that assigns a grade to a student for a specified
class.
You create a.COM+ role named Instructor. You must ensure that
only members of the COM+ Instructor role are allowed to change grades by using
this method.
What should you do?
[A] To the AssignGrade method,
add the following attribute:
[B] To the AssignGrade method, add the
following attribute:
[C] To the AssignGrade method, add the following
code segment: Dim sc As
SecurityCallContext SecurityCallContext.CurrentCall If
sDirectCaller.AccountName = "Instructor" Then 'Execute assign grade logic
Else 'Throw an exception. End If
[D] To the AssignGrade
method, add the following code segment: If
ThreaCurrentPrincipal.IsInRole("Instructor") Then 'Execute assign grade
logic. Else Throw an exception. End If
Correct Answer 132 -
B
- You
develop an application that uses a Windows Form, a Microsoft SQL Server
database, and several database components. You want to restrict users from
writing their own applications to access your application's database
components.
You need to configure your database component assemblies to
accomplish this goal.
What should you do?
[A] Apply the
StrongNameldentityPermission attribute, and specify SecurityAction.LinkDemand.
Set the PublicKey property to the public key of the key file you use to sign
your application's assemblies.
[B] Apply the
StrongNameldentityPermission attribute, and specify
SecurityAction.RequestMinimum. Set the PublicKey property to the public key of
the key file you use to sign your application's assemblies.
[C] Apply
the PublisherldentityPermission attribute, and specify
SecurityAction.Deny.
[D] Apply the PublisherldentityPermission
attribute, and specify SecurityAction.RequestMinimum.
Correct Answer
133 - B
- Your
Microsoft SQL Server database has a stored procedure named GetCompanyNarne.
GetCompanyName accepts one parameter named @CustomerlD and returns the
appropriate company name.
You instantiate a SqlCommand object named
myCommand. You need to initialize myCommand to return the company name for
@CustomerlD with a value of "ALFKI".
Which code segment should you
use?
[A] myCommand.CommandText = "GetCompanyName, ALFKI"
myCommand.Parameters.Add("@CustomerlD")
[B] myCommand.CommandText =
"GetCompanyName" myCommand.Parameters.Add("GetCompanyName",
"ALFK1")
[C] myCommand.CommandText = "@CustomerID"
myCommand.Parameters.Add("GetCompanyName", "ALFKI")
[D]
myCommand.CommandText = "GetCompanyName"
myCommand.Parameters.Add("@CustomerID", "ALFKI")
Correct Answer 134
- D
- Your
Microsoft SQL Server database has a stored procedure that sums the total
number of orders received each day. The stored procedure returns a result that
is a single data value of type integer.
You need to write code that
will execute the stored procedure and return the result as an integer value.
You instantiate a SqlCommand object named myCommand and initialize all
appropriate parameters.
Which myCommand method should you
use?
[A] ExecuteReader
[B] ExecuteNonQuery
[C]
ExecuteScalar
[D] ExecuteXMLReader
Correct Answer 135 - C
- You
have a SqlDataReader object named productsDataReader. You do not know the
names of the columns or the quantity of columns included in
productsDataReader.
You need to create a simple HTML table of the data
in productsDataReader that contains table headings based on the column names.
You want to find out the name of each column by extracting the column names
from productsDataReader.
Which code segment should you use?
[A]
Dim myColumnName As String Dim myDataTable As DataTable Dim myDataColumn
As DataColumn myDatatable = productsDataReader.GetSchemaTable For Each
myDataColumn In myDataTable. Columns myColumnName =
myDataColumn.ColunmName 'Code to use ColumnName to build header goes here.
Next
[B] Dim myColumnName As String Dim myDataTable As
DataTable Dim myDataRow As DataRow myDataTable =
productsDatsReader.GetSchemaTable For Each myDataRow In myDataTable.Rows
myColunmName = myDataRow("ColumnName") 'Code to use ColumnName to build
header goes here. Next
[C] Dim columnCount As Integer Dim
myColumnName As String While colunmCount <
productsDataReader.Item(columnCount) myColunmName =
productsDataReader.GetOrdinal(columnCount) ' Code to use ColumnName to
build header goes here. columnCount += 1 End While
[D] Dim
columnCount As Integer Dim myColumnName As String While columnCount <
productsDataReader.FieldCount myColumnName =
productsDataReader.GetName(0) ' Code to use ColumuName to build header goes
here. columnCount + 1 End While
Correct Answer 136 -
B
- You
develop an order-processing application that retrieves data from a Microsoft
SQL Server database. The SQL Server database contains a stored procedure named
RetumDailyOrders.
ReturnDailyOrders returns all orders for the current
day and returns an output parameter named @OrderCount. This parameter contains
the number of orders for the current day as an integer value.
You need
to create a daily report of all orders received for the current day. You want
to use ReturnDailyOrders to populate a SqlDataReader object that you will use
to create the report. You also want to use @OrderCount to verify the number of
orders processed.
You instantiate a SqlConnection object named
myConnection and a SqlCommand object named myCommand. You write the following
code segment. (Line numbers are included for reference only.)
01
myCommand.Connection = myConnection 02 myCommand.CommandText =
"ReturnDailyOrders" 03 myCommand.CommandType =
Commandlype.StoredProcedure 04 Dim dailyOrderCount As Integer 05 Dim
customerDataReader As SqiDataReader 06 Dim myParameter As New
SqlParameter()
To create the report, you need to insert additional code
after line 06. Which code segment should you use?
[A]
myParameter.DbType = DbType.Int32 myParameter.Direction =
ParameterDirection.Output myParameter.ParameterName = "@OrderCount"
myCommand.Parameters.Add(myParameter) myConnection.Open()
customerDataReader = myCommand.ExecuteReader 'Code to process
customerDataReader goes here. customerDataReader.Close()
dailyOrderCount = myCommand.Parameters("@OrderCount").Value()
[B]
myParameter.DbType = DbType.Int32 myParameter.Direction =
ParameterDirection.ReturnValue myParameter.ParameterName = "@OrderCount"
myCommand.Parameters.Add(myParameter) myConnection.Open()
customerDataReader =myCommand.ExecuteReader ' Code to process
customerDataReader goes here. customcrDataReader.Close()
dailyOrderCount = myConimand.Parameters("@OrderCount").Value()
[C]
myParameter.DbType = DbType.Int32 myParameter.Direction =
ParameterDirection.Output Output myParameter.ParameterName =
"@OrderCount" myCommand.Parameters.Add(myParameter) myConnection.Open()
customerDataReader = myCommand.ExecuteReader 'Code to process
customerDataReader goes here. dailyOrderCount =
mCommand.Parameters("@OrderCount").Value() customerDataReader.Close()
[D]
myParameter.DbType = Dblype.Int32 myParameter.Direction =
ParameterDirection.ReturnValue myParameter.ParameterName = "@OrderCount"
myCommanParameters.Add(myParameter) myConnection.Open()
customerDataReader = myCommanExecuteReader 'Code to process
customerDataReader goes here. dailyOrderCount =
myCommanParameters("@OrderCount").Value()
customerDataReader.Close()
Correct Answer 137 - A
- You
have a SqiDataReader object named productsDataReader. This object is populated
with data from a table named Products in a Microsoft SQL Server
database.
Products contains a colunm named UnitsinStock, which has a
data type of SmallInt. The productsDataReader object is populated with the
following query:
SELECT ProductlD, ProductName, UnitPrice, UnitsinStock
FROM Products
You want to access UnitslnStock by using type-safe code.
You also want to ensure that the data is processed as quickly as
possible.
Which code segment should you use?
[A] Dim units as
SqlInt32 units = productsDataReader.GetSqllnt32("UnitsInStock")
[B] Dim
units as Sqllnt32 units productsDataReader.GetSqlInt32(3)
[C] Dim units
as SqlIntl6 units = productsDataReader.GetSqllntl6("UnitsInStock")
[D]
Dim units as Sqllntl6 units = productsDataReader.GetSqllntl6(3) Correct
Answer 138 - D
- You
develop an application that uses a local Microsoft SQL Server database named
OrderEntry and a SqlClient data provider. You instantiate a SqiConnection
object named myConnection. You want to use Integrated Security to connect to
the database.
Which connection string should you use?
[A]
myConnection.ConnectionString = "Data Source=" _ & "(local);Initial
Catalog=OrderEntry;" _ & vTrusted_Connection=sspi"
[B]
myConaection.ConnectionString = "Data Source=" _ & "(local);Initial
Catalog=OrderEntry; _ & "Trusted_Connection=on"
[C]
myConnection.ConnectionString = "Data Source=" _ & "(local);Initial
Catalog=OrderEntiy;" _ & "Integrated Security=on"
[D]
myConnection.ConnectionString = "Data Source=" _ & "(local);Initial
Catalog=OrderEntry;" _ & "Integrated Security=1"
Correct Answer
139 - A
- Your
Microsoft SQL Server 6.5 database contains a table named PurchaseOrders that
consists of more than 1 million rows. You are developing an application to
populate a DataReader object with data from PurchaseOrders. You want to ensure
that the application processes the data as quickly as possible.
You
create a SQL SELECT statement in a local variable named mySQLSelect. You need
to instantiate a SqlConnection object and a SqlCommand object that you will
use to populate the DataReader object.
Which code segment should you
use?
[A] Dim myConnection As New OleDbConnection
(myOleDbConnectionString) Dim myCommand As New OleDbCommand
(mySQLSelect)
[B] Dim myConnection As New OleDbConnection
(myOleDbConnectionString) Dim myCommand As New OleDbCommand (mySQLSelect,
myConnection) [C] Dim myConnection As New SqlConnection
(mySqlConnectionString) Dim myCommand As New SqlCommand
(mySQLSelect)
[D] Dim myConnection As New SqlConnection
(mySqlConnectionString) Dim myCommand As New SqlConunand (mySQLSelect,
myConnection)
Correct Answer 140 - B
- You
are creating data access components for an XML Web service that retrieves data
from a Microsoft SQL Server database. The components use the SqiClient data
provider.
You estimate that an average of 10 users will use the service
concurrently. Therefore, you want to maintain at least 15 database connections
at all times.
What should you do?
[A] Set the Packet Size
property of the connectionString to 15.
[B] Set the Max Pool Size
property of the connectionString to 15.
[C] Set the Min Pool Size
property of the connectionString to 15.
[D] Set the Connection Lifetime
property of the connectionString to 15.
Correct Answer 141 - C
- You
are creating a DataSet object that will be populated with information from a
table named Products in a Microsoft SQL Server database. The object must
include the ProductlD, ProductName, and UnitslnStock columns in a DataTable
object also named Products.
You instantiate a SqlConnection object
named myConnection. You need to write code to populate the DataSet
object
Which code segment should you use?
[A] Dim
produetsDataSet As New DataSet() Dim myDataAdapter As New SqlDataAdapter
_ ("SELECT ProductId, ProductName, UnitsInStock FROM" _ & "
Products", myConnection) myDataAdapter.Fill(productsDataSet,
"Products")
[B] Dim productsDataSet As New DataSet() Dim
myCommand As New SqlCommand() Dim myDataAdapter As New
SqlDataAdapter(myCommand) myCommandCommandText = "SELECT ProductId,
ProductName," _ & " UnitsInStock FROM
Products" myDataAdapter.Fill(productsDataSet, "Products");
[C]
myConnection.Open() Dim productsDataSet As New DataSet() Dim
myDataAdapter As New SqlDataAdapter _ ("SELECT ProductId, ProductName,
UnitsinStock FROM" _ & " Products",
myConnection) myDataAdapter.Fill(productsDataSet)
[D]
myConnection.Open() Dim productsDataSet As New DataSet() Dim
myDataAdapter As New SqlDataAdapter _ ("SELECT ProductId, ProduetName,
UnitsInStock FROM" _ & " Products", myConnection) Dim Products As
New DataTable(); myDataAdapter.Fill(productsDataSet)
Correct Answer
142 - A
- Your
Microsoft SQL Server database contains a table named Regions. Regions contains
all the sales regions for a sales-tracking application.
You create
aDataSet object named regionsDataSet by using a SqlDataAdapter object named
myDataAdapter. This object uses a single SQL SELECT statement to populate the
regionsDataSet. You bind regionsDataSet to a DataGrid object named
regionsDataGrid to display the contents of Regions.
You now want to use
the same regionsDataSet, myDataAdapter, and regionsDataGrid to insert, update,
and delete data in Regions. You want to accomplish this task by writing the
minimum amount of code.
What should you do?
[A] Instantiate a
SqlCommandBuilder object that has myDataAdapter as a constructor argument. Add
an Update button to the form and add code to the Click event to update
regionsDataSet by using myDataAdapter.
[B] Instantiate a
SqlCommandBuilder object that has myDataAdapter as a constructor argument.
Create one stored procedure for each of the insert, update, and delete
functions and associate the stored procedures with the InsertCommand,
UpdateConanand, and DeleteCommand properties of myDataAdapter. Add an Update
button to the form and add code to the Click event to update regionsDataSet by
using myDataAdapter.
[C] Create one stored procedure for each of the
insert, update, and delete functions and associate the stored procedures with
the InsertCommand, UpdateCommand, and DeleteCommand properties of
myDataAdapter. Add an Update button to the form and add code to the Click
event to update regionsDataSet by using myDataAdapter.
[D] Create one
SQL string for each of the insert, update, and delete functions and associate
the SQL strings with the InsertCommand, UpdateCommand, and DeleteCommand
properties of myDataAdapter. Add an Update button to the form and add code to
the Click event to update regionsDataSet by using
myDataAdapter.
Correct Answer 143 - A
- You
have a DataSet object named ordersDataSet. This object contains two DataTable
objects named Orders and OrderDetails. Both Orders and OrderDetails contain a
column named OrderlD.
You create a DataRelation object named
orderRelation between Orders and OrderDetails on OrderID. Orders is the parent
table. OrderDetails is the child table. You add orderRelation to the
ordersDataSet relation collection by using the following line of
code:
ordersDataSet.Relations.Add(orderRelation)
You verify that
prior to adding orderRelation, there were no constraints on either table. You
then run the line of code.
How many constraints does each table have
now?
[A] one on Orders; none on OrderDetails
[B] none on Orders;
one on OrderDetails
[C] none on Orders; none on OrderDetails
[D]
one on Orders; one on OrderDetails
Correct Answer 144 - D
- You
have a DataSet object named myDataSet. This object contains two DataTable
objects named Customers and Orders. Customers has a column named CustomerlD,
which is unique to each customer. Orders also has a column named
CustomerlD.
You want to use the GetChildRows method of the DataRow
object to get all orders for the current customer.
What should you
do?
[A] Add a foreign key constraint on CustomerlD of Orders between
Customers and Orders.
[B] Add a data relation to myDataSet on OrderID
between Customers and Orders.
[C] Create a unique constraint on
CustomerlD of Customers.
[D] Create a primary key on CustomerlD of
Customers.
Correct Answer 145 - B
- You
are developing a maintenance application to retrieve data from two tables in a
Microsoft SQL Server database. The tables are named Products and Categories.
You want to populate two DataSet objects named productsDataSet and
categoriesDataSet, which will be used in the application.
You
instantiate a SqlConnection object named myConnection and a SqlDataAdapter
object named myDataAdapter. You write and run the following code segment.
(Line numbers are included for reference only.)
01 'Code to initialize
myDataAdapter goes here. 02 myDataAdapter.SelectCommand.CommandText =
"SELECT "_ 03 & "CategoryName, Description FROM Categories" 04
myConnection.Open() 05 myDataAdapter.Fill(categoriesDataSet,
"Categories") 06 myConnection.Close() 07
myDataAdapter.SelectCommand.CommandText = _ 08 "SELECT ProductID,
ProductName FROM Products" 09 myConnection.Open() 10
myDataAdapter.Fill(productsDataSet, "Products") 11
myConnection.Close()
The code gives you the desired results. You now
want to revise the code to ensure that it processes the data as quickly as
possible. What should you do?
[A] After lines 06 and 11, add the
following line of code: myConnection.Dispose() [B] After only line 11, add
the following line of code: myConnection.Dispose()
[C] Delete only
lines 06 and 09.
[D] Delete lines 04, 06, 09, and 11.
Correct
Answer 146 - C
- You
have a strongly typed DataSet object named myDataSet. This object contains two
DataTable objects named Categories and Products. Categories has a data column
named CategorylD. Products has two data columns named CategorylD and
ProductiD. Categories has a primary key named CategoryKey on CategorylD.
Products has a primary key named ProductKey on ProductlD. You want to add a
foreign key constraint on the CategorylD column between Categories and
Products.
Which code segment should you use?
[A]
[B]
[C]
[D]
Correct Answer 147 - A
- You have a DataSet object named
myDataSet that is populated with data from a Microsoft SQL Server database.
This object contains insertions, deletions, and updates to the
data.
You want to apply the data changes in myDataSet to the database.
You decide to use the SqiClient data provider. You need to create a data
object that you will use to update the database.
Which code segment
should you use?
[A] Dim myDataReader As SqlDataReader
[B] Dim
mySqlDataAdapter As New SqlDataAdapter()
[C] Dim myDataObject As New
DataObject()
[D] Dim myParameter As New SqlParameter() Correct Answer 148 - B
- You
are developing an application to maintain customer information in a Microsoft
SQL Server database. You populate a DataSet object named customerDataSet. You
bind this object to a DataGrid object.
Your application invokes a Web
method named CustomerUpdates in an XML Web service. This method accepts
customerDataSet as a parameter and processes the updates made in the DataGnd
object You want to ensure that network traffic to the Web service is
minimized.
Which code segment should you use?
[A] If
myDataSet.HasChanges Then Dim customerChanges As
DataSet myDataSet.AcceptChanges() customerChanges =
myDataSet.GetChanges() CustomerUpdates(customerChanges) End
If
[B] If myDataSet.HasChanges() Then Dim customerChanges As
DataSet customerChanges =
myDataSet.GetChanges() CustomerUpdates(customerChanges) End
If
[C] Dim customerChanges As DataSet myDataSet.AcceptChanges()
customerChanges =
myDataSet.GetChanges() CustomerUpdates(customerChanges)
[D] Dim
customerChanges As DataSet customerChanges = myDataSet.GetChanges
CustomerUpdates(customerChanges)
Correct Answer 149 - B
- You
create a DataSet object named productsDataSet that contains product
information from a Microsoft SQL Server database. This object has a primary
key on a column named ProductiD.
You want to create a new DataSet
object that has the same structure as productsDataSet, including the primary
key. You want the new DataSet object to be empty of data.
Which code
segment should you use?
[A] Dim newDataSet As DataSet =
myDataSet.Clone
[B] Dim newDataSet As DataSet =
myDataSet.Copy
[C] Dim newDataSet as New
DataSet() newDataSet.Tables.Add("myDataSet")
[D] Dim newDataSet as
New DataSet() newDataSet.Tables.Add(myDataSet.Tables(0))
Correct
Answer 150 – A
- You
create a strongly typed DataSet object named customerDataSet. This object
contains a single DataTable object named Customers. Customers has a column
named CustomerlD that contains a unique identifier for each row in Customers.
You want to add a primary key to Customers.
Which code segment should
you use?
[A]
[B] type =
"xs.string" msdata:PrimaryKey="true"/>
[C]
[D]
Correct Answer 151 - A
- Your
company receives product information from manufacturers in the form of XML
documents. The product information is stored in a Microsoft SQL Server
database. The format of each XML document varies. Each one is located in a
MemoryStream object named newProds.
You create a merge procedure that
reads data and schema information in a DataSet object and merges the
information into your database. You now need to write code to transfer the XML
document and its schema into a DataSet object.
Which code segment
should you use?
[A] Dim products As New DataSet("prodInfo") Dim
reader As New XmlTextReader(newProds) Dim validReader As New
XmlValidatingReader(reader) While validReader.Read()
products.WriteXml(validReader.Value) End While
[B] Dim products
As New DataSet("prodInfo") products.ReadXml(newProds)
[C] Dim
products As New DataSet("prodInfo") Dim document As New
XmlDataDocument(products) document.DataSet.ReadXmlSchema(newProds)
[D]
Dim products As New DataSet("prodInfo") Dim myXmlData As String =
Encoding.UTF8.GetString(newProds.ToArray()) Dim adapter As New
SqlDataAdapter("LoadSchemaType=XML",
myXmlData) adapter,Fill(products)
Correct Answer 152 - B
- 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.
Correct Answer 153 -
B
- You
are developing an application that quenes a table named Products in a
Microsoft SQL Server database. The query will be stored in a string variable
named sqlQuery. The query includes the following SQL code:
SELECT *
FROM Products FOR XML AUTO
You must iterate the query results and
populate an HTML table with product information. You must ensure that your
application processes the results as quickly as possible.
What should
you do?
[A] Use a SqlDataAdapter object and set its SelectCommand
property to sqlQuery. Use the Fill method of the SqlDataAdapter object to read
the data into a DataSet object. Loop through the associated rows to read the
dat
[B] Use a SqlDataAdapter object and set its SelectCommand property
to sqlQuery. Use the Fill method of the SqlDataAdapter object to read the data
into a DataSet object. Use the ReadXml method of the DataSet object to read
the data.
[C] Set the SqlCommand object's CommandText to sqlQuery. Use
the ExecuteReader method of the SqlCommand object to create a SqlDataReader
object. Use the Read method of the SqlDataReader object to read the
data.
[D] Set the SqlCommand object's CommandText to sqlQuery. Use the
ExecuteXmlReader method of the SqlCommand object to create an XmlReader
object. Use the XmlReader object to read the data.
Correct Answer 154 -
D
- Your
company frequently receives product information from external vendors in the
form of XML data. You receive XML document files, an .xdr schema file, and an
.xsd schema file.
You need to write code that will create a typed
DataSet object on the basis of product information. Your code will be used in
several Visual Studio .NET applications to speed up data processing. You need
to create this code as quickly as possible.
What should you
do?
[A] Create the code manually.
[B] Use XmlSerializer.
Serialize to generate the code.
[C] Use XmlSerializer.Deserialize to
generate the code.
[D] Use the XML Schema Definition tool (Xsexe) to
generate the code.
Correct Answer 155 - D
- You
are troubleshooting a Visual Studio .NET application that was developed by a
former colleague. You find the following code segment within a large
assembly:
Dim theElement As XmlElement Dim anotherElement As
XmlElement Dim doc As New XmlDocument() Dim theDecl As
XmlDeclaration
theDecl = doc.CreateXmlDeclaration("1.0", Nothing,
Nothing)
doc.AppendChild(theDecl) theElement =
doc.CreateElement("Library") doc.AppendChild(theElement)
theElement
= doc.CreateElement("Book") theElement.SetAttribute("type", "Mystery")
anotherElement = doc.CreateElement("Title")
anotherElement.InnerText = "Book
Title" anotherElement.AppendChild(theElement)
doc.DocumentElement.AppendChild(theElement)
Which
XML output is produced by this code segment?
[A]
[B]
[C]
[D]
Correct Answer 156 - B
- You
are debugging a Visual Studio .NET application. The application produces an
XmlDocument object and then consumes the same object. This object moves data
in the application. The object has no schema, but it contains a declaration
line that you must inspect. You decide to transform the XML code and its
declaration into a string for easy inspection.
What should you
do?
[A] Assign the ToString method of the XmlDocument object to a
string variable.
[B] Assign the OuterXml property of the XmlDocument
object to a string variable.
[C] Assign the OuterXml property of the
DocumentElement property of the XmlDocument object to a string
variable.
[D] Use the WriteContentTo method of the XmlDocument object
to write the document into a MemoryStream object. Create a DataSet object and
use its ReadXml method to read the MemoryStream object into the DataSet
object. Use the GetXml method of the DataSet object to get a string version of
the document.
Correct Answer 157 - B
- You are developing an application to
monitor store inventory. When inventory falls below a specified level, the
application automatically generates a purchase request. Suppliers have
requested that you transmit purchase requests to them in an XML document.
Suppliers will accept the XML document in any valid form, except they do not
want the data set definition to be included in the XML file.
You create
a method named GeneratePurchaseRequest. You write the code to populate a
DataSet object named myDataSet with the purchase request data. You define a
variable named fileName that contains the name and path of the output
file.
You need to create an XML file from the data in myDataSet by
adding code to CleneratePurchaseRequest.
Which code segment should you
use?
[A] myDataSet.WriteXML(fileName, Xml
WriteMode.IgnoreSchema)
[B] myDataSet.WriteXML(fileName, Xml
WriteMode.WriteScherna) [C] myDataSetWriteXMLSchema(fileName)
[D]
Dim my Writer As TextWriter = New Stream Writer(fileName)
myDataSet.WriteXMLSchema(myWriter)
Correct Answer 158 - A
- You
create a serviced component named TransferUtil to transfer money between bank
accounts. TransferUtil logs information for failed transfers by using the
Trace class. You want TransferUtil to save these log messages.
Which
code segment should you use?
[A] Shared Sub
New() Trace.Flush() End Sub
[B] Shared Sub
New() Trace.Listeners.Clear() End Sub
[C] Shared Sub
New() Trace.Listeners.Add(new TextWriterListener("transfer.log")) End
Sub
[D] Protected Overloads Overrides Sub
Finalize() Trace.Flush() End Sub
[E] Protected Overloads
Overrides Sub Finalize() TraceListeners.Clear() End Sub
[F]
Protected Overloads Overrides Sub Finalize() Trace.Listeners.Add( new Text
WriterListener("transfer.log")) End Sub
Correct Answer 159 - C
- You
are creating an XML Web service named BankCustomer that provides bank customer
information. You write code to keep track of error messages, warning messages,
and informational messages while the service is running. You use the Trace
class to write the messages to a log file.
On test computers, you want
to see error messages and warning messages. On deployment computers, you want
to see error messages, but not warning messages.
Which two code
segments should you use? (Each correct answer presents part of the solution.
Choose two.)
[A] Public Shared mySwitch as TraceSwitch Shared Sub
New() mySwitch = new TraceSwitch("tswitch", "a trace switch") End
Sub
[B] Public Shared level as TraceLevel Shared Sub New() level =
TraceLevel.Error End Sub
[C] Trace.WriteLinelf(mySwitch.TraceError,
"An error occurred,") Trace. WriteLineIf(mySwitch.Trace Warning, "Warning
message")
[D] Trace.WriteLinelf(level TraceLevel.Error , "The operation
succeeded,") Trace.WriteLinelf(level = TraceLevel.Warning, "Warning
message")
[E] Trace.WriteLinelf(Not mySwitch Is Nothing, "An error
occurred.") Trace.WriteLineIf(Not mySwitch Is Nothing, "Warning
message")
[F] Trace.WriteLinelf(level <>TraceLevel.Off, "An error
occurred.") Trace.WriteLinelf(level <>TraceLevel.Off, "Warning
message")
Correct Answer 160 - A-C
- 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] _ Public Sub
ValidateCache(ByVal name As String) ' Method body goes here. End
Sub
Correct Answer 161 - D
- 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.
Correct Answer 162 - C
- You
create an XML Web service named Service1. You use the Debug.Assert method in
your code to verify parameter values and ranges. You find that Service1 does
not display assertion failure messages.
Instead, Service1 returns an
HTTP 500 error message when an assertion fails. You want to view the assertion
failure messages.
What should you do?
[A] Modify the Web.config
file to stop the Debug.Assert method from displaying a message box.
[B]
Modify the compilation element of the Weconfig file by setting the debug
attribute to "true".
[C] In the constructor for Service1, set the
Debug.AutoFlush property to false.
[D] In the constructor for Service1,
add an EventLogTraceListener object to the Listeners property of the Debug
class.
Correct Answer 163 - B
- 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)
Correct Answer 164 - C
- You
create a serviced component named SessionDispenser. This component is in the
Fabrikam.Utilities assembly and is registered in a COM+ server application.
SessionDispenser has multiple callers.
You discover that there are
logic problems in the CreateNewSession method. You want to debug any calls to
this method.
What should you do?
[A] Open the SessionDispenser
solution. Set a breakpoint on the CreateNewSession method. Start the
debugger.
[B] Attach the debugger to the client process. Set a
breakpoint on the SessionDispenser.CreateNewSession method.
[C] Attach
the debugger to the Fabrikam.Utilities.exe process. Set a breakpoint on the
CreateNewSession method.
[D] Attach the debugger to a Dllhost.exe
process. Set a breakpoint on the CreateNewSession method.
Correct
Answer 165 - C
- You
create a serviced component named OrderProcessor. OrderProcessor implements
the lOrderinit interface. The component and the interface contain the
following code
segments:
<GUIDATTRIBUTE("OB6ABB29-43D6-40A6-B5F2-83A457D062AC"), InterfaceType(ComInterfaceType.Interface.InterFaceIsDual)> Public
Interface IorderInit 'IOrderinit methods go here. End
Interface
Public Class OrderProcessor Inherits ServicedCornponent
Implements Iorderinit 'OrderProcessor methods go here. End
Class
You discover that every time you rebuild OrderProcessor, existing
unmanaged client code fails. The HRESULT for the exception is 0x80040 154. The
exception includes the following message: "Class not registered." You need to
resolve this problem.
What should you do?
[A] Add a Guid
attribute to the OrderProcessor class.
[B] Add a Comlmport attribute to
the lOrderInit interface.
[C] To the OrderProcessor class, add the
following attribute: ClassInterface(ClassInterfaceTypoe.AutoDual)
[D]
To the end of every method, add the following line of code:
Marshal.ReleaseComObject(Me)
Correct Answer 166 - C
- You
create a serviced component named Scheduler. Scheduler is registered in a
library application. The Scheduler methods parse String objects into DateTime
objects. You write a console application named Coverage.exe to test each
method in Scheduler. You want Coverage.exe to test Scheduler for multiple
cultures to verify its globalization support.
What should you
do?
[A] Create a Cultureinfo object for each culture locale before
calling the Scheduler methods.
[B] Create a Regionlnfo object for each
culture locale before calling the Scheduler methods.
[C] Set the
current thread's CurrentCulture property to each culture locale before calling
the Scheduler methods.
[D] Create a Coverage.exe.config file and add a
element to the configuration file for each culture locale.
Correct
Answer 167 - C
- You create an XML Web service named
PhoneService that returns telephone information to its customers. You
configure the Web.config file and Internet Information Services (IIS) to use
Basic authentication to authenticate calls to the Web service.
You are
now creating a Windows-based application named MyWinApp to test PhoneService.
To MyWinApp, you add a Web reference to PhoneService. You add a Windows Form
named Form1 to MyWinApp.
You write the following code segment in the
Form1_Load event (Line numbers are included for reference only.)
01 Dim
phoneService As New MyService.PhoneService() 02 Dim phoneNumber As
String 03 'Insert new code beginning here. 04 phoneNumber =
phoneService.GetPhoneNumber("Alex")
You run MyWinApp. However, when
line 04 executes, an exception is thrown indicating that access is denied. You
need to add code beginning on line 03 to ensure that MyWinApp runs without
exceptions.
Which code segment should you use?
[A] Dim credCache
As New CredentialCache() phoneService.Credentials = credCache
[B]
Dim credCache As New CredentialCache() credCache.Add(New
Uri(phoneService.Url), "Basic", _ New NetworkCredential(myUser,
userPassword)) phoneService.Credentials = credCache
[C] Dim
credCache As New CredentialCache() Dim creds As New NetworkCredential()
credCache.Add(New Uri(phoneService.Url), userPassword, creds)
phoneService.Credentials = creds
[D] Dim credCache As New
CredentialCache() Dim creds As New NetworkCredential()
credCache.Add(New Uri(phoneService.Url), "Basic", creds)
phoneService.Credentials = credCache
Correct Answer 168 - B
- You
create an XML Web service named MyService. You must ensure that this service
meets the following URL authorization requirements:
Anonymous access
must be disabled for MyService. An authenticated user named Userl cannot
access MyService. All other authenticated users can access MyService. ·
· · · · · You configure Internet Information Services (IIS) to meet these
requirements. You now need to configure the authorization section in the
Web.config file to properly authorize the users.
Which code segment
should you use?
[A]
[B]
[C]
[D]
Correct
Answer 169 - D
- You
create three XML Web services named myService1, myService2, and myService3.
All three services are in the same virtual directory named myService. The
myService directory structure is in the following
format:
\inetpub \wwwroot \MyService \MyServicel.asmx \MyService2.asmx \OtherServices \MyService3.asmx
You
ascertain that some customers want to subscribe to all three services. You
need to create a discovery document in the myService directory that enables
specific customers to use all three Web services.
Which discovery
document should you create?
[A]
xmlns:disco="http://schemas.xmlsoap.orgldisco/"
xmlns:scl="http://schemas.xmlsoap.org/disco/scI/">
[B]
disco="http:I/schemas.xmlsoap.org/disco/"
xmlns:scl="http://schemas.xmlsoap.org/disco/scl/">
[C]
[D]
Correct Answer
170 - C
- You create a .NET Remoting object named
MyRemoteObject in an XML Web service named MyWebService. All method calls made
on MyRemoteObject are routed to a single instance of this object. The state of
MyRemoteObject must be maintained between method calls.
You need to
register MyRemoteObject as a well-known object provided by MyWebService. You
want to accomplish this goal by adding code to the Web.config file of
MyWebService.
Which code segment should you use?
[A] [B]
[C] [D]
Correct Answer 171 - B
- 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
Correct Answer 172 - D
- You
have an ASP.NET application named MyWebApp. This application uses a private
assembly named Employee to store and retrieve employee data. Employee is
located in the bin directory of MyWebApp.
You develop a new ASP.NET
application named MyWebApp2 that also needs to use Employee. You assign
Employefwords() As String, _ ByRef numbers() As Integer) As
Integer
Correct Answer 173 - D
|