Answer Key

1. A and D

2. B

3. D

4. A

5. B

6. A, B, and E

7. C

8. C

9. D

10. A

11. A

12. D

13. D

14. B

15. A

16. C

17. A

18. D

19. C

20. B

21. C

22. D

23. A

24. D

25. D

26. A

27. A

28. A

29. A

30. C

31. B

32. C

33. B

34. A

35. C

36. C

37. D

38. C

39. B

40. B

41. D

42. C

43. D

44. A

45. D

46. C

47. A, B, and C

48. C

49. B

50. B

51. A

52. D

53. D

54. A

55. A and D

56. D

57. C

58. A, B, and C

59. D

60. C and D

Question 1

The correct answers are A and D. The Debug and Trace classes share the same Listeners collection. Therefore, you should add a listener object either to the Trace.Listeners collection or to the Debug.Listeners collection. Answer B is incorrect because this solution will generate double entries in the Event Log. Answer C is incorrect because the newly created listener object is not attached to the Listeners collection of the Trace and Debug classes.

Question 2

The correct answer is B. The Assert method checks for the given condition and generates an error when the condition evaluates to False. Answer A is incorrect because this code segment will only generate an error when the value of TotalShipments is not equal to zero. Answers C and D are incorrect because the Debug.Assert method is invoked only when the program is compiled using the Debug configuration.

Question 3

The correct answer is D. You need to first create a filtered DataView object from the Suppliers table and bind the DataView object to the DataGrid. Answers A and C are incorrect because they do not give you objects that can be bound to the DataGrid control. Answer B is incorrect because, although the solution works, retrieving the data from the database for the second time is slower than filtering it from the existing DataTable object.

Question 4

The correct answer is A. The ApplyDefaultSort property is used to automatically create a sort order ( ascending ), based on the primary key of the table. The ApplyDefaultSort property only applies when the table has a primary key defined and the Sort property is set to Nothing or an empty string. Answer B is incorrect because you want to sort using the primary key, and for that you should set the ApplyDefaultSort property to True. Answer C is incorrect because you need to sort the data instead of filtering the data. Answer D is incorrect because the given code segment is incorrect; you must specify name of a column in the Sort property along with ASC (ascending) or DESC (descending).

Question 5

The correct answer is B. The XML file has the value 3 for TraceLevelSwitch , which sets the Level property as TraceLevel. Info . Answers A, C and D are incorrect because setting the Level property as TraceLevel.Info will cause the TraceError , TraceWarning , and TraceInfo properties of the traceSwitch to be True. Only the TraceVerbose property will evaluate to False. Also, the third parameter to the WriteLineIf method is used to categorize the output by placing its value followed by a colon (:) and then the trace message.

Question 6

The correct answers are A, B, and E. Because multiple applications are using this assembly, you need to install the assembly in the Global Assembly Cache (GAC). To install the assembly in the GAC, you also need to sign the assembly with a strong name. Finally, to enable COM applications to use the assembly, you need to register the assembly in the Windows Registry. Answer C is incorrect because the COM applications need not be compiled. Answer D is incorrect because you do not need to use a COM DLL in a .NET application. Answers F and G are incorrect because shared assemblies should be deployed in the GAC. When an assembly is registered in the Windows Registry, COM applications are able to locate shared assemblies from the GAC.

Question 7

The correct answer is C. When you release a bug fixtype upgrade of an assembly where you want calls to a particular version of an assembly to be redirected to another version of the assembly, you should deploy a publisher policy file with appropriate redirection information. Answer A is incorrect because configuring all existing application-configuration files in each machine will require a lot of work. Answer B is incorrect because modifying the machine-configuration file for each machine also requires a significant amount of effort. Answer D is incorrect because if you delete version 1.0.0 of PieChart.dll , all the existing applications that refer to that DLL will fail to execute.

Question 8

The correct answer is C. Setting the RowStateFilter property of the DataView object to DataViewRowState.Deleted specifies that you want to view the deleted rows from the original data. Answers A and B are incorrect because the RowFilter property is used to filter rows based on an expression rather than their state. Answer D is incorrect because setting the RowStateFilter property to DataViewRowState.OriginalRows displays the original data of all the rows, including deleted rows.

Question 9

The correct answer is D. If you get a DCOM configuration error while debugging, you might not be a member of the Debugger Users group on the remote machine. To resolve this, you add your account on the remote machine to the Debugger Users group. Answers A, B, and C are incorrect because to debug a program remotely using Visual Studio .NET, you should be a member of the Debugger Users group rather than the Power Users group , on the remote computer rather than the local computer.

Question 10

The correct answer is A. The UserPreferenceChanged event is raised whenever the user changes display properties. You can check the SystemInformation.HighContrast property in this event to determine whether the user has selected High Contrast mode. Answer B is incorrect because the Paint event is fired whenever the form is redrawn. Answer C is incorrect because the SystemEvents.PaletteChanged event occurs when the user switches to an application that uses a different palette. Answer D is incorrect because the user might change the display settings after loading the form.

Question 11

The correct answer is A. The MaxLength property only has an effect on user input. It is not checked when you programmatically set the value of a control. Answers B, C and D are incorrect because these values will allow users to enter more than three characters in the text box.

Question 12

The correct answer is D. To display values from an array in a list box or a combo box, you set the DisplayMember property of the control to a string containing the name of the field. Answers A and C are incorrect because they use the ValueMember property instead of the DisplayMember property. The ValueMember property is used to set the value associated with the items in the ListBox or ComboBox control, but this property is not displayed in the control. Answer B is incorrect because the DisplayMember property should specify the field of the data source as a string.

Question 13

The correct answer is D. Using a class derived from EventArgs to pass event parameters is preferable to using individual arguments because it can be more readily extended in case you need to pass additional parameters in the future. Answers A and C are incorrect because event- related data should be passed as an argument to the event handler. Answer B is incorrect because, by convention, event handlers only accept two arguments. The first event handler is the object that received the event, and the second event handler is the object containing the event argument. According to good programming practices, classes containing event data should derive from the EventArgs class and should have names that end with the suffix EventArgs .

Question 14

The correct answer is B. Because the Graphics object is so frequently needed during the Paint event, it is automatically passed to that event's handler. Therefore, the easiest way to retrieve a Graphics object from the Paint event handler is through the Graphics property of the PaintEventArgs argument. Answers A, C, and D are incorrect because you already have a Graphics object available through the Paint event handler. Therefore, you need not write any additional code to create another Graphics object.

Question 15

The correct answer is A. When you run the application, the BackColor value of Form2 will be Blue. Answer B is incorrect because when you assign a value directly to the BackColor property of Form2, it overrides the inheritance from Form1. Answer C is incorrect because changes to the same property on Form1 do not have any effect on Form2. Answer D is incorrect because you have already modified the BackColor property, and the default values of the form are no longer applicable .

Question 16

The correct answer is C. The filters in the OpenFileDialog object are numbered starting at 1, rather than 0. Answers A and B are incorrect because setting the FilterIndex property to 0 or 1 will select the first filter from the Filter property and therefore make all image files the default setting. Answer D is incorrect because this setting will make GIF files the default setting.

Question 17

The correct answer is A. You should use the ShowDialog method to pause the execution while the user responds and the DialogResult property to retrieve the user's choice. Answer B is incorrect because you should use the ShowDialog method rather than the Show method to display the form. Answers C and D are incorrect because when the user clicks a button on the form, the value of the DialogResult property of that button is assigned to the DialogResult property of the form. Therefore, you should use the DialogResult property of the form to retrieve the user's choice.

Question 18

The correct answer is D. The TraceSwitch class provides a multilevel switch to control tracing output without recompiling your code. Answer A is incorrect because the /d:TRACE option just enables tracing. It does not allow multilevel control over tracing output. Answer B is incorrect because modifying environmental variables requires much more administrative effort when compared to using a configuration file. Answer C is incorrect because this option requires the program to be recompiled each time the value of TRACE is modified.

Question 19

The correct answer is C. The Locals window gives you the most convenient access because it automatically displays the names and values of all the variables local to the current method under execution. Answer A is incorrect because the Me window enables you to examine the members associated with the current object. Answer B is incorrect because the Autos window displays names and values of all variables in the current statement and the previous statement, rather than the current method. Answer D is incorrect because you need to add variables explicitly to the Watch window.

Question 20

The correct answer is B. Breakpoints and other debugging features are not enabled in the Release configuration. Answer A is incorrect because selecting a value from the combo box does fire the SelectedIndexChanged event. Answer C is incorrect because the Conditional attribute will include or exclude the method altogether from compilation. However, based on the observation in the question, the event handler does get executed. Answer D is incorrect because this Public Const declaration will not affect debugging at all.

Question 21

The correct answer is C. The TRACE symbol is defined in both the Debug and the Release configurations. Answers A, B, and D are incorrect because only the DEBUG symbol is defined in the Debug configuration.

Question 22

The correct answer is D. When a control is docked to an edge of its container, it is always repositioned against that edge when the container is resized. Answers A and C are incorrect because anchoring the control will not resize and reposition the toolbar to the top edge of the form. Answer B is incorrect because the question does not require other developers to set the Dock property.

Question 23

The correct answer is A. The Web Service Discovery tool uses the information in the ASMX file to locate the other important files for the Web service, including the WSDL file that specifies the Web service's interface. Answer B is incorrect because opening the file in the Web browser will only allow you to test the Web service providing information about simple data types. The Web browser will not be able to provide the full interface of the Web service. Answer C is incorrect because the XML Schema Definition tool is used to generate a schema or classes from the XML and XSD files. Therefore, this tool will be of no help for the ASMX file. Answer D is incorrect because you need to know the interface of the Web service to call its Web methods ; copying the ASMX file to your client project will not be of any help.

Question 24

The correct answer is D. Adding the WebMethod attribute to a public method makes it callable from remote Web clients . Answer A is incorrect because methods can be part of the public interface of a Web service. Answer B is incorrect because the WebService attribute is applied to the Web service class, not Web service methods. Answer C is incorrect because Web service methods can return any data type.

Question 25

The correct answer is D. Using the callback is the most efficient way to manage usage of your threads because the callback methods do not block threads while waiting for the response. Answers A and C are incorrect because the WaitHandle.WaitAll and WaitAny methods will block the threads until the Web service calls have completed. Answer B is also incorrect. The End method will not return until the asynchronous operation is complete because this method uses IAsyncResult.AsyncWaitHandle to check for Web service completion.

Question 26

The correct answer is A. Only the CompareInfo object will correctly handle the search in all character sets, including those that use 2 bytes per character. Answer B is incorrect because the Array.Sort method does not locate substrings. Answers C and D are incorrect because the String.IndexOf and String.IndexOfAny methods can find substrings but are not "culture aware."

Question 27

The correct answer is A. The invariant culture provides a culture-neutral storage format for information that will not be directly displayed to an end user but may need to be used from many different locales. Answers B, C, and D are incorrect because these answers are specific to a particular culture.

Question 28

The correct answer is A. The application will use resources from the MyApp.fr.resx file. Answers B and C are incorrect because the application specifically searches for the fr-CA culture instead of the fr-FR or en-US culture. Answer D is incorrect because if resources from a specific culture are not found, the .NET Framework will fall back to using resources from the appropriate neutral culturein this case, the fr culture.

Question 29

The correct answer is A. You should allow the user to select a culture from a list. Answer B is incorrect because allowing the user to choose a culture is better than accepting the existing culture of the application, because the user might be running on a version of Windows that's not appropriate for his culture. Answers C and D are incorrect because there's no need to prompt for or store a numeric format when all necessary formats are stored in the .NET Framework.

Question 30

The correct answer is C. This variation gives the best performance because it specifies the destination size of the image, thereby avoiding any autoscaling of the image. Answer A, B, and D are incorrect because in the absence of the information about the destination size of the image, the DrawImage method needs to perform extra processing. Therefore, the image is drawn slowly.

Question 31

The correct answer is B. When you want to check whether code has a particular privilege, you need to perform code access security. Answer A is incorrect because the application requires access to the Event Log regardless of who is using the application. Answers C and D are incorrect because type safety and encryption do not relate to the Event Log.

Question 32

The correct answer is C. In Visual Basic .NET, you can use the String object as a buffer that can be modified by the API. However, because the code in question supplies a zero-character buffer to the API, you should initialize the string to hold the returned data; after initializing the string, you should also set the length of the buffer in the variable len. Answer A is incorrect because all computers are identified by a name on the network. Answer B is incorrect because even a String object can be used in this case. Answer D is incorrect because you can use the Declare statement or the DllImport attribute to declare the API function.

Question 33

The correct answer is B. Using the Type Library Importer tool allows you to place the RCW assembly in the GAC so that it can be shared by all projects on the computer. Answers A and D are incorrect because the component is being used by multiple projects and therefore should be placed in the GAC. Answer C is incorrect because a Primary Interop Assembly is used for code from other vendors , not for your own code.

Question 34

The correct answer is A. You need to set PrintPageEventArgs.HasMorePages to True in the PrintPage event when there are more pages to be printed in the current print job. Answers B and C are incorrect because if either were the case, all printed pages would be affected instead of only the first page. Answer D is incorrect because there is no need to call a separate Print method to print every page of the document.

Question 35

The correct answer is C. The AccessibleName property is used to set the name used by accessibility applications such as a screen reader. Answers A and B are incorrect because these properties are not used by accessibility applications. Answer D is incorrect because the AccessibleRole property is used to specify a role for an accessible object instead of the name.

Question 36

The correct answer is C. When you use the Close method of a SqlConnection object, the connection is closed, all pending database transactions are rolled back, and the connection is returned to the connection pool. Answer A is incorrect because reusing an instance after you have called the Dispose method may result in undesirable effects. In general, you should use the Close method rather than the Dispose method if you might want to reuse the connection instance. Answer B is incorrect because you should generally call the Finalize method only when you need to release unmanaged resources. Answer D is incorrect because setting the SqlConnection object to Nothing will not actually close the connection, but the object will continue to exist in memory, waiting for garbage collection.

Question 37

The correct answer is D. The DataSetName property of a DataSet object sets the name of the DataSet . The value of this property is rendered as the root element of the XML file. Answer A is incorrect because the Namespace property specifies the namespace of the DataSet object. Answer B is incorrect because the Locale property specifies the culture information to be used for string comparisons within the tables. Answer C is incorrect because the Prefix property specifies an XML prefix that is used as an alias for the namespace of the DataSet object.

Question 38

The correct answer is C. A DataRelation object is used to relate two DataTable objects to each other. Answers A and B are incorrect because just defining primary keys or foreign keys on the table will not relate the tables. Answer D is incorrect because the DataSet.Merge method is used to merge two DataSet objects, which is not a requirement in this case.

Question 39

The correct answer is B. The XmlValidatingReader object allows you to validate an XML document. You use its ValidationEventHandler event to set an event handler for receiving information about the schema-validation errors. Answer A is incorrect because the XmlDocument object cannot validate the XML document on its own. Answer C is incorrect because the EnforceConstraints property of the DataSet is used to specify whether the database constraint rules are followed when any update operation is attempted. Answer D is incorrect because the DataSet.MergeFailed event occurs only when the target and source DataRow objects have the same primary key value and EnforceConstraints is set to True.

Question 40

The correct answer is B. The LIKE clause determines whether a given character string matches a specified pattern. You use the % character to work as the wildcard character. Answer A is incorrect because you need to use the LIKE clause instead of the IN clause for pattern searching. Answers C and D are incorrect because you need to use % as the wildcard character for matching instead of the * character.

Question 41

The correct answer is D. OleDbDataReader allows you to read the data one row at a time in a forward-only fashion; therefore, it occupies less memory and improves performance of your application. Because the question requires you to read the data in a sequential fashion and write it to the flat file, the OldDbDataReader object is the best option. Answer A is incorrect because a DataSet object loads the entire retrieved data into memory. Answer B is incorrect because you cannot retrieve the data directly into a DataTable object. Answer C is incorrect because a SqlDataReader object is optimized to work with SQL Server 7.0 and later versions.

Question 42

The correct answer is C. Within the Enterprise level, the permission set granted to the CalculateTax assembly is the union of all the permission sets of code groups on the Enterprise level to which it belongs (that is, the All Code and Company Code groups). Therefore, CalculateTax receives the Everything permission at the Enterprise level. At the Machine level, the assembly is a member of only the Restricted Code group and therefore receives the LocalIntranet permission. Because the code group on the Machine level is marked with the LevelFinal property, the code group on the User level is not taken into account when determining the permission set for this assembly. Now to determine the permission set granted to the CalculateTax assembly, you need to determine the intersection of all the permission sets of the levels applicable to the assembly. Therefore, the assembly is granted LocalIntranet, the intersection of Everything and LocalIntranet. Answer A is incorrect because Everything is the permission set for only the Enterprise level. Answer B is incorrect because Internet is the permission set for the code originating from the Internet. Answer D is incorrect because the User level is not taken into account because the LevelFinal property is Yes for the Machine level.

Question 43

The correct answer is D. Because other operations on the database, such as add and update, are working fine, chances are the DeleteCommand property is not set. The DeleteCommand property should be set to a command that deletes rows from the database. Answers A and C are incorrect because if either were the case, none of the changes would be saved. Answer B is incorrect because the Update method updates the underlying database with the changes made to the DataSet .

Question 44

The correct answer is A. The XmlTextWriter object is especially designed to write XML files. Answer B is incorrect because XmlWriter is an abstract class and must be implemented before you call methods from it. Answer C, D, and E are incorrect because when you use these objects, you'll have to write additional code for writing the XML structure.

Question 45

The correct answer is D. This is the only SQL statement that will execute successfully. Answer A is incorrect because it does not indicate that @SalesID is an output parameter. Answers B and C are incorrect because they attempt to insert values into the identity column rather than let SQL Server assign the new value.

Question 46

The correct answer is C. The Read method returns the number of bytes read. Therefore, answers B and D fail when there is 1 byte in the file. The Read method reads to a byte array. Therefore, answers A and B fail because the buffer has the wrong data type.

Question 47

The correct answers are A, B, and C. To be listed in the Windows catalog, an application must meet the requirements mentioned in the specifications of the Windows logo program. Answer D is incorrect because you are not required to fix all known bugs to be listed in the Windows catalog.

Question 48

The correct answer is C. By default, XML attributes do not appear as part of the XmlNodes collections traversed by the FirstChild and NextChild methods. Answers A and B are incorrect because if either were the case, you would not be able to load the file into an XmlDocument object. Answer D is incorrect because HasChildNodes is automatically set by the .NET Framework.

Question 49

The correct answer is B. When an application calls the Update method, the SqlDataAdapter object examines the RowState property and executes the required InsertCommand , UpdateCommand , or DeleteCommand statements iteratively for each row of the data. After the changes are written to the database, you need to call the DataTable.AcceptChanges method to remove the deleted rows and then set the RowState property of the added and modified rows to Unchanged. Answer A is incorrect because if you first call the AcceptChanges method, the RowState for all the added and modified rows will be marked Unchanged, and all the deleted rows will be removed. Later, when you call the Update method, the SqlDataAdapter object will not be able to update the database because the RowState property of the rows will be Unchanged. Answers C and D are incorrect because the Reset method restores the DataTable to its original state, and the updates made to the table are lost in the DataTable object.

Question 50

The correct answer is B. The classes in the System.Data.SqlClient namespace provide the best performance when working with SQL Server data because these classes can communicate with the SQL Server database directly using the SQL Server tabular data stream (TDS) packets. Answer A is incorrect because the classes in the System.Data.OleDb namespace call a set of COM components (an OLE DB provider), which constructs the TDS packets to communicate with the SQL Server. Answer C is incorrect because XML Web services will have a lot of additional overhead when compared to a direct connection to the SQL Server database. Answer D is incorrect because calling COM components will involve an extra COM-Interop layer and will slow down the operation.

Question 51

The correct answer is A. The PrimaryKey property of the DataTable object specifies an array of columns that functions as the primary key for the data table. Answer B is incorrect because the PrimaryKey property is a type of array of DataColumn objects, not String . Answer C is incorrect because the PrimaryKey property accepts an array of DataColumn objects, which does not provide any Add method. Answer D is incorrect because even if the primary key is a single column, an array of DataColumn objects must be used with the PrimaryKey property.

Question 52

The correct answer is D. SecurityAction.RequestRefuse ensures that permissions that might be misused will not be granted to the calling code. Answers A, B, and C are incorrect because these settings are used to request permissions instead of refusing permissions.

Question 53

The correct answer is D. You must tell the CLR how users are authenticated, even when you are using a Windows application that automatically employs Windows authentication. Answers A, B, and C are incorrect because they do not specify the authentication mode.

Question 54

The correct answer is A. The hash codes are calculated from the MSIL code of an assembly, so changing the assembly's content changes its hash code. Answer B, C, and D are simply incorrect.

Question 55

The correct answers are A and D. The native assemblies will load faster for the first time because ngen.exe has already done the work that the JIT compiler would normally do when executing the application for the first time. The ngen.exe tool also provides a /debug switch that can be used to generate native assemblies for debugging scenarios. Answer B is incorrect because for subsequent executions the native assemblies would show the same performance as their JIT-compiled equivalents. Answer C is incorrect because the natively generated assemblies are processor specific and are not portable across different processor architectures.

Question 56

The correct answer is D. The RaiseEvent statement raises the specified event. RaiseEvent checks whether any event handlers are registered for the event and passes the parameters list to these event handlers. Therefore, if the event handlers expect to receive any arguments, you must supply them while invoking this statement. Answer A is incorrect because the argument list does not match the signature defined by the Delegate ChangedEventHandler . Answers B and C are incorrect because the name of the event is Changed rather than ChangedEventHandler .

Question 57

The correct answer is C. Because the components are being used between several games published by your company, they are good candidates to be placed in the Global Assembly Cache of the target machine, but before a component can be placed in the GAC it must be signed using the Strong Name tool ( sn.exe ). Your company is also deploying software over the Internet; in this case, it is a good idea to digitally sign your code with a software publisher's certificate obtained by a respected Certificate Authority. Once you obtain the certificate, you can use signcode.exe to sign your component. When you are using both sn.exe and signcode.exe with your assembly, you should always use sn.exe before using signcode.exe . Answers A and B are incorrect because you need to use both tools instead of just one of them. Answer D is incorrect because sn.exe should be used before signcode.exe .

Question 58

The correct answers are A, B, and C. To copy the Readme.txt file to the installation directory selected by user at install time, you add it to the Application Folder in the file system on the target machine. You will first create a shortcut to the Readme.txt file stored in the Application Folder in the file system on the target machine. Then you will move this shortcut from the Application Folder to the user's desktop in the file system on the target machine. Answer D is incorrect because you need to place a shortcut on the user's desktop instead of the file itself. Answer E is incorrect because the Readme.txt file is originally present in the Application Folder instead of the user's desktop.

Question 59

The correct answer is D. The mscoree.dll file is the core file of the Common Language Runtime. If the user is getting the specified error message, the most likely reason is that the .NET Framework is not installed or is not properly installed on the user's computer. Answer A is incorrect because a similar installation is working on other computers. Answers B and C are incorrect because mscoree.dll is not a part of Internet Explorer 6.0 or MDAC 2.7, and reinstalling those applications will not resolve the problem.

Question 60

The correct answers are C and D. Merge module projects are used to create reusable setup components. Because the Warehousing application is the only application using the component, you should copy the component to the Warehousing application. You can now create a Setup project to deploy the application and component. Answers A and B are incorrect.



Developing and Implementing WindowsR-based Applications with Visual BasicR. NET and Visual StudioR. NET Exam CramT 2 (Exam 70-306)
Developing and Implementing WindowsR-based Applications with Visual BasicR. NET and Visual StudioR. NET Exam CramT 2 (Exam 70-306)
ISBN: N/A
EAN: N/A
Year: 2002
Pages: 188

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