‚ ‚
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).
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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.)
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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.)
|
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.)
|
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?
|
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.)
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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.)
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
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 |