Answer Key

1. D

2. C

3. D

4. D

5. B

6. A

7. D

8. A

9. D

10. C

11. C

12. A and D

13. C

14. C

15. B and D

16. A

17. A and D

18. D

19. C

20. B

21. C

22. B

23. D

24. A

25. D

26. C

27. C

28. B

29. C and E

30. A

31. A and D

32. D

33. C

34. D

35. A

36. B and D

37. D

38. D

39. B

40. C

41. D

42. B

43. C

44. D

45. A

46. C

47. A and E

48. A

49. C

50. D

51. A and D

52. A

53. A

54. A

55. D

56. B

57. C

58. B

59. A, C and D

60. B

Question 1

The correct answer is D. The DataView class represents a data-bindable, customized view of a DataTable that is optimized for sorting, filtering, searching, editing, and navigation. Answers A and B are incorrect because these actions will impact SQL Server with additional hits, thereby decreasing performance. Answer C is incorrect because it is complicated and requires additional programming, and you were asked to present a solution that requires minimal programming.

Question 2

The correct answer is C. Although answers C and D both use the correct syntax of the Fill method, the question clearly states the name of the table, so it is recommended that you use the name of the table when filling the DataSet . Therefore, answer D is incorrect. Answer A is incorrect because there isn't an overload of the Fill method that accepts a single string parameter. Answer B is incorrect because there isn't an overload of the Fill method that accepts two string parameters.

Question 3

The correct answer is D. Using the same connection string enables ADO.NET to reuse existing pooled database connections instead of creating new ones. This improves performance because creating new database connections is a costly operation. Answer A is incorrect because users are facing slow performance consistently, not just during the first execution. Answer B is incorrect because another application that uses the same database is already performing well. Answer C is incorrect because if different connection strings are used, each request for a connection will create a new connection pool. Therefore, increasing the maximum size of the pool will not increase the performance of the application.

Question 4

The correct answer is D. When you set the XmlWriteMode parameter of the DataSet.WriteXml method to DiffGram , the output contains both original and current values. Answer A is incorrect because the DataSet.WriteXmlSchema method writes the DataSet structure as an XML schema instead of writing XML data. Answers B and C are also incorrect. Although the DataSet.WriteXml method writes the DataSet as an XML file via the XmlWriteMode parameter being set to IgnoreSchema or WriteSchema , it writes only the current value of the data to the XML file.

Question 5

The correct answer is B. IsolationLevel.Serializable places a range lock on the database, preventing other users from updating or inserting rows into the database until the transaction is complete. Answer A is incorrect because IsolationLevel.ReadCommitted holds the lock while the data is being read, but data can be changed before the transaction is complete. Answers C and D are incorrect because the BeginTransaction method is available for objects of the SqlConnection type but is not available for objects of the SqlCommand type.

Question 6

The correct answer is A. The ColumnMapping property determines how a column's values will be written when the WriteXml method is called on a DataSet to write output to an XML document. When you set the ColumnMapping property of a column to MappingType.Attribute , that column of the table is then mapped to an XML attribute. Answer B is incorrect because setting the ColumnMapping property of the column to MappingType.Element maps that column of the table to an XML element. Answers C and D are incorrect because XmlWriteMode.WriteSchema specifies the WriteXml method to write the current contents of the DataSet as XML data along with the relational structure as an inline XSD schema. Writing an additional schema is not required in the question.

Question 7

The correct answer is D. Strings in Visual Basic .NET are immutable, so concatenating multiple values into a string requires deleting and re-creating the string many times. The StringBuilder object is optimized for changing textual data. Answer A is incorrect because a SqlConnection object is more optimized than an OleDbConnection object for accessing a SQL Server 7.0 database. Answer B is incorrect because stored procedures have much higher performance than SQL statements. Answer C is incorrect because for a forward-only, read-only operation, the SqlDataReader object provides the best performance.

Question 8

The correct answer is A. You can only have a single SqlDataReader object open on a single SqlConnection object. If you need a second SqlDataReader object, you must open a second SqlConnection object. Answers B and C are incorrect because the question asks for the likely cause for the error, not just an alternative approach. Answer D is incorrect because you want to retrieve multiple values from the database, but the ExecuteScalar method only retrieves the first column of the first row in the result set.

Question 9

The correct answer is D. Changes made to a DataGrid control that's bound to a DataSet are automatically saved to the DataSet . However, these changes are not updated to the underlying data source until you call the Update method of the DataAdapter object that was used to fill the DataSet . Answers A and C are incorrect because the DataGrid control does support editing the data from a database and two-way data binding. Answer B is incorrect because a DataSet , which is based on a view, can be updated.

Question 10

The correct answer is C. Calling the GetChanges method of a DataSet returns a new DataSet that contains only records that have been changed. Answer A is incorrect because the DataSet.Clone method copies the structure of the DataSet but does not copy any data. Answer B is incorrect because the DataSet.Copy method copies all the data instead of only the changed data. Answer D is incorrect because you do not want to merge two DataSet objects.

Question 11

The correct answer is C. The SqlCommand.Prepare method creates a prepared version of the command on an instance of SQL Server. Once the command has been prepared, further execution of that command will be comparatively faster. Answer A is incorrect because the SqlCommand.ExecuteReader method is generally used to execute query statements such as SELECT rather than non-query statements such as INSERT . Answer B is incorrect because if SQL Server needs to prepare the command with each execution, performance will decrease instead of increase. Answer D is incorrect because the SqlCommand.ResetCommandTimeout method just resets the CommandTimeout property to its default value and does not play a role in optimizing the performance in the given scenario.

Question 12

The correct answers are A and D. In the current scenario, the XmlReadMode.Auto and XmlReadMode.InferSchema options will infer a schema from the data. Answer B is incorrect because the data in Orders.xml is not a DiffGram . Answer C is incorrect because when XmlReadMode is set to Fragment , the default namespace is read as the inline schema. Answer E is incorrect because when XmlReadMode is set to ReadSchema and the DataSet does not contain a schema, and no inline schema exists, then no data is read.

Question 13

The correct answer is C. To create a connection string for a SqlConnection object that uses Windows Integrated Authentication, you need to specify the data source and the initial catalog as well as indicate that the connection is secure. You can indicate this is a secure connection by setting the Trusted_Connection or Integrated Security parameter to True or SSPI, respectively. Answers A and B are incorrect because you do not specify the provider in the connection string when connecting through the SqlConnection object. Answer D is incorrect because you need to use Windows authentication instead of SQL Server authentication.

Question 14

The correct answer is C. Using the DataView.RowFilter property provides an easy mechanism to retrieve selected rows from the database. Answers A and D are incorrect because these answers require maintenance programming every time the list of departments changes. Answer B is incorrect because it will retrieve more data than necessary over the slow WAN line.

Question 15

The correct answers are B and D. If you use a container control, such as GroupBox, Panel, or TabControl, to contain the data-bound controls, you can create a BindingContext for just that container control and its controls. This allows each part of your form to be managed by its own BindingManagerBase object. In order for things to work correctly, you need to make sure you are using the CurrencyManager from the correct BindingContext object. Answer A is incorrect because a Windows form can easily contain more controls than specified in the given scenario. Answer C is incorrect because all CurrencyManager objects support a Position property.

Question 16

The correct answer is A. The three parameters of the ControlBindingsCollection.Add method are the name of the control property to bind to, the data source to bind, and the navigation path to the particular data to bind. Therefore, in this case, the Text property of the TextBox control should be data-bound to the OrderStatus field of the Order table in the dsOrders data source. Answer B is incorrect because an empty string is passed to the last parameter only if the data source contains one property or one piece of data to bind. Answer C is incorrect because the last parameter to the Add method should specify the complete navigation path of the property or data to which the control should bind. Answers D, E, and F are incorrect because to display the status in the text box, you need to bind to the Text property instead of the Tag property of the TextBox control.

Question 17

The correct answers are A and D. The Sort property of a DataView object is a string containing the column name followed by ASC ( ascending ) or DESC (descending). Columns are sorted ascending by default. Answer B is incorrect because you must specify the name of a column in the Sort property along with ASC or DESC . Answer C is incorrect because the ApplyDefaultSort property is used to automatically create a sort order, in ascending order, 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.

Question 18

The correct answer is D. To return a single value from the database, you should use the ExecuteScalar method of the OleDbCommand object. The ExecuteScalar method executes the query and retrieves the first column of the first row of the result set. You should always prefer stored procedures over ad-hoc SQL statements for speedy delivery. Answers A, B, and C are incorrect because they use SQL queries rather than stored procedures. Answers E and F are incorrect because they involve extra overhead if only a single value is to be returned from the database.

Question 19

The correct answer is C. The KeyDown event occurs before the KeyPress event. Setting the Handled property to True in the form's KeyPress event prevents the control's KeyPress event from firing. As a result, the first message is displayed from the textBox1_KeyDown event handler and the next message is displayed by the form_KeyPress event handler. Answer A is incorrect because the KeyDown event occurs before KeyPress . Answer B is incorrect because the textBox1_KeyPress event handler is not executed. Answer D is incorrect because the KeyPreview property of form1 is set to True, which causes the form1_KeyPress event handler to be invoked.

Question 20

The correct answer is B. The easiest way to get a control to behave precisely like a TextBox control is to derive it from the TextBox class. Answers A, C, and D are incorrect because they require additional code to be written.

Question 21

The correct answer is C. Dynamic properties provide a built-in mechanism for setting them at runtime without needing to write any code. Answers A and B are incorrect because asking the users to modify the program source code or Windows Registry may have undesirable effects. Answer D is incorrect because this option will require writing additional code to retrieve a form's text from a file.

Question 22

The correct answer is B. The UserControl class provides you with a design surface on which you can assemble constituent controls to create a custom control. Answer A is incorrect because it requires you to write additional code. Answer C is incorrect because deriving from the Form class is not a standard way to create reusable controls. Answer D is incorrect because using the Component class to create reusable visual components requires additional programming and is therefore better suited for creating nonvisual components .

Question 23

The correct answer is D. You should set the CausesValidation property of the Button control to False because this causes the Validating event of other controls to be ignored when the focus is shifted to the specified control. Answers A and C are incorrect because setting the CausesValidation property of a TextBox control will not have any effect on the Button control. Answer B is incorrect because setting the CausesValidation property of the Button control to True will not allow the user to click the button when there is invalid data in the text box.

Question 24

The correct answer is A. If a CheckBox control has its ThreeState property set to True, then its Checked property will return True even if the check box is in the indeterminate state. Answer B is incorrect because you must evaluate the CheckState property to determine whether the check box is actually checked. Answers C and D are incorrect because you want to take an action only when the user checks the CheckBox control.

Question 25

The correct answer is D. Using the ResizeRedraw property requires less code and causes the form to refresh instantly. Answer A is incorrect because calling the Invalidate method periodically will not refresh the form instantly. Answer B is incorrect because this approach requires you to write more code. Answer C is incorrect because the Invalidate method triggers the Paint event, so calling it within the Paint event leads to an infinite regress.

Question 26

The correct answer is C. Setting the TabStop property of the controls to False removes them from the tab order. Answers A and B are incorrect because they will just change the order of the controls instead of removing them from the tab order. Answer D is incorrect because if you set the Enabled property of the controls to False, they cannot receive the focus under any circumstances.

Question 27

The correct answer is C. Using the Or operator sets the proper bit to represent the italic font style without altering any other bits that may already be set. Answers A, B, and D are incorrect because these options cause additional bits to be set, resulting in an undesired font style.

Question 28

The correct answer is B. You should avoid writing duplicate code if you don't have to. However, the Click and MouseMove event handlers of the Button control have different signatures. Therefore, you need to write two event handlers. The first will handle both Click events, and the second will handle both MouseMove events. Answer A is incorrect because this approach will require a lot of code to be written. Answers C and D are incorrect because the Click and MouseMove event handlers have different signatures and must be written separately.

Question 29

The correct answers are C and E. Using a Class Library project is the best way to package a set of standard classes. If you do not want a class to be inherited, it must be declared as NotInheritable . Answers A and B are incorrect because these are not the appropriate project types for the given scenario. Answer D is incorrect because you are writing classes with the implementation logic. Answers F and G are incorrect because if the classes are defined with the Private modifier, other developers will not be able to instantiate them.

Question 30

The correct answer is A. The Protected modifier limits member access to the class containing the member and to subclasses of that class. Answer B is incorrect because the Public modifier allows any class to call the member. Answer C is incorrect because the Private modifier limits access to the defining class only. Answer D is incorrect because the Friend modifier limits access to classes within the same project, regardless of whether they are derived from the defining class.

Question 31

The correct answers are A and D. You need to sign a shared assembly with a strong name and then install the assembly in the Global Assembly Cache. Answer B is incorrect because you use sn.exe instead of signcode.exe to sign an assembly with a strong name. Answer C is incorrect because the Windows system directory does not allow multiple versions of an assembly to be maintained .

Question 32

The correct answer is D. When a custom control does not require a runtime user interface, the Component class provides the lowest overhead. Answers A, B, and C are incorrect because they are more suitable for designing controls with a user interface.

Question 33

The correct answer is C. The MyBase keyword is used to access members of the base class from within a derived class. Answer A is incorrect because the given syntax is for invoking Shared members of a class. Answer B is incorrect because the Me keyword is for accessing the members of the current class. Answer D is incorrect because of its invalid syntax.

Question 34

The correct answer is D. An exception will be handled by the most specific, applicable Catch block, and the Finally block will always be executed. Answers A and B are incorrect because the Finally block always executes. Answer C is incorrect because a division-by-zero arithmetic exception is thrown before the Debug.WriteLine method is executed in the Try block.

Question 35

The correct answer is A. The SqlException.Class property gets a value from 1 to 25 that indicates the severity level of the error. Answer B is incorrect because the SqlException.Source property gets the name of the provider that generated the error. Answer C is incorrect because the SqlException.Server property gets the name of the computer running an instance of SQL Server that generated the error. Answer D is incorrect because the SqlException.State property gets a numeric error code from SQL Server that represents an error, warning, or "no data found" message.

Question 36

The correct answers are B and D. Either of these options can generate proxy classes for use in a client application. Answer A is incorrect because the .NET WebService Studio tool is used to invoke a Web service for testing. Answer C is incorrect because the Web Services Discovery Tool can locate files related to a Web service, but it does not generate any proxy classes.

Question 37

The correct answer is D. Answers A, B and C are incorrect because calls to a Web service will block other processing, unless you use asynchronous calls to invoke the Web service.

Question 38

The correct answer is D. When the RightToLeft property value is set to RightToLeft.Yes , the horizontal alignment of the control's elements is reversed . Answers A and C are incorrect because the RightToLeft property is of the type System.Windows.Form.RightToLeft , which specifies a value indicating whether the text appears from right to left, such as when Hebrew or Arabic fonts are used. Answer B is incorrect because you need to make minimal changes.

Question 39

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 you need to use the component in more than one project. Answer C is incorrect because a Primary Interop Assembly is for code from other vendors , not for your own code.

Question 40

The correct answer is C. The SetHelpString method specifies the help string associated with the specified control. Answer A is incorrect because the SetHelpKeyWord method only specifies the keyword used to retrieve the help text associated with a control. Answer B is incorrect because the SetHelpNavigator method specifies the help command to use while retrieving the text from the help file. Answer D is incorrect because the SetShowHelp method only specifies whether help is displayed for the specified control.

Question 41

The correct answer is D. The QueryPageSettings event fires before each page is printed and allows you to check and change page settings. Answers A and B are incorrect because you do not have access to the PageSettings objects in the event arguments of the BeginPrint and EndPrint events. Answer C is incorrect because the event arguments of the PrintPage event provide read-only access to the PageSettings objects.

Question 42

The correct answer is B. You can step into a stored procedure execution directly from within Visual Studio .NET. Answer A is incorrect because the Tools, Debug Processes menu item is useful for debugging running processes, not stored procedures. Answer C is incorrect because this option will take more time and effort. Answer D is incorrect because the Debug.WriteLine method cannot directly access the stored procedure values.

Question 43

The correct answer is C. Breakpoints are invoked only when the project's configuration is in Debug mode. Answer A is incorrect because the Exceptions dialog box is used to configure the breakpoint only in case of an exception. Answer B is incorrect because when you place a breakpoint, it is enabled by default. Answer D is incorrect because the project's configuration should be Debug instead of Release for debugging to occur (that is, for breakpoints to be executed).

Question 44

The correct answer is D. A conditional breakpoint lets you pause your code only when a particular condition is true. In this case, you can use that capability to break into the code when the variable has the value of 117. Answers A, B, and C are incorrect because they do not work conditionally.

Question 45

The correct answer is A. The Task List window helps you identify and locate problems, which are detected automatically as you edit or compile code. Answer B is incorrect because it mixes other messages along with the error messages generated by the compiler. Answer C is incorrect because the Find Results window displays matches for text searches that were performed in the Find in Files dialog box. Answer D is incorrect because the Immediate window is used for debugging purposes, such as evaluating expressions, executing statements, printing variable values, and so forth.

Question 46

The correct answer is C. The Auto modifier is necessary to tell the CLR to use the ANSI or Unicode version of the function, as appropriate. Answer A is incorrect because kernel32.dll is already at a well-known location. Answers B and D are incorrect because these solutions will work on a particular version of Windows but not on other versions.

Question 47

The correct answers are A and E. If you want multiple applications to use an assembly, you need to sign the assembly with a strong name and place the assembly into the Global Assembly Cache. Answer B is incorrect because a COM application is not using the assembly. Answer C is incorrect because assemblies cannot be deployed into the Global Assembly Cache with the XCOPY command. Answers D and F are incorrect because shared assemblies must be installed into the Global Assembly Cache instead of the Windows system directory.

Question 48

The correct answer is A. To enable remote debugging on a computer, you must install the Machine Debug Manager ( mdm.exe ). You can install this software by installing Visual Studio .NET on the remote machine or by installing the Remote Components Setup on the remote machine. Answer B is incorrect because Visual Studio .NET does support cross-domain debugging, provided a two-way trust relationship exists between the domains. Answer C is incorrect because how the remote process was compiled does not matter for debugging. Answer D is incorrect because no switch needs to be added in the application's configuration file for remote debugging.

Question 49

The correct answer is C. Applications always bind to the assemblies with which they are compiled. If a developer wants to execute a new version of the assembly, he should either recompile his application with the new version of the assembly or modify the application configuration file to redirect to a new version of the assembly. Therefore, answers A, B, and D are incorrect.

Question 50

The correct answer is D. A Merge Module project allows you to create reusable setup components by packaging all the required files, resources, Registry entries, and setup logic necessary to install a component. Answer A is incorrect because a Cab project creates a cabinet file for downloading from a Web browser. Answer B is incorrect because a Setup project creates an installer for a standalone Windows-based application. Answer C is incorrect because a Web Setup project creates an installer for a standalone Web application.

Question 51

The correct answers are A and D. Full installation of Windows XP Service Pack 1 includes the installation of the .NET Framework; therefore, you can safely choose to exclude the deployment of the .NET Framework from the setup package. This will reduce the size of the setup package to a good extent. To further reduce the size, you can choose to optimize the setup package for size. Answer B is incorrect because setting the Exclude property to False will include .NET Framework and increase the size of the setup package. Answer C is incorrect because changing the packaging to cabinet files will not reduce the size of the setup package.

Question 52

The correct answer is A. You need to change the Author property of the deployment project because the Author property specifies the name of the application's author. Answer B is incorrect because the Description property is usually used to describe the application instead of to specify the name of the publisher. Answers C and D are incorrect because they are intended to specify the phone number and the URL of the manufacturer instead of the name.

Question 53

The correct answer is A. You can use the Custom Actions Editor to take custom actions such as database installation during the application setup. If you have an installer class or program that needs to create a database, you must override the Install method of the base class and must add the installer program to the Install node of the Custom Actions Editor. Answer B is incorrect because you need to add the component to the Install node instead of the Commit node. Answer C is incorrect because copying the InstData.sql file will not help; you also need to execute this file on SQL Server, and you need to create a custom installation component for the same. Answer D is incorrect because the Launch Conditions Editor is used to specify the prerequisite conditions that must be met in order to successfully run an installation; it cannot be used to execute custom actions.

Question 54

The correct answer is A. The enterprise security policy affects every computer and user on the network. Answer B is incorrect because this option will require modifying the machine security policy for each machine in the company. Answer C is incorrect because the user security policy only applies to a single logon account. Answer D is incorrect because the security policy at the application domain level cannot be administered.

Question 55

The correct answer is D. The name of the application configuration file should be X.config , where X is the name of the application (including file extension). An application will read the settings from the application-configuration file only if both the files are present in the same directory. Answers A and B are incorrect because the name of the configuration file is incorrect. Answer C is incorrect because the deployment directory of the application configuration file is incorrect.

Question 56

The correct answer is B. The SecurityAction.RequestOptional action is used to request additional permissions that are optional. Answer A is incorrect because SecurityAction.RequestMinimum requests the minimum permissions required for code to run. Answer C is incorrect because SecurityAction.Demand requires all callers higher in the call stack to have been granted the permission specified by the current permission object. Answer D is incorrect because SecurityAction.RequestRefuse is used to refuse those requests that might be misused.

Question 57

The correct answer is C. You should use the Process.CloseMainWindow method to shut down applications that have a user interface because this method gives the application a chance to clean up resources. Answer A is incorrect because although the Process.Kill method also shuts down the application, it does not perform any normal cleanup processing. Answer B is incorrect because instead of shutting down the process, the Process.WaitForExit method will wait indefinitely for the associated process to exit. Answer D is incorrect because instead of shutting down the process, the Process.WaitForInputIdle method will wait for the associated process to enter an idle state.

Question 58

The correct answer is B. For BooleanSwitch , a value of 0 corresponds to Off (False), and any nonzero value corresponds to On (True). For TraceSwitch , any value greater than 4 is treated as "verbose." From the given values in the configuration file, the booleanSwitch object will have its Enabled property set to True, and the traceSwitch object will have its Level property set to TraceLevel.Verbose . Answers A, C, and D are incorrect because the booleanSwitch.Enabled property should be True instead of False.

Question 59

The correct answers are A, C, and D. When you add a listener to the Trace.Listeners collection, it listens to the messages generated by both the Trace and Debug classes. When the new listener is added, it is added to the Listeners collection. It already has a DefaultTraceListener object that sends messages to the output window, and it is still active and listening to the messages. Therefore, you have messages in TraceLog.txt as well as in the output window. Answer B is incorrect because listener objects listen to messages generated by both Debug and Trace classes.

Question 60

The correct answer is B. The TraceSwitch class provides a multilevel switch that allows you to control tracing and debugging output of a Windows application without recompiling the code. The changes in behavior can be instrumented by just changing the application's configuration file. Answer A is incorrect because TraceListener is used to redirect the output of the trace messages. Answers C and D are incorrect because Trace and Debug classes can print messages but cannot provide any control mechanism on which messages will be printed and which messages will not be printed.



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