Deploying Windows Services, Serviced Components, .NET Remoting Objects, and XML Web Services

‚   ‚  


Practice Exam

This practice exam contains 77 questions that are representative of what you should expect on the actual exam "Creating and Managing Microsoft Windows Services, Serviced Components, .NET Remoting Objects, and XML Web Services section of the Developing XML Web Services and Server Components with Microsoft Visual Basic .NET and the Microsoft .NET Framework" (exam 70-310). The answers appear at the end of this practice exam. I strongly suggest that when you take this practice exam, you treat it just as you would the actual exam at the test center. Time yourself, read carefully , don't use any reference materials, and answer all the questions as best you can.

Some of the questions might be vague and require you to make deductions to come up with the best possible answer from the possibilities given. Others might be verbose, requiring you to read and process a lot of information before you reach the actual question. These are skills that you should acquire before attempting to take the actual exam. Take this practice exam, and if you miss more than 19 questions, try rereading the chapters that contain information on the subjects in which you were weak. You can use the index to find keywords to point you to the appropriate locations.

1:

You are working with this XML file:

 <?xml version="1.0" encoding="UTF-8"?> <Orders>   <Order OrderNumber="142">     <Part PartNumber="12"/>     <Part PartNumber="14"/>     <Part PartNumber="22"/>   </Order>   <Order OrderNumber="143">     <Part PartNumber="22"/>     <Part PartNumber="18"/>   </Order> </Orders> 

Which XPath expressions can you use to return the second Part element from the first Order element? (Select two).

  1. /Orders/Order[1]/Part[2]

  2. /Orders/Order[0]/Part[1]

  3. (/Orders/Order/Part)[2]

  4. (/Orders/Order/Part)[1]

A1:

A, C. XPath node numbering is 1-based. The expression /Orders/Order[1]/Part[2] explicitly selects the second Part under the first Order. The expression (/Orders/Order/Part)[2] selects the second Part in the entire file, which happens to be under the first Order in this case. The parentheses are necessary because the square bracket operator normally takes precedence over the path operators.

2:

You are building a class for a component that will be registered with COM+. So far you have designed the class as follows :

 Public Interface ICustomer     Function GetBalance( _      ByVal CustID As String) _      As Long End Interface Public Class NorthwindSC     Inherits ServicedComponent     Implements ICustomer End Class 

You want to ensure that only the interface you have designed explicitly is registered with COM+. How should you specify the ClassInterface attribute?

  1. Accept the default ClassInterface

  2. Use ClassInterface.None

  3. Use ClassInterface.AutoDispatch

  4. Use ClassInterface.AutoDual

A2:

B. Both AutoDispatch and AutoDual generate interfaces for you when registering a class with COM+. The default value is AutoDispatch, which generates a late-bound interface (whereas AutoDual generates both early- and late-bound interfaces). To define your own interfaces, you must explicitly set the ClassInterface attribute to None.

3:

You have been using version 1.1 of SpiffyLib, a .NET class library, in your applications for some time. SpiffyLib comes from SpiffyWare, an external vendor. You have developed multiple in-house applications that reference and use SpiffyLib 1.1, which is installed in the GAC on your computers.

Now SpiffyWare has released SpiffyLib 2.0, which is not 100% backward compatible with SpiffyLib 1.1. You would like to start using SpiffyLib 2.0 in new applications, but you want existing applications to continue to use SpiffyLib 1.1. What should you do?

  1. Remove SpiffyLib 1.1 from the GAC. Install SpiffyLib 1.1 in the folder of each application that uses it. Install SpiffyLib 2.0 in the GAC.

  2. Install SpiffyLib 2.0 in the GAC. Add a .config file to each existing application, telling it to use SpiffyLib 1.1.

  3. Install SpiffyLib 2.0 in the GAC. Make no other changes to the existing configuration.

  4. Install SpiffyLib 2.0 in the folder of each new application. Do not install SpiffyLib 2.0 in the GAC until you have retired or rewritten all of the existing applications.

A3:

C. Multiple versions of the same assembly can exist side by side in the GAC. In the absence of a policy to the contrary, .NET applications will only use the version of an assembly with which they were originally compiled.

4:

You have been developing a serviced component in Visual Basic .NET. To develop the component, you have been writing code, registering the component with COM+, testing, and repeating the cycle. After a day of development, you notice that the component appears in the COM+ catalog multiple times. How can you prevent the component from appearing in COM+ more than once as you rebuild versions of the component?

  1. Use the Guid Attribute to assign a constant GUID to the class.

  2. Use the ClassInterface.None attribute so that you can hard-code the component's interfaces.

  3. Install the component in the Global Assembly Cache.

  4. Build the component in release mode instead of in debug mode.

A4:

A. By providing a hard-coded GUID for the component, you prevent the registration process from generating a new GUID each time that the component is registered with COM+.

5:

You are working with a SQL Server database that contains a table named Patients and a table named Visits. The Patients table contains columns PatientID (a unique identifier for the patient and the primary key of the table) and PatientName (the name of the patient). The Visits table contains columns VisitID (a unique identifier for the visit and the primary key of the table), PatientID (a foreign key that points to the PatientID column in the Patients table), VisitCost (the bill for the visit), and VisitDate (the date of the visit).

You want to write a query that returns the number of visits that each patient has made together with the patient's name, provided that the total cost of the visits is at least $100. Which SQL statement should you use?

  1.  SELECT Patients.PatientName, Count(Visits.VisitID) FROM Patients INNER JOIN Visits  ON Patients.PatientID = Visits.PatientID GROUP BY Patients.PatientName WHERE Sum(Visits.VisitCost)>=100 
  2.  SELECT Patients.PatientName, Count(Visits.VisitID) FROM Patients INNER JOIN Visits  ON Patients.PatientID = Visits.PatientID GROUP BY Patients.PatientName WHERE Visits.VisitCost >=100 
  3.  SELECT Patients.PatientName, Count(Visits.VisitID) FROM Patients INNER JOIN Visits  ON Patients.PatientID = Visits.PatientID GROUP BY Patients.PatientName HAVING Sum(Visits.VisitCost)>=100 
  4.  SELECT Patients.PatientName, Count(Visits.VisitID) FROM Patients INNER JOIN Visits  ON Patients.PatientID = Visits.PatientID GROUP BY Patients.PatientName HAVING Visits.VisitCost >=100 
A5:

C. You're interested in the total cost of visits, so you must use the Sum() operator on the VisitCost column. To filter after the sum is taken, you must use HAVING . Use WHERE filters to include only individual rows in which the cost is at least $100.

6:

Your application needs to load the contents of an XML file into memory. You don't need rich navigation through the XML file; a single pass to locate the data of interest is sufficient for the application. Which object should you use to implement this requirement?

  1. XPathNavigator

  2. XmlReader

  3. XmlTextReader

  4. XPathExpression

A6:

C. The XmlTextReader is optimized for forward-only, read-only processing of an XML file. You can't use the XmlReader class directly in an actual implementation because the XmlReader class is marked with the MustInherit attribute.

7:

Your code is making asynchronous calls to two different Web methods . You then execute other code until you arrive at a point at which you require results from one or the other of the asynchronous calls. You can proceed with further processing as soon as either result is available. How should your code wait for the results of the asynchronous calls?

  1. Use a pair of delegate callbacks, one for each call.

  2. Use a WaitHandle.WaitAny() call, specifying both methods.

  3. Use a WaitHandle.WaitAll() call, specifying both methods.

  4. Use two WaitHandle.WaitOne() calls, one for each method.

A7:

B. You can't use delegates because they won't pause the code at this point. To coordinate two or more methods and proceed when any one of them completes, you use WaitHandle.WaitAny().

8:

Your application monitors IIS activities under Windows 2000. To perform its work, this application needs administrative access to the computer. You've chosen to build this application as a Windows service. Which security context should you use as the startup account for the service?

  1. LocalSystem

  2. LocalService

  3. NetworkService

  4. User

A8:

A. The LocalSystem value defines a highly privileged account. Compared to this, the LocalService and NetworkService values provide a lower privilege level for the security context. Privileges for User depend on the specified username and password.

9:

Your company supplies a COM component to provide advanced communications capabilities to applications written in VB6. Some of your clients are moving to VB .NET and require an RCW for your component. How should you proceed?

  1. Use the Type Library Importer tool to create and sign a PIA for your component.

  2. Set a reference to your component from any Visual C# .NET project to create an RCW for your component.

  3. Create a class that uses platform invoke to call functions from your component.

  4. Use the ActiveX Library Importer tool to create and sign a PIA for your component.

A9:

A. Because you developed the component, the proper course of action is to produce a PIA for it. You can use the type library importer tool to do this.

10:

Your application contains this code:

 <Conditional("DEBUG")> _ Function PrintDebugText()     Debug.WriteLine("In debug mode") End Function Private Sub Button2_Click( _  ByVal sender As System.Object, _  ByVal e As System.EventArgs) _  Handles Button2.Click     PrintDebugText()     Trace.WriteLine("In Button Click") End Sub 

You run the application in release mode and click the Button2 control. What is the result?

  1. A compile time error occurs.

  2. A runtime error occurs.

  3. The Output window prints

     In debug mode In Button Click 
  4. The Output window prints

     In Button Click 
A10:

D. In Release mode, the DEBUG symbol is not defined. Therefore, the compiler simply ignores the call to PrintDebugText without throwing an error. The Trace.WriteLine statement executes normally and prints its string to the Output window.

11:

You are designing a distributed application for a major hosting service of online journals. The application will be heavily used by thousands of eager journal writers every hour . For greater scalability, you need to make sure that the application can be deployed in a load-balanced configuration. How should you host the remotable object in this scenario?

  1. As a server-activated object in Singleton activation mode

  2. As a server-activated object in SingleCall activation mode

  3. As a client-activated object using the HTTP channel

  4. As a client-activated object using the TCP channel

A11:

B. SingleCall SAOs have no state, so they're easy to load-balance just by adding new servers. For a heavily loaded application, SAOs are preferable to CAOs because they do not transmit as much data across the network for each call.

12:

You have developed a .NET Remoting server that is used by employees in your organization to place vacation time requests. The server makes a Singleton SAO named VacationRequest available. Clients send their employee IDs to the server to create the object. Later, they post the object back to the server with their vacation requests . The server then records the information in a Jet database.

You discover that at peak times, vacation requests are getting confused ‚ for example, the vacation request from Employee 3285 is getting saved as a request from Employee 4288. What can you do to fix this issue?

  1. Switch from using a Singleton SAO to using a CAO.

  2. Switch from using a Singleton SAO to using a SingleCall SAO.

  3. Switch the database from Jet to SQL Server.

  4. Issue a confirmation number with each call to the object that the employee can later refer to.

A12:

A. With a Singleton SAO, state is persisted, but all clients of the object share the same state. With a Singlecall SAO, state is not persisted . With a CAO, each client can persist its own state, which avoids the problem with clients sharing state.

13:

You have used the Web Services Discovery Tool to retrieve information about a Web service named CustomerBalance. Which file will contain the URL for any documentation of the CustomerBalance Web service?

  1. results.discomap

  2. CustomerBalance.disco.

  3. Reference.vb

  4. CustomerBalance.wsdl

A13:

B. The Disco file is the only one that contains pointers to non-XML resources.

14:

The .asmx file in your Web Service contains the following code:

 Imports System.Web.Services <WebService(Namespace:="http://my.org")> _ Public Class Customers     Inherits System.Web.Services.WebService     Public Function Balance( _      ByVal CustNumber As String) _      As Integer         ' Stub to test function         Balance = 5     End Function End Class 

You compile the Web Service and set a Web Reference to it from a client application. However, you are unable to call the Balance method from the client application. What must you do?

  1. Add the <WebMethod()> attribute to the Balance function.

  2. Rewrite the Balance function to be a Sub with an output parameter.

  3. Add the Balance function to the WSDL file for the Web Service.

  4. Register the Web Service with a UDDI Registry.

A14:

A. The public methods of a Web Service are only those methods that are decorated with the WebMethod attribute. You are not required to use either UDDI or WSDL with a Web Service.

15:

Your application contains the following code to update a SQL Server database via an XML DiffGram:

 Private Sub btnUpdate_Click( _  ByVal sender As System.Object, _  ByVal e As System.EventArgs) _  Handles btnUpdate.Click     ' Connect to the SQL Server database     Dim sxc As SqlXmlCommand = _      New SqlXmlCommand( _      "Provider=SQLOLEDB;" & _      "Server=(local);" & _      "database=Northwind;" & _      "Integrated Security=SSPI")     ' Set up the DiffGram     sxc.CommandType = _      SqlXmlCommandType.DiffGram     sxc.SchemaPath = "..\diffgram.xsd"     sxc.CommandStream = _      New FileStream("..\diffgram.xml", _      FileMode.Open)     ' And execute it     sxc.ExecuteNonQuery() End Sub 

The code executes and the data specified in the diffgram.xml file is properly updated when you run the application on your own computer. However, when you deploy the application to a production computer, you receive a System.IO.FileNotFoundException. What should you do to fix this problem?

  1. Move the diffgram files to the root directory on the production computer.

  2. Install the .NET Framework SP2 on the production computer.

  3. Install the SQLXML package on the production computer.

  4. Modify the connection string to explicitly use the name of the production computer.

A15:

C. The SqlXmlCommand object is supplied as part of the SQLXML download package. It is not installed with the base .NET Framework.

16:

You have written a Windows forms application that allows the user to input a new value for an environment variable through a form. If the code does not have environment permissions, you want to fail gracefully. You've placed a demand for Environment permissions at the assembly level with the SecurityAction.RequestOptional flag. However, when you test the application, the form will not load. What could be the problem?

  1. Environment permissions can only be requested at the class level.

  2. You must also request Registry permissions to manipulate the environment.

  3. In addition to requesting Environment permissions, your code must also demand the same permission of its callers .

  4. When requesting optional permissions, you must request all permissions that your assembly needs, including user interface permissions.

A16:

D. When you use the SecurityAction.RequestOptional flag, the CLR will not grant you any permissions that you did not explicitly request. This contrasts with SecurityAction.RequestMinimum, which enables the CLR to grant extra permissions.

17:

In which of these situations should you use tlbimp, the type library importer tool? (Select two.)

  1. You must call a COM component that you wrote from Visual Basic .NET code.

  2. You must produce a strong-named assembly that calls methods from one of your company's COM components.

  3. You require objects from Microsoft Word in your .NET application.

  4. You need to be able to call Windows API functions in kernel.dll from your .NET code.

A17:

A, B. You should not use tlbimp on code from another vendor. Rather, you should go to that vendor to get the Primary Interop Assembly (PIA) for the COM library that you want to call. Also, tlbimp is not necessary for calling Windows API functions.

18:

Which of these tasks requires you to use imperative security rather than declarative security?

  1. Refusing dangerous permissions such as registry permission

  2. Ensuring that your application has access to an environment variable whose name is not known until runtime

  3. Ensuring that your application has access to a specific file whose name is known at design time

  4. Ensuring that your application has access to an Oracle database as a specific user

A18:

B. Declarative code access security can only handle scenarios in which you know the details at design time. If the security requirements are finalized at runtime, you must use imperative security.

19:

Your application uses version 2.3.0.0 of the FunGraph assembly. The producer of the assembly has issued version 2.3.l.0 of the assembly, together with a publisher policy file that dictates using 2.3.1.0 in place of 2.3.0.0 in all applications. You discover after testing that one of your applications, named DiskGraph, which previously worked with 2.3.0.0, fails with 2.3.1.0. You want only this application to use the old version of the assembly while letting all other applications use the new version. What should you do?

  1. Add the element <publisherPolicy apply="no"/> to the DiskGraph.exe.config file.

  2. Add an administrator policy specifying that requests for 2.3.0.0 should be satisfied with 2.3.0.0.

  3. Delete the publisher policy from your computer.

  4. Copy version 2.3.0.0 of the assembly from the GAC to the folder containing DiskGraph.exe.

A19:

A. The publisherPolicy element allows you to override publisher policy for a single application. Adding an administrator policy or deleting the publisher policy will affect all applications on the computer, not just the one application. Copying the assembly will have no effect on the binding, which will be satisfied from the GAC.

20:

You have designed a Windows service that includes a peer-to-peer layer to network with other instances of the same service on different computers. The service will need to present the computer's credentials to remote servers, but it does not need extensive permissions on the local computer. The service will run on a mix of Windows 2000 and Windows XP hosts . Which security context should you use for this service?

  1. LocalService

  2. NetworkService

  3. LocalSystem

  4. User

A20:

C. The NetworkService and LocalSystem accounts both present the computer's network credentials to any remote server. However, the NetworkService account is not available on Windows 2000.

21:

You are building a .NET Remoting server to deliver Class1 as a Server-Activated Object. The interface of Class1 is defined as follows:

 Public Class Class1     Inherits MarshalByRefObject     Public Property1 As Integer     Private p_property2 As Date     Public Property Property2() As Date         Get             Property2 = p_property2         End Get         Set(ByVal Value As Date)             p_property2 = Value         End Set     End Property     Private p_method3 As Double     Public Function Method3() As Double         Method3 = p_method3     End Function     Public Shared Property4 As String End Class 

Which member of Class1 will not be available remotely?

  1. Property1

  2. Property2

  3. Method3

  4. Property4

A21:

D. Static members (those defined using the Shared keyword in Visual Basic .NET) are not available remotely.

22:

You want to host a remotable class via the .NET remoting framework so that remote clients can instantiate the class and invoke methods on it. Your business standards require you to use Integrated Windows authentication to authenticate users of the object. Which of the following techniques should you use to host the remotable class?

  1. Use Internet Information Services (IIS) as a remoting host.

  2. Use a console application as a remoting host.

  3. Create a Windows service and use that to host the remotable class.

  4. Use a Web Service application to host the remotable class.

A22:

A. When you use IIS to host a remotable class, the full spectrum of IIS authentication and authorization methods are available to the Remoting infrastructure.

23:

Your application calls a Web service that delivers detailed demographic information. This information takes some time to generate, and your application is unresponsive while you're waiting for the results. What can you do to fix this problem?

  1. Use asynchronous calls to invoke the Web service.

  2. Install a faster link to the Internet.

  3. Install more memory in the client computer.

  4. Generate a proxy with the wsdl.exe tool.

A23:

A. Using an asynchronous call to invoke a Web Service enables other code in your application to execute while you're waiting for the Web Service to return results. When the results are ready, the asynchronous call can invoke a callback method to make them available.

24:

You are creating a schema file to represent the Customers table in your database. You need to represent a field named CustomerContact in this schema. Data entered in the CustomerContact field is a string with up to 25 characters . What should you use to represent this field in the XML schema?

  1. Attribute

  2. Simple type

  3. Element

  4. Complex Type

A24:

B. A simple type can be modified by facets, which allow you to specify data restrictions such as minimum, maximum, or exact length.

25:

You are building a .NET Remoting server that will make an object named Account available to client applications. The client applications are built in .NET, and they include the class file for the Account object. Unfortunately, some of the processing information in the class file is company confidential.

How should you remove this confidential information from the client applications without breaking their functionality?

  1. Rewrite the client applications in C++ so that they do not contain managed code.

  2. Define an interface, IAccount, which contains all the public members of the Account class. Implement the interface in the Account class. Ship only the interface with the client application.

  3. Remove the implementation code from the client's copy of the Account class.

  4. Rewrite the application as a Web Service instead of a Remoting application.

A25:

B. By using an interface to define the contract between the Remoting server and the client, you can keep the two synchronized without leaking any implementation details to the client.

26:

Your application contains the following XML file:

 <?xml version="1.0" encoding="utf-8" ?> <Trials>   <Trial TrialID="1">     <Courtroom>1</Courtroom>   </Trial>   <Trial TrialID="2">     <Courtroom>4</Courtroom>   </Trial>   <Trial TrialID="3">     <Courtroom>3</Courtroom>   </Trial> </Trials> 

Your application uses the ReadXmlSchema method of the DataSet object to create a DataSet with an appropriate schema for this XML file. Which of the following mappings between XML entities and DataSet entities will this method create?

  1. Trials and Trial will become DataTables. Courtroom will become a DataColumn. TrialID will not be mapped.

  2. Trials and Trial will become DataTables. TrialID will become a DataColumn. Courtroom will not be mapped.

  3. Trials and Trial will become DataTables. TrialID and Courtroom will become DataColumns.

  4. Trials will become a DataTable. Trial and Courtroom will become DataColumns. TrialID will not be mapped.

A26:

C. The ReadXmlSchema method maps nested elements in the XML file to related DataTable objects in the DataSet. At the leaf level of the DOM tree, both elements and attributes are mapped to DataColumns.

27:

You are designing a .NET Remoting server that will be hosted by IIS and ASP.NET. This server will make a Singleton class named ReportWriter available to clients. Clients will be deployed on several different operating systems and platforms. Which channel and formatter should you use to implement this server?

  1. TcpChannel and SoapFormatter

  2. TcpChannel and BinaryFormatter

  3. HttpChannel and SoapFormatter

  4. HttpChannel and BinaryFormatter

A27:

C. To make efficient use of the features of IIS and ASP.NET from a Remoting server, you should use the HttpChannel. For maximum interoperability with clients across platforms and languages, you should use the SoapFormatter.

28:

You have called a Web Method asynchronously in your code. Your application has a backlog of other processing to do at this point, so you want to continue working on other tasks until the Web Method return value is available. How should you manage the asynchronous call?

  1. Call the End method immediately after calling the Begin method.

  2. Use WaitHandle.WaitOne to wait for the result of the call.

  3. Supply a callback delegate to be executed when the results are ready.

  4. Poll the value of the IAsyncResult.IsCompleted property until it returns True.

A28:

C. To wait for the result of an asynchronous Web Method call with minimum overhead, you should supply a callback delegate. If you call the End method or use WaitHandle.WaitOne, you effectively convert the asynchronous call back to a synchronous call. If you use a polling loop, you'll adversely affect performance.

29:

You are designing a SOAP extension that will run within a variety of Web service clients. This extension will monitor messages for company confidential information and delete such information if it is found. In which message state should you invoke this SOAP extension?

  1. BeforeDeserialize

  2. AfterDeserialize

  3. BeforeSerialize

  4. AfterSerialize

A29:

D. This SOAP extension needs to monitor and alter the XML messages that are sent from client to server. These messages are only available on the client in the AfterSeralize stage.

30:

You are going to use classes from three different COM components in your .NET application via COM interop. You'd like to place all these components into a uniform namespace. What should you do?

  1. Use the Type Library Importer tool with the /out option to create a file with the desired name.

  2. Use the Type Library Importer tool with the /namespace option to set the namespace within each RCW.

  3. Set a direct reference to each COM component. Declare a namespace for the entire project. Refer to that project from your actual project.

  4. Use PInvoke within a namespace to invoke functions from each component.

A30:

B. You can specify the namespace for an RCW by using the /Namespace switch with the Type Library importer.

31:

You are developing a .NET Remoting application that allows client programs to instantiate a class named Account. You want the remote object to be created on the server so that it can access the corporate financial information, which is stored on an intranet. However, you want client programs to control the creation and the lifetime of the remote objects. Which of the following methods of the RemotingConfiguration class would you choose to register the remotable class with the remoting system on the server?

  1. RegisterWellKnownServiceType()

  2. RegisterActivatedServiceType()

  3. RegisterWellKnownClientType()

  4. RegisterActivatedClientType()

A31:

B. In this scenario, you need to register a client-activated remote object, which you can do using the RegisterActivatedServiceType() method. The RegisterActivatedClientType() method is used to register the CAO with the remoting system in the client's application domain. The other two options are for creating the server-activated objects.

32:

Your Visual Basic .NET project contains the following code:

 Dim tl As DefaultTraceListener = _  New DefaultTraceListener() Debug.Listeners.Add(tl) Debug.WriteLine("Debug Message") Trace.WriteLine("Trace Message") 

You run the application in Debug mode. What output does this section of code produce?

  1.  Debug Message 
  2.  Debug Message Debug Message 
  3.  Debug Message Trace Message 
  4.  Debug Message Debug Message Trace Message Trace Message 
A32:

D. In Debug mode, both Debug and Trace messages are active. Creating a new DefaultTraceListener and adding it to the Listeners collection results in each message being output twice (through the build-in DefaultTraceListener and through the newly-added DefaultTraceListener). The Debug and Trace messages share the same Listeners collection, so adding an object to one adds it to the other.

33:

You are using the DataSet schema designer within Visual Studio .NET to design a schema for part of an inventory application. This part of the application includes a Warehouse table and a Room table. Each warehouse contains multiple rooms. You've created an element to represent the Warehouse table. Which XML schema component should you add to this element to represent the Room table?

  1. Attribute

  2. Group

  3. Facet

  4. Element

A33:

D. To represent a child table in a hierarchy in an XML schema, you must use an element. This element will contain the complex element representing the child table.

34:

You are using code access security in your application. The application absolutely requires permission to access the Windows Registry. Which type of Registry permission request should your code make?

  1. SecurityAction.Demand

  2. SecurityAction.RequestRefuse

  3. SecurityAction.RequestOptional

  4. SecurityAction.RequestMinimum

A34:

D. With SecurityAction.RequestMinimum, your code will throw an exception if it cannot obtain the requested permission. SecurityAction.Demand requires callers to have the permission, but that does not mean the current assembly will have the permission. SecurityAction.RequestOptional does not guarantee that the permission will be granted, and SecurityAction.RequestRefuse guarantees that your code will not receive the specified permission.

35:

Your assembly is a member of five code groups, as follows:

EnterpriseA , at the enterprise level, grants Registry, Environment, FileDialog, and FileIO permissions to the code.

EnterpriseB , at the enterprise level, grants FileDialog permissions to the code.

MachineA , at the machine level, grants Registry, Environment, and FileIO permissions to the code.

MachineB , at the machine level, grants Environment and FileIO permissions to the code. This code group has its LevelFinal bit set.

UserA , at the user level, grants FileIO permissions to the code.

Which of these permissions will the code be granted as a result of its membership in these code groups?

  1. FileIO

  2. Registry, Environment, IO

  3. Registry, Environment, FileIO, FileDialog

  4. FileDialog, Environment, FileIO

A35:

B. At each level, the permissions are the union of all permissions granted at that level. So this gives you Registry, Environment, FileDialog, and FileIO permissions at the enterprise level; Registry, Environment, and FileIO permissions at the machine level; and FileIO permissions at the user level. The total permissions are the intersection of the level permissions. However, because the MachineB code group has the LevelFinal bit set, the user level permissions are not considered by this assembly. So the final effective permissions are the intersection of the machine and enterprise permissions.

36:

Your Visual Basic .NET project contains the following code:

 Dim tl As DefaultTraceListener = _  New DefaultTraceListener() Debug.WriteLine("Debug Message") Trace.WriteLine("Trace Message") 

You run the application in Debug mode. What output does this section of code produce?

  1.  Debug Message 
  2.  Debug Message Debug Message 
  3.  Debug Message Trace Message 
  4.  Debug Message Debug Message Trace Message Trace Message 
A36:

C. In Debug mode, both debug and trace messages are active. But creating a new DefaultTraceListener, without adding it to the Listeners collection, has no effect on the output. Only the built-in DefaultTraceListener is used in this example.

37:

You want to use a Web service that supplies address verification services from your application. You know the URL of the .asmx file published by the Web service. What step should you take first?

  1. Run the Web Service Discovery Tool.

  2. Open the .asmx file in a Web browser.

  3. Run the XML Schema Definition Tool.

  4. Copy the .asmx file to your client project.

A37:

A. The Web Service Discovery Tool retrieves copies of the files that you need to proceed with this project.

38:

You are performing a final QA pass on a Web Service client, and you discover that the name of one of the parameters on the Web Service server has changed. All the documentation for the client has been printed, so you do not want to change the name of the client parameter. What should you do to fix this mismatch?

  1. Use the SoapDocumentMethod attribute to specify the Bare parameter style for this method.

  2. Use a SOAP extension on the client to detect the old parameter name and change it to the new parameter name before the message is sent.

  3. Use the SoapDocumentMethod attribute with Use:=Literal to specify literal encoding for this method.

  4. Use the XmlElement attribute to rename the parameter in the SOAP messages.

A38:

D. The XmlElement attribute lets you alter the SOAP requests sent to the server without changing any of your code.

39:

You are implementing a SOAP Extension to write usage statistics to a disk file. In which method should you open the disk file?

  1. Initialize

  2. GetInitializer

  3. ChainStream

  4. ProcessMessage

A39:

B. The GetInitializer is called once when the SOAP extension is first invoked and is the appropriate event for one-time resource setup. The Initialize event is called every time the SOAP extension is invoked.

40:

You have written a serviced component and now need to debug it when it's being used by a client process. The serviced component is stored in a file named sc.dll, and is a server application. The client process is named cp.exe. To which process should you attach the debugger to trace calls within the serviced component?

  1. sc.dll

  2. cp.exe

  3. aspnet.exe

  4. dllhost.exe

A40:

D. Component Services launches Server components in a separate instance of the dllhost.exe process. You can determine which of several dllhost processes corresponds to a particular serviced component by using the Status View within the Component Services administrative tool.

41:

You have created a class that uses COM+ with object pooling via the System.EnterpriseServices namespace. You're ready to install your component on a production server and would like to monitor the object pool to see whether it is properly sized . How should you do this?

  1. Activate component events and statistics within the Component Services administrative tool.

  2. Add code to the class to write messages to the event log whenever an instance of the class is created or destroyed .

  3. Add code to the class to maintain a custom performance monitor with object pool statistics.

  4. Use performance monitor to track the committed RAM on the server to deduce the number of instances of the object created.

A41:

A. Component services can automatically collect a variety of statistics on pooled components, including the number of objects in the pool, the number currently activated, and the number of objects currently executing a client request.

42:

Your application uses the GetSystemDirectory API function, which exists in kernel32.dll in both ANSI and Unicode versions. Your declaration is as follows:

 Declare Function GetSystemDirectory Lib "kernel32" ( _  ByVal lpBuffer As String, _      ByRef nSize As Integer) As Integer 

Your code is failing, with a System.EntryPointNotFoundException exception, whenever you call this function. What should you do to fix the failure?

  1. Add the Auto modifier to the declaration.

  2. Use DllImport instead of Declare.

  3. Supply the full path to kernel32.dll.

  4. Declare the function as GetSystemDirectoryA instead of GetSystemDirectory.

A42:

A. When an API call exists in both ANSI and Unicode versions, you can use the Auto modifier to tell the .NET Framework to automatically choose the right version based on the current platform.

43:

You are designing an application to monitor your network and log SOAP messages. This application should run full time, as long as the monitoring computer is booted , whether a user is logged in or not. Which sort of application should you design?

  1. Web Service

  2. Serviced Component

  3. ASP.NET application

  4. Windows Service

A43:

D. A Windows Service can be set to start whenever the operating system starts, and it continues to run when users log on or off the machine.

44:

Your application's database includes a table of orders that contains three million rows of data. Each row includes the order date as well as other information. Your application allows the user to enter a date, and then will display all the orders placed on that date. Which strategy should you use to retrieve the orders?

  1. Create a parameterized stored procedure that accepts the order date as a parameter.

  2. Retrieve the orders table to a DataSet and build a DataView to contain only the required orders.

  3. Create an ad hoc SQL statement that includes the date entered by the user as part of the SQL statement.

  4. Create a view on the server that includes only the required orders.

A44:

A. Parameterized stored procedures are faster and more secure than ad hoc SQL statements. A view cannot contain parameters, so you'd need to build a new view for every request. The DataSet approach would result in all rows of the table being transferred to the client, which would perform very poorly.

45:

You are working programmatically with an XML document. You don't know anything about the structure of this document other than that it is valid XML. Which of these methods can you use to retrieve the root element of the document?

  1. Load the document into an XmlDocument object and retrieve its DocumentElement property.

  2. Load the document into an XmlNode object and retrieve its DocumentElement property.

  3. Load the document into an XmlDocument object and retrieve its DocumentType property.

  4. Load the document into an XmlNode object and retrieve its DocumentType property.

A45:

A. The DocumentElement property of an XmlDocument object returns an XmlNode object that represents the root node in the underlying XML document.

46:

You have built a Windows Service to implement a custom networking protocol using Visual Basic .NET. Which tool can you use to install the service for testing?

  1. xcopy

  2. Services MMC snap-in

  3. gacutil

  4. installutil

A46:

D. Installing a Windows Service requires communicating with the Service Control Manager. Of the listed tools, only installutil can communicate with the SCM to install a new service.

47:

You are designing a Web Service that will return roughly 250K of database information to clients on your intranet. How should you declare the Web Method?

  1.  <WebMethod(BufferResponse:=False)> _ _ Public Function GetData() As Object _ 
  2.  <WebMethod(CacheDuration:=0)> _ _ Public Function GetData() As Object _ 
  3.  <WebMethod(CacheDuration:=7200)> _ _ Public Function GetData() As Object _ 
  4.  <WebMethod(EnableSession:=True)> _ _ Public Function GetData() As Object _ 
A47:

A. Setting the BufferResponse property to False sends back the data in chunks so that the client process won't timeout while waiting for it. CacheDuration specifies how long the response will be cached for succeeding calls and won't have any effect on a single call to the method. Session state doesn't need to be enabled unless you require the Web Service to be stateful.

48:

You have purchased a commercial SOAP extension for use with your Web Service. This extension encrypts some attributes in the AfterSerialize event on the client and decrypts the attributes in the BeforeDeserialize event on the server. Now you want to add your own SOAP extension to track some statistics on the incoming XML data. This SOAP extension will need access to the decrypted attributes from the other SOAP extension. How should you implement the new SOAP extension?

  1. Add the new SOAP extension in the BeforeDeserialize event with a higher priority than the existing SOAP extension.

  2. Add the new SOAP extension in the BeforeDeserialize event with a lower priority than the existing SOAP extension.

  3. Add the new SOAP extension in the AfterDeserialize event with a higher priority than the existing SOAP extension.

  4. Add the new SOAP extension in the AfterDeserialize event with a lower priority than the existing SOAP extension.

A48:

A. SOAP extensions execute in order from lowest priority to highest priority. Because your SOAP extension needs to work with the XML data, it must be invoked in the BeforeDeserialize event rather than in the AfterDeserialize event (when the XML has been converted back to native objects).

49:

Your application contains this code:

 Dim el As New EventLog() el.Source = "MyLog" el.WriteEntry("MyLog", _  "A message", _  EventLogEntryType.Error) 

You have not called EventLog.CreateEventSource("MyLog") anywhere in your application, and the MyLog event log does not already exist. What happens when you execute this code?

  1. A runtime error occurs.

  2. The message is displayed in a message box.

  3. The message is written to the MyLog event log.

  4. The message is written to the Application event log.

A49:

C. If you attempt to write an event log entry to a log that you have not yet created, the .NET framework automatically creates the appropriate source. Calling CreateEventSource is optional.

50:

Your project contains the following API declaration:

 <DllImport("kernel32.dll", _  CharSet:=CharSet.Auto)>  Public Shared Function GetComputerName( _  ByVal buffer As String, _  size As Integer) As Integer 

The project also contains code to use this API to display the computer name:

 Public Sub ShowName()     Dim buf As String = ""     Dim intLen As Integer = 128     Dim intRet As Integer     ' Call the Win API method     intRet = GetComputerName(buf, intLen)     Console.WriteLine( _      "This computer is named " & _       buf.ToString()) End Sub 

Users report that no computer name is displayed. What should you do?

  1. Use Declare instead of DllImport to declare the API call.

  2. Replace the use of String with StringBuilder in the code.

  3. Specify ByRef for the buf parameter in the call to GetComputerName.

  4. Specify the correct character set in the declaration of the function.

A50:

B. In the calls via PInvoke, you should use StringBuilder instead of String to hold a string buffer that expects to be modified by the function.

51:

You wrote a COM component to store webcam data for future use. Now you want to use that component from .NET. The COM component is used nowhere else, and you have not shipped copies of it to anyone else. You want to call the objects in the COM server from your new .NET client. How should you proceed?

  1. Use the Type Library Importer to create an unsigned RCW for the COM component.

  2. Use the Type Library Importer to create a signed RCW for the COM component.

  3. Set a direct reference from your .NET client to the COM server.

  4. Use PInvoke to instantiate classes from the COM component.

A51:

C. In this situation, in which you wrote the component and there's no question of it being used elsewhere, the easiest way to bring it into .NET is to just set a direct reference.

52:

Your Visual Basic .NET project contains the following code:

 Dim tl As DefaultTraceListener = _  New DefaultTraceListener() Debug.Listeners.Add(tl) Debug.WriteLine("Debug Message") Trace.WriteLine("Trace Message") 

You run the application in Release mode. What output does this section of code produce?

  1.  Trace Message 
  2.  Debug Message Debug Message 
  3.  Trace Message Trace Message 
  4.  Debug Message Debug Message Trace Message Trace Message 
A52:

C. In Release mode, only trace messages are active. Creating a new DefaultTraceListener and adding it to the Listeners collection results in each message being output twice (through the built-in DefaultTraceListener and through the newly-added DefaultTraceListener). The Debug and Trace messages share the same Listeners collection, so adding an object to one adds it to the other.

53:

You are designing a network application that depends on several Windows services. You want to allow the user to list all the services on the computer and select the ones that he wants to monitor. Which class can you use to enumerate the running services?

  1. ServiceBase

  2. ServiceInstaller

  3. ServiceController

  4. ServiceProcessInstaller

A53:

C. The ServiceController.GetServices() method returns a list of the Windows services installed on the computer.

54:

You are using a SQL INSERT statement to insert records in a table named Customers. The Customers table has the following structure:

CustomerID: integer, identity, no default value, cannot be null

CustomerName: varchar(75), no default value, cannot be null

CustomerCountry: varchar(30), default value 'USA', cannot be null

Employees: int, no default value, can be null

Which column must you explicitly specify in the INSERT statement?

  1. CustomerID

  2. CustomerName

  3. CustomerCountry

  4. Employees

A54:

B. An INSERT statement must specify values for non-nullable, non-identity columns that do not have a default value.

55:

You are attempting to retrieve all orders placed on July 19, 1996 from a SQL Server database. You have written the following SQL statement:

 SELECT * FROM Orders WHERE OrderDate = 7/19/1996 

The statement executes without error, but does not return any rows. You are certain that the database contains orders from the date. How should you correct the SQL statement?

  1.  SELECT * FROM Orders WHERE OrderDate = #7/19/1996# 
  2.  SELECT * FROM Orders WHERE OrderDate = July 19, 1996 
  3.  SELECT * FROM Orders WHERE OrderDate = '7/19/1996' 
  4.  SELECT * FROM Orders WHERE OrderDate = "7/19/1996" 
A55:

C. SQL Server uses single quotes to delimit date values. The original SQL did not return an error because SQL Server treated the date as a mathematical operation involving two divisions and silently converted the result into a date.

56:

You have developed a translation component that allows you to turn XML files with specific formatting into WAP files. You plan to use this component in multiple ASP.NET applications.

You are now ready to use the Visual Studio .NET interface to build a setup project for your component. Which type of project should you build?

  1. Setup Project

  2. Web Setup Project

  3. Merge Module Project

  4. CAB project

A56:

C. A merge module project provides a way to include a component in more than one setup project. The merge module cannot be installed on its own, but it is the ideal way to deliver a shared component.

57:

You have created a class that makes use of COM+ transactions through the System.EnterpriseServices namespace. During the course of its activities, the class calls various methods of the ContextUtil class. Which of these methods can the class use to indicate that its work is finished and that it approves of committing the transaction? (Select two.)

  1. DisableCommit()

  2. EnableCommit()

  3. SetAbort()

  4. SetComplete()

A57:

B, D. The SetComplete call sets both the consistent bit and the done bit to True, so the transaction can be committed. The EnableCommit call sets the consistent bit to True but leaves the done bit set to False, which also enables committing the transaction but does not deactivate the object.

58:

You are using IIS to authenticate users of an ASP.NET application. Part of your corporate security guidelines states that passwords must never cross the Internet in clear text. Which authentication methods can you use? (Select two.)

  1. Anonymous

  2. Digest

  3. Windows Integrated

  4. Basic

A58:

B, C. Anonymous authentication does not actually authenticate users at all, and Basic authentication transmits passwords in plain text. Digest authentication encrypts the password before it crosses the Internet, and Windows Integrated authentication uses either Kerberos or challenge/response to keep passwords off the wire entirely.

59:

You use a SqlDataAdapter to fill a DataSet with the contents of the Parts table in your database. The PartName of the first part is "widget." You synchronize an XmlDataDocument object with the DataSet. In the DataSet, you change the PartName of the first customer to "thingamabob." After that, in the XmlDataDocument, you change the Value of the corresponding Node to "thingummy." When you call the Update method of the SqlDataAdapter, what is the effect?

  1. The PartName in the table remains "widget."

  2. The PartName in the table is updated to "thingummy."

  3. The PartName in the table is updated to "thingamabob."

  4. The CLR prompts you as to whether the name should be "thingummy" or "thingamabob."

A59:

B. The DataSet and the XmlDataDocument are two views of the same data in memory. The last change you make to this data will be saved regardless of which object you used to make the change.

60:

You have built and tested a Web service named PerfMonService. The service uses some applicationwide event handling that is contained in the Global.asax file. Now you are ready to deploy the Web service to a production server. Which of these files should you deploy to the production server? (Choose two.)

  1. PerfMonService.asmx

  2. AssemblyInfo.vb

  3. Global.asax.vb

  4. Web.config

A60:

A, D. The .asmx and .config files are required on the Web server at runtime. The .vb files are compiled into the code-behind .dll for the Web service, so they do not need to be deployed to the production server.

61:

You are using XPath to retrieve information from an XML file of electronic components. Some of the components are grouped into assemblies and subassemblies, and this grouping is represented in the hierarchy of the XML file. You want to write an XPath expression to select every occurrence of the Volts attribute in the XML file, regardless of the level at which this attribute appears. Which XPath expression can you use for this purpose?

  1. ./@Volts

  2. ./Volts

  3. //@Volts

  4. //Volts

A61:

C. Because Volts is an attribute rather than an element, you must refer to it as @Volts in an XPath expression. To select this attribute wherever it appears in the XML file, you should use // as the current context to cause the search to start at the root of the file.

62:

You are developing a SOAP extension to run in a Web Service client application. Your SOAP extension includes a class named MyExtensionAttribute to flag methods to which the extension applies. The client project contains this code:

 Private Sub btnGetData_Click( _  ByVal sender As System.Object, _  ByVal e As System.EventArgs) _  Handles btnGetData.Click     ' Call a Web method on the object     Dim I As InvWebService.Inventory = _      New InvWebService.Inv()     objWarehouse.Inv = I.GetLatest() End Sub 

Where should you apply the MyExtensionAttribute attribute so that it interacts with the SOAP requests generated by this procedure?

  1. To btnGetData_Click

  2. To the GetInitializer method in your SOAP extension

  3. To the GetLatest method in the Web Service proxy class

  4. To the Load event of the form containing this button

A62:

C. SOAP extensions are activated by applying the corresponding attribute to the Web Method proxy that you want to intercept.

63:

You have built a Windows Service application that will monitor network activity on a specified TCP/IP port. You intend to allow the user to specify the port as a parameter from the Services MMC snap-in. Where should you process the user's selection?

  1. In the Main() method of the service

  2. In the OnStart() method of the service

  3. In the Run() method of the service

  4. In the OnContinue() method of the service

A63:

B. When a Windows service is started, any startup parameters are passed to the OnStart() method.

64:

Your ASP.NET application contains this setting in the web.config file:

 <identity impersonate="true" name="CORP\Bill"  password="CharlesPassword"/> 

You are allowing only Windows-integrated authentication in IIS. What identity will ASP.NET use to authorize resources if a user with the Windows account Bob in the CORP domain logs in?

  1. ASPNET

  2. CORP\Bob

  3. CORP\Bill

  4. IUSR_ComputerName

A64:

C. If you turn on impersonation and specify a user name in the identity tag, that identity will be used for any user who successfully authenticates to the IIS server.

65:

You have created a serviced component named LicenseManager. The LicenseManager component reads software licensing details from an XML configuration file. You want the system administrator to be able to enter the name of the configuration file, which should then be used when the component is instantiated . The system administrator will enter this name through the Component Services administration tool. How should you retrieve this entry?

  1. Override the Construct() method of your component.

  2. Override the Activate() method of your component.

  3. Create a constructor for your component that uses the data.

  4. Create an interface for your component that uses the data.

A65:

A. The Construct() method of a serviced component allows you to retrieve data entered in the Component Services administration tool. Serviced components cannot have non-default constructors.

66:

ChartLib is an internally developed COM component that is used in most of your company's applications. You are now migrating those applications to .NET and want to continue to use the ChartLib component. How should you proceed to reuse the component with the least work?

  1. Use the Visual Basic Migration Wizard to move the code to .NET, and release a .NET version of the component.

  2. Use tlbimp to create an unsigned RCW, and place the RCW in each application's folder.

  3. Use tlbimp to create an unsigned PIA, and place the unsigned PIA in the GAC.

  4. Use tlbimp to create a signed PIA, and place the signed PIA in the GAC.

A66:

D. Placing an RCW or PIA in the GAC makes it available to all .NET applications on the computer. But you can't put an unsigned assembly in the GAC.

67:

You have developed a Remoting application and are now building a setup package to install this application on your company's production servers. The setup package installs several SQL scripts that must be executed on the target machine. If the SQL scripts fail, the installation should be aborted. Which setup editor should you use to manage the installation logic for these scripts?

  1. File System Editor

  2. Registry Editor

  3. Launch Conditions Editor

  4. Custom Actions Editor

A67:

D. The Launch Conditions Editor allows you to add logic to a setup project that encompasses rollback in case of difficulty.

68:

You have created a serviced component that accepts vacation requests from employees for processing by the payroll system. You register the component in the COM+ catalog of the company's main application server. You enable object pooling services for the component and set Minimum Pool Size to 5 and Maximum Pool Size to 10. However, you have underestimated the demand for vacations , and 12 users attempt to use the application simultaneously . What is the result?

  1. The first 10 requests for the object are satisfied with new instances. The last 2 requests are queued until an instance is available, or until the specified timeout period elapses.

  2. The first 10 requests for the object are satisfied with new instances. The last 2 requests fail with an object not found exception.

  3. The first 10 requests for the object are satisfied with new instances. The last 2 requests are satisfied by recycling the first two objects, thus disconnecting the first two requests.

  4. Component Services increases the pool size to 12 in order to satisfy all the requests.

A68:

A. After the pool of objects is exhausted, further requests are queued until an object is available or until the specified timeout period elapses.

69:

You have written a .NET class library that will be shared by multiple applications on your computer. You want to manage this component by providing a single file that can be shared by all assemblies. What should you do? (Select two.)

  1. Generate a native image using the ngen.exe tool.

  2. Install the library in the GAC using the gacutil.exe tool.

  3. Create a strong name for the component using the sn.exe tool.

  4. Register the component using the regsvcs.exe tool.

A69:

B, C. To share the class library among multiple applications, you should place it in the GAC. As a prerequisite to this, you must assign a strong name to the component. Components can be shared whether or not they are native images. The regsvcs.exe tool is only used for serviced components, not for regular class libraries.

70:

You have written the following code for a serviced component.

 Public Interface IOrder      Function ConfirmOrder( _       o As OrderInfo) As Boolean End Interface <JustInTimeActivation(True), _  Transaction(TransactionOption.Required)> _ Public Class OrderConfirm     Inherits ServicedComponent,     Implements IOrder     Public Function ConfirmOrder( _      o As OrderInfo) As Boolean _      Implements IOrder.ConfirmOrder         ' Code to check database for order         ' Code to check credit rating         ' Code to decrease available credit         ' Code to place order     End Function End Class 

At the end of the ConfirmOrder() method, you decide whether all the databases involved have been updated correctly. If yes, you commit the transaction and deactivate the current OrderConfirm object. Which of the following methods should you use in the PlaceOrder() method to accomplish this requirement?

  1. SetComplete()

  2. DisableCommit()

  3. EnableCommit()

  4. SetAbort()

A70:

A. The SetComplete method both commits the transaction and deactivates the current object at the end of the method call.

71:

You are invoking a Web service that returns a DataTable object. Your client application is written in Visual Basic .NET, whereas the Web service itself is written in C#. The Web service is outside of your corporate firewall. You receive an "object not found" error when you call the method that returns the DataTable . What could be the problem?

  1. The client project and the server project are not written in the same language.

  2. The firewall is blocking all SOAP calls.

  3. The client project does not contain a reference to the System.Data namespace.

  4. The DataTable object cannot be serialized.

A71:

C. NET Web services are able to serialize complex objects and pass SOAP messages containing these objects across firewalls and across language boundaries. However, the client application must contain information about how to reconstitute the object, including a reference to the object's definition.

72:

You have installed a Web Service on an IIS computer named SHINBONE that allows anonymous access. Impersonation is enabled in the ASP.NET Web.config file for the Web Service, but no user identity is specified for the impersonation. You have ASP.NET installed to use the ASPNET account. Bob, who is a member of the CORP domain on the server, submits a SOAP request to the Web Service. Under which security context does this request execute?

  1. IUSR_SHINBONE

  2. CORP\Bob

  3. ASPNET

  4. CORP\Guest

A72:

A. Because the IIS server allows anonymous access, any user will run as IUSR_SHINBONE in the IIS process. With impersonation enabled but no user identity specified, ASP.NET assumes the identity of the user within the IIS process. Even though the user has credentials on the domain, those credentials are never used in this example.

73:

You have developed a graphing component that will be made available to your customers via download from the Internet. To ensure your customers of the safety of the component, you want to sign it in such a fashion as to guarantee both the integrity and the identity of the code. What should you do?

  1. Sign the code using sn.exe.

  2. Sign the code using signcode.exe.

  3. Sign the code first with sn.exe, and then with signcode.exe.

  4. Sign the code first with signcode.exe, and then with sn.exe.

A73:

C. Signing the code with sn.exe provides proof that the code has not been altered , but does not provide any evidence of the code's origin. Signing the code with signcode.exe applies a digital certificate to indicate the code's origin, but does not provide protection against tampering. You must sign the code with both tools to guarantee both integrity and identity. When you use both tools, you must always use sn.exe first.

74:

You are using the Web Services Description Language Tool to create a proxy class for a Web service. The Web service exposes a class named Supplier . You already have a Supplier class in your application. What should you do to allow both classes to coexist in the same application?

  1. Rename the existing class.

  2. Manually edit the generated proxy class to change the classname that it contains.

  3. Use the /namespace option of the Web Services Description Language Tool to specify a unique namespace for the new class.

  4. Use the /out option of the Web Services Description Language Tool to specify a unique output file name for the new class.

A74:

C. Specifying a unique namespace for the new object removes the chance that it can clash with a preexisting object name, and it does not require you to change any existing code.

75:

You have defined a stored procedure in your database as follows:

 CREATE PROC GetCustomers   @Country varchar(25) AS   SELECT * FROM Customers   WHERE Country = @Country 

The stored procedure executes without error from SQL Query Analyzer. Now you are using code behind a form with this stored procedure. The form includes a SqlConnection object named cnn and a DataGrid control named dgCustomers:

 Dim cmd As SqlCommand = New SqlCommand() Dim ds As DataSet = New DataSet() Dim da As SqlDataAdapter = _  New SqlDataAdapter() cmd.Connection = cnn cmd.CommandText = "GetCustomers" cmd.Parameters.Add(New SqlParameter( _  "@Country", SqlDbType.VarChar, 25)) cmd.Parameters("@Country").Value = "France" da.SelectCommand = cmd da.Fill(ds, "Customers") dgCustomers.DataSource = ds dgCustomers.DataMember = "Customers" 

When you run the code, you receive an unhandled exception of type System.Data.SqlClient. SqlException on the line that calls the Fill method. What should you do to fix this error?

  1. Explicitly set the CommandType object of the SqlCommand object to CommandType.StoredProcedure.

  2. Replace the stored procedure with an ad hoc SQL statement containing the actual country string.

  3. Use a SqlDataReader instead of a DataSet to retrieve the data.

  4. Call the Open method of the SqlConnection object before calling the Fill method of the DataAdapter.

A75:

A. If you do not specify the command type of a SqlCommand object, it defaults to CommandType.Text, which will not work with a stored procedure. You could also make the code work by using an ad hoc SQL statement, but this is an undesirable solution because the code will run slower and be less secure.

76:

You are developing a Windows Service by inheriting from the System.ServiceProcess.ServiceBase class. Which handler are you required to implement in your service?

  1. OnStop

  2. OnStart

  3. OnPause

  4. OnContinue

A76:

B. The CanShutdown, CanStop, and CanPauseAndContinue properties let you specify which service events a Windows service can handle. However, there is no CanStart property; you must always handle start requests from the SCM by implementing an OnStart handler.

77:

Your application contains the following code:

 Dim bContinue As Boolean = True Debug.Assert(bContinue, "Debug Message") bContinue = False Trace.Assert(bContinue, "Trace Message") 

You run the application in Release mode. What will be the result of running this code segment?

  1. "Trace Message" will appear in a message box.

  2. "Debug Message" will appear in a message box.

  3. "Trace Message" will appear in the Output window.

  4. "Debug Message" will appear in the Output window.

A77:

A. In release mode, any sort of calls to the Debug class have no effect. Assertion failures appear in a message box, not in the Output window.


‚   ‚  
Top


MCAD. MCSD Training Guide (Exam 70-310. Developing XML Web Services and Server Components with Visual Basic. NET and the. NET Framework)
MCAD/MCSD Training Guide (70-310): Developing XML Web Services and Server Components with Visual Basic(R) .NET and the .NET Framework
ISBN: 0789728206
EAN: 2147483647
Year: 2002
Pages: 166

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net