70-306: Developing Windows Applications with Visual Basic .NET

1. You develop an application that enables users to enter and edit purchase order details. The 
application includes a Windows Form named DisplayPOForm. The application uses a 
client-side DataSet object to manage data. <br> 
The DataSet object contains a Data Table object named PODetails. This object 
includes one column named Quantity and another named UnitPrice. For each item 
on a purchase order, your application must display a line item total in a 
DataGrid control on DisplayPOForm. The line item is the product of Quantity 
times UnitPrice. Your database design does not allow you to store calculated 
values in the database. You need to add code to your Form_Load procedure to 
calculate and display the line item total. <br> 
Which code segment should you use? <br> 
<br> 
<br> 
<br> 
A. Dim totalColumn As New DataColumn(&quot;Total&quot;,Type.GetType(&quot;System.Decimal&quot;))<br> 
PODetails.Columns.Add(totalColumn) 
totalColumn.<b>Expression</b> = &quot;Quantity * UnitPrice&quot; <br> 
B. Dim totalColumn As New DataColumn(&quot;Total&quot;,Type.GetType(&quot;System.Decimal&quot;))<br> 
PODetails.Columns.Add(totalColumn)<br> 
totalColumn.Equals(&quot;Quantity * UnitPrice&quot;) <br> 
C. PODetails.DisplayExpression(&quot;Quantity * UnitPrice&quot;) <br> 
D. PODetails.DisplayExpression(&quot;quantityColumn + unitPriceColumn&quot;) <br> 

Answer: A 

*** Verified. We use the Expression property of the DataColumn object to 
calculate the values in the column.<br> 


2. Your company uses Visual Studio .NET to develop internal applications. You 
create a Windows control that will display custom status bar information. Many 
different developers in your company will use the control to display the same 
information in many different applications. The control must always be 
displayed at the bottom of the parent form in every application. It must always 
be as wide as the form. When the form is resized, the control should be resized 
and repositioned accordingly. <br> 
What should you do? <br> 

A. Create a property to allow the developers to set the Dock property of the 
control. Set the default value of the property to AnchorStyle.Bottom. <br> 
B. Create a property to allow the developer to set the Anchor property of the 
control. Set the default value of the property to AnchorStyle.Bottom. <br> 
C. Place the following code segment in the UserControl_Load event:<br> Me.Dock = 
DockStyle.Bottom <br> 
D. Place the following code segment in the UserControl_Load event: <br>Me.Anchor = 
AnchorStyle.Bottom 

Answer: C 

*** Verified. DockStyle.Bottom docks the control to the bottom of the form. 
This will force the control to be as wide as to form. Furthermore the control 
will be resized automatically.<br> 


3. You use Visual Studio .NET to develop applications for your human resources 
department. You create the following interfaces: <br> 
Public Interface IEmployee Property Salary() As Double <br> 
End Interface <br> 
Public Interface <br> 
IExecutive Inherits IEmployee<br> 
<br> 
Property AnnualBonus() As Double<br> 
<br> 
End Interface<br> 
<br> 
The IEmployee interface represents a generic Employee concept. All actual employees in your company 
should be represented by interfaces that are derived from IEmployee. Now you 
need to create a class named Managed to represent executives in your company. 
You want to create this class by using the minimum amount of code. <br> 
You write the following code: <br> 
Public Class Manager<br> 
<br> 
End class<br> 
<br> 
Which additional code 
segment or segments should you include in Manager? (Choose all that apply) <br> 
<br> 
<br> 
A. Implements IExecutive <br> 
B. Implements IEmployee, IExecutive <br> 
C. Inherits IExecutive <br> 
D. Inherits IEmployee, IExecutive <br> 
E. Property Salary() As Double Implements IExecutive.Salary <br> 
F. Property AnnualBonus() As Double Implements IExecutive.AnnualBonus <br> 

Answer: AEF 

*** Verified. The Manager Class only needs to inherit from the IExecutive 
class. The Manager class inherits the AnnualBonus property from the IExecutie 
class and the Salary property from the IEmployee class (since IExecutive 
inherits from IEmployee). There is no need to define any properties for the new 
class.<br> 
<br> 

4. Your development team is creating a new Windows-based application for a 
mortgage company. The application consists of a user interface and several XML 
Web services. You develop all XML Web services and perform unit testing. Now 
you are ready to write the user interface code. Because some of your servers 
are being upgraded, the XML Web service that provides mortgage rates is 
currently offline. However, you have access to its description file. You must 
begin writing code against this XML Web service immediately. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Generate the proxy class for the XML Web service by using Disco.exe. <br> 
B. Generate the proxy class for XML Web service by using Wsdl.exe. <br> 
C. Obtain a copy of the XML Web service assembly and register it on your local 
development computer. <br> 
D. Add the description file for the XML Web service to your Visual Studio .NET 
project. <br> 

Answer: B 

<br> 
*** Verified. Ordinarily to access an XML Web service from a client 
application, you first add a Web reference, which is a reference to an XML Web 
service. When you create a Web reference, Visual Studio creates an XML Web 
service proxy class automatically and adds it to your project. However, you can 
manually generate a proxy class using the XML Web services Description Language 
Tool, Wsdl.exe, used by Visual Studio to create a proxy class when adding a Web 
reference. This is necessary when you are unable to access the XML Web service 
from the machine on which Visual Studio is installed, such as when the XML Web 
service is located on a network that will not be accessible to the client until 
run time. You then manually add the file that the tool generated to your 
application project.<br> 
<br> 
<br> 

5. You develop a Windows-based application that includes the following code 
segment. (Line numbers are included for reference only.) <br> 
01 Public Sub password_Validating (ByVal sender As Object, ByVal e As 
System.ComponentModel.CancelEventArgs)<br> 
02 Handles password.Validating<br> 
03 If ValidPassword() False Then<br> 
04 'Insert new code. <br><br> 
05 End If <br> 

06 End Sub <br> 
You must ensure that users cannot move control focus away from textPassword if 
ValidPassword returns a value of False. You will add the required code on line 
4. <br> 
Which code segment should you use? <br> 
<br> 
<br> 
<br> 
A. e.Cancel = True <br> 
B. sender = textName <br> 
C. password.AcceptsTab = False <br> 
D. password.CausesValidation = False <br> 

Answer: A 

*** Verified. We cancel the validation of the control.<br> 
<br> 
<br> 

6. You develop a Windows-based application that contains a class named Contact. 
Contact contains an event named ContactSaved. Many Contact objects will be 
created from the Contact class and inserted into an array named Contacts. You 
create a custom method named HandleContactSaved in your application. You must 
ensure that your application calls HandleContactSaved whenever the ContactSaved 
event is fired for any of the Contact objects. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Use the WithEvents keyword to declare each Contact object. Add each Contact 
object to the Contacts array as it is created. <br> 
B. Add each Contact object to the Contacts array as it is created. Add the 
Handles keyword to HandleContactSaved. <br> 
C. Add each Contact object to the Contacts array as it is created. Assign 
HandleContactSaved to the Handle property of the HandleRef structure. <br> 
D. Add each Contact Object to the Contacts array as it is created. Call the 
AddHandler statement and pass the new Contact object and the address of 
HandleContactSaved. <br> 

Answer: D 
<br> 
*** Verified. The standard way to create an event handler is to use the Handles 
keyword with the WithEvents keyword.<br> 
You can use the AddHandler statement to dynamically connect events with event 
handler procedures. To handle events using AddHandler 1 - Declare an object 
variable of the class that is the source of the events you want to handle. 2 - 
Use the AddHandler statement to specify the name of the event sender, and the 
AddressOf statement to provide the name of your event handler.<br> 
<br> 
<br> 

7. You develop an enterprise application that includes a Windows Forms 
presentation layer, middle-tier components for business logic and data access, 
and a Microsoft SQL Server database. You are in the process of creating a 
middle-tier component that will execute the data access routines in your 
application. <br> 
When data is passed to this component, the component will call several SQL 
Server stored procedures to perform database updates. All of these procedure 
calls run under the control of a single transaction. The code for the 
middle-tier will implement the following objects: <br> 
Dim cn As New SqlConnection() 

Dim tr As SqlTransaction 

If two users try to update the same data concurrently, errors will occur. You must add code to your 
component to specify the highest possible level of protection against such 
errors. <br> 
Which code should you use? <br> 
<br> 
<br> 
<br> 
A. tr = cn.BeginTransaction(&quot;ReadCommitted&quot;) <br> 
B. tr = cn.BeginTransaction(IsolationLevel.ReadCommitted) <br> 
C. tr = cn.BeginTransaction(IsolationLevel.Serializable) <br> 
D. tr = cn.BeginTransaction(&quot;Serializable&quot;) <br> 

Answer: C 

*** Verified. Serializable is the highest isolation transaction level. It 
provide the highest possible level of protection against concurrent data 
errors. The correct syntax to begin a transaction with this transaction 
isolation level is: cn.BeginTransaction(IsolationLevel.Serializable) <br> 
<br> 

8. You develop a Windows-based application. The application uses a DataSet object 
that contains two DataTable objects. The application will display data from two 
data tables. One table contains customer information, which must be displayed 
in a data-bound ListBox control. The other table contains order information, 
which must be displayed in a DataGrid control. You need to modify your 
application to enable the list box functionality. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Use the DataSet.Merge method. <br> 
B. Define primary keys for the Data Table objects. <br> 
C. Create a foreign key constraint on the DataSet object. <br> 
D. Add a DataRelation object to the Relations collection of the DataSet object. 
<br> 

Answer: D 

*** Verified. We want to use data from both DataTable object. We must relate 
the DataTable objects.<br> 
A DataRelation is used to relate two DataTable objects to each other through 
DataColumn objects. DataRelation objects are contained in a 
DataRelationCollection, which you can access through the Relations property of 
the DataSet. A foreign key constraint represents an action restriction enforced 
on a set of columns in a primary key/foreign key relationship when a value or 
row is either deleted or updated.<br> 

9. You develop a Windows-based application by using Visual Studio .NET. Your 
application receives XML data files from various external suppliers. An XML 
Schema file defines the format and the data types for the XML data files. <br> 
Your application must parse the incoming XML data files to ensure that they 
conform to the schema. <br> 
What should you do? <br> 
<br> 
A. Implement a DataSet object and code an event handler to process its events. 
B. Implement a DataSet object and set its Enforce Constraints property to True. 
C. Implement an XmlValidatingReader object and code an event handler to process 
its events. 
D. Implement an XmlValidatingReader object and examine its ReadState property 
after reading the XML data file. 

Answer: C 
<br> 
*** Verified. The XmlValidatingReader class, an implementation of the XmlReader 
class, provides support for XML validation. The ValidationEventHandler event is 
used to set an event handler for receiving information about schema validation 
errors.<br> 
<br> 
<br> 

10. You use Visual Studio .NET to create an application. Your application contains 
two classes, Region and City, which are defined in the following code segment. 
(Line numbers are included for reference only.) <br> 
01 Public Class Region <br> 
02 Public Overridable Sub CalculateTax()<br> 
03 'Code to calculate tax goes here. <br> 
04 End Sub <br> 
05 End Class <br> 
06 Public Class City <br> 
07 Inherits Region <br> 
08 Public Overrides Sub CalculateTax() <br> 
09 'Insert new code. <br> 
10 End Sub <br> 
11 End Class <br> 
You need to add code to the CalculateTax method of the City class to call the 
CalculateTax method of the Region class. Which code segment should you add on 
line 9? <br> 
<br> 
<br> 
<br> 
A. CalculateTax() <br> 
B. Me.CalculateTax() <br> 
C. MyBase.CalculateTax() <br> 
D. MyClass.CalculateTax() <br> 

Answer: C 

<br> 
*** Verified Use the MyBase keyword to call methods in a base class when 
overriding methods in a derived class.<br> 
<br> 

11.You are maintaining a Visual Studio .Net application that was developed by a 
colleague. The application calculates interest and penalties for financial 
transactions. All variables that contain financial data are defined as type 
Double. When users enter financial data, the application periodically fails 
during execution. <br> 
Failure occurs in response to a variety of actions. The application returns the 
following error message: <br> 
&quot;Arithmetic operation resulted in an overflow&quot; You need to identify 
as many potential exceptions as possible in the application code. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Set Option Explicit to On. <br> 
B. Set Option Explicit to Off. <br> 
C. Set Option Strict to On. <br> 
D. Set Option Strict to Off. <br> 
E. Set Option Compare to Binary. <br> 
F. Set Option Compare to Text. <br> 

Answer: C 
<br> 
*** Verified. The Options Strict statement concerns which conversion are 
allowed. Option Strict ON disallows any data type conversions in which ddata 
loss would occur and anyconversion between numeric types and strings.<br> 
In short it help to identify potential arithmetic exceptions.<br> 


12. You use Visual Studio .NET to create a Windows Form. You add a custom control 
named BarGraph, which displays numerical data. You create a second custom 
control named DataBar. Each instance of DataBar represents one data value in 
BarGraph. BarGraph retrieves its data from a Microsoft SQL Server database. <br> 
For each data value that it retrieves, a new instance of DataBar is added to 
BarGraph. BarGraph also includes a Label control named DataBarCount, which 
displays the number of DataBar controls currently contained by BarGraph. <br> 
You must add code to one of your custom controls to ensure that DataBarCount is 
always updated with the correct value. <br> 
What are two possible ways to achieve this goal? (Each correct answer presents 
a complete solution. Choose two) <br> 
<br> 
<br> 
A. Add the following code segment to the ControlAdded event handler for 
DataBar: Me.DataBarCount.Text = Me.Controls.Count() <br> 
B. Add the following code segment to the ControlAdded event handler for 
DataBar: Me.DataBarCount.Text = Parent.Controls.Count() <br> 
C. Add the following code segment to the ControlAdded event handler for 
BarGraph: DataBarCount.Text = Me.Controls.Count() <br> 
D. Add the following code segment to the constructor for BarGraph: 
Me.Parent.DataBarCount.Text = Me.Controls.Count() <br> 
E. Add the following code segment to the constructor for DataBar: 
Me.Parent.DataBarCount.Text = Me.Controls.Count() <br> 
F. Add the following code segment to the AddDataPoint method of BarGraph: 
DataBarCount.Text = Me.Controls.Count() <br> 

Answer: CE 

*** Verified. We could either catch the ControlAdded event, or add code 
constructor. C - The Control.ControlAdded Event occurs when a new control is 
added to the Control.ControlCollection.<br> 
When a control is added to BarGraph we could set the count of controls to the 
number of current controls in BarGraph. E - Every time a new DataBar is 
constructed we could set the counter.<br> 
<br> 

13. You use Visual Studio .NET to develop a Windows-based application. Your 
application will display customer order information from a Microsoft SQL Server 
database. The orders will be displayed on a Windows Form in a data grid named 
DataGrid1. DataGrid1 is bound to a DataView object. The Windows Form includes a 
button control named displayBackOrder. When users click this button, DataGrid1 
must display only customer orders whose BackOrder value is set to True. How 
should you implement this functionality? <br> 
<br> 
<br> 

A. Set the RowFilter property of the DataView object to &quot;BackOrder = 
True&quot;. <br> 
B. Set the RowStateFilter property of the DataView object to &quot;BackOrder = 
True&quot;. <br> 
C. Set the Sort property of the DataView object to &quot;BackOrder = 
True&quot;. <br> 
D. Set the ApplyDefaultSort property of the DataView object to True. <br> 

Answer: A 

*** NOT Verified! Using the RowFilter property of a data view, you can filter 
reccords in a data table to make available only records you want to work with.<br> 
<br> 

14. You develop a Windows-based application for tracking telephone calls. The 
application stores and retrieves data by using a Microsoft SQL Server database. 
You will use the SQL Client managed provider to connect and send commands to 
the database. You use integrated security to authenticate users. Your server is 
called CallCenter100 and the database name is CustomerService. You need to set 
the connection string property of the SQL Connection object. <br> 
Which code segment should you use? <br> 
<br> 
<br> 
<br> 
A. &quot;Provider=SQLOLEDB.1;Data Source=CallCenter100; Initial 
Catalog=CustomerService&quot; <br> 
B. &quot;Provider=MSDASQL;Data Source=CallCenter100; Initial 
Catalog=CustomerService&quot; <br> 
C. &quot;Data Source=CallCenter100; Initial Catalog=Master&quot; <br> 
D. &quot;Data Source=CallCenter100; Initial Catalog=CustomerService&quot; <br> 

Answer: D 

*** Verified. Some dumps say A, but A is not the answer, because the managed 
provider does not use 'Provider' You can use the ConnectionString property to 
connect to a variety of data sources. Again, the &quot;Provider = value &quot; 
clause is not used by the SQL Client managed provider.<br> 

15. You are maintaining a Visual Studio .NET application that was created by 
another developer. The application functions as expected for several months. 
Then users report that it sometimes calculates tax amounts incorrectly. <br> 
An examination of the source code leads you to suspect that the errors are 
caused by a function named CalculateSalesTax. To test your hypothesis, you 
place a breakpoint on the following line of code: <br> 
<br> 
decTax = CalculateSalesTax(decRate, decSaleAmount) <br> 
However, when you run the application to create a test invoice, the breakpoint 
is not invoked. <br> 
How should you correct this problem? <br> 
<br> 
<br> 

A. Select Enable All Breakpoints from the Debug menu. <br> 
B. Select Configuration Manager from the Build menu. Set the Activate Solution 
Configuration option to Debug. Set the Configuration property of the project to 
Debug. <br> 
C. Select Options from the Tools menu and then select the General object from 
the Debugging folder. Choose the option In break mode, only stop execution of 
the current process. <br> 
D. Select Exceptions from the Debug menu. Under the heading If the exception is 
not handles, select Break into the Debugger. <br> 

Answer: B 

*** Verified. If the Active Solution Configuration is set to Release, no 
Breakpoints would apply. This could cause the behavior described in this 
scenario. If we should change this setting to Debug, then the breakpoints would 
be applied!.<br> 
<br> 

16. You company assigns you to modify a Visual Studio .NET application that was 
created by a former colleague. However, when you try to build the application, 
you discover several syntax errors. You need to correct the syntax errors and 
compile a debug version of the code so the application can be tested. Before 
compiling, you want to locate each syntax error as quickly as possible. <br> 
What should you do? <br> 
<br> 
<br> 

A. Select each error listed in the Task List window. <br> 
B. Open the Application event log from the Visual Studio .NET Server Explorer 
window. Select each error listed. <br> 
C. Run the application in Debug mode. Each time an error is encountered, 
correct it and continue debugging the application. <br> 
D. Select Build Solution from the Build menu. When the build fails, correct 
each error listed in the Output window. <br> 
E. Select Build Comment Web Pages from the Tools menu. Select each function 
listed in the report that is generated. <br> 

Answer: A 

*** Verified. The task list windows contains information which helps you to 
organize and manage the work of building your application. Among other things 
it will include each syntax error of the application.<br> 
<br> 

17. You use Visual Studio .NET to create a Windows-based application. The 
application includes a form named StandardOperatingProcedures (SOP). SOP allows 
users to enter very lengthy text into a database. When users click the Print 
button located on SOP, this text must be printed by the default printer. You 
implement the printing functionality by using the native .NET System Class 
Libraries with all default settings. Users report that only the first page of 
the text is being printed. <br> 
How should you correct this problem? <br> 
<br> 
<br> 
<br> 
A. In the BeginPrint event, set the HasMorePages property of the PrintEventArgs 
object to True. <br> 
B. In the EndPrint event, set the HasMorePages property of the PrintEventArgs object 
to True. <br> 
C. In the PrintPage event, set the HasMorePages property of the 
PrintPageEventArgs object to True. <br> 
D. In the QueryPageSettings event, set the HasMorePages property of the 
QueryPageSettingEventArgs object to True. <br> 

Answer: C 

*** Verified. PrintDocument.PrintPage Event occurs when the output to print for 
the current page is needed.<br> 
This event has the HasMorePages property which gets or sets a value indicating 
whether an additional page should be printed.<br> 
<br> 

18. You develop a Windows-based application named Mort1 by using Visual Studio 
.NET. Mort1 consumes an XML Web service named MortgageRate and exposes a method 
named GetCurrentRate. Mort1 uses GetCurrentRate to obtain the current mortgage 
interest rate. Six months after you deploy Mort1, users begin reporting errors. 
You discover that MortgageRate has been modified. GetCurrentRate now requires 
you to pass a postal code before returning the current mortgage interest rate. <br> 
You must ensure that Mort1 consumes the most recent version of MortgageRate. 
You must achieve this goal in the most direct way possible. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Use Disco.exe to generate a new proxy class for MortgageRate. <br> 
B. Modify the Mort1 code to pass the postal code to GetCurrentRate. <br> 
C. Use the Update Web Reference menu item to update the reference to 
MortgageRate in Mort1. <br> 
D. Use the Add Reference dialog box to recreate the reference to MortgageRate 
in Mort1. <br> 
E. Remove the reference to MortgageRate in Mort1. Use the Add Web Reference 
dialog box to create the reference. <br> 

Answer: C 

*** Verified. If your application contains a Web reference to an XML Web 
service that has been recently modified on the server, you may need to update 
the reference in your project. To update a project Web reference 1 - In 
Solution Explorer, access your project's Web References folder and select the 
node for the Web reference you want to update. 2 - Right-click the reference 
and click Update Web Reference.<br> 
<br> 

19. Your development team is creating a Windows-based application for a mortgage 
company. The application asynchronously calls the ProcessLoan method of an XML 
Web service. The XML Web service will notify your code when it finished 
executing ProcessLoan. You must ensure that your code can continue processing 
while waiting for a response from the XML Web service. Your code must establish 
when ProcessLoan finished executing. <br> 
What should your application do? <br> 
<br> 
<br> 
<br> 
A. Use the WaitHande.WaitAny method of the IAsyncResult.AsyncWaitHandle object. 
Examine the value of IAsyncResult.IsCompleted to see if ProcessLoan is finished 
executing. <br> 
B. Use the WaitHandle.WaitAll method of the IAsyncResult.AsyncWaitHandle 
object. Examine the value of IAsyncResult.IsCompleted to see of ProcessLoan is 
finished executing. <br> 
C. Supply a callback delegate to the BeginProcessLoan method of the XML Web 
service. After the XML Web service returns its response, a thread will invoke 
the callback from the threadpool. <br> 
D. Supply a callback delegate to the EndProcessLoan method of the XML Web 
service. After the XML Web service returns it response, a thread will invoke 
the callback from the threadpool. <br> 

Answer: C 

*** Verified. Calling an XML Web service asynchronously is a two-step 
operation. The first step, calling the Begin method, initiates the XML Web 
service call. The second step, calling the End method, completes the XML Web 
service call and returns the XML Web service response. There are different 
methods to determine when the asynchronous XML Web service call has completed. 
The preferred and most efficient method is to supply a callback delegate to the 
Begin method.<br> 
<br> 

20. Your development team uses Visual Studio .NET to create an accounting 
application, which contains a class named SupplierAccounts. This class 
instantiates several classes from a COM component that was created by using 
Visual Basic 6.0 Each COM component class includes a custom method named 
ShutDownObject that must be called before terminating references to the class. 
Software testers report that the COM component appears to remain in memory 
after the application terminates. You must ensure that the ShutDownObject 
method of each COM component class is called before SupplierAccounts is 
terminated. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Add code to the Terminate event of SupplierAccounts to call the 
ShutDownObject method of each COM component class. <br> 
B. Find each location in your code where a reference to Supplier Accounts is 
set to Nothing or goes out of scope. Add code after each instance to manually 
invoke the Visual Studio .NET garbage collector. <br> 
C. Add the procedure Protected Overrides Finalize() to SupplierAccounts. Add 
code to the procedure to call the ShutDownObject method of each COM component 
class. <br> 
D. Add the procedure Private Sub Finally()to SupplierAccounts. Add code to the 
procedure to call the ShutDownObject method of each COM component class. <br> 

Answer: C 

*** Verified. The Sub Finalize procedure in Visual Basic .NET destroys objects. 
It could be useful when destroying Visual Basic 6.0 COM objects.<br> 
<br> 

21. Your project team uses Visual Studio .NET to create an accounting application. 
Each team member uses the Write method of both the Debug class and the Trace 
class to record information about application execution in the Windows 2000 
event log. You are performing integration testing for the application. You need 
to ensure that only one entry is added to the event log each time a call is 
made to the Write method of either the Debug class or the Trace class. <br> 
What are two possible code segments for you to use? (Each correct answer 
presents a complete solution. Choose two) <br> 
<br> 
<br> 
A. Dim myTraceListener As New EventLogTraceListener(&quot;myEventLogSource&quot;)<br> 
Trace.Listeners.Add(myTraceListener) <br> 
B. Dim myDebugListener AS New EventLogTraceListener(&quot;myEventLogSource&quot;)<br> 
Debug.Listeners.Add(myDebugListener) <br> 
C. Dim myTraceListener As New EventLogTraceListener(&quot;myEventLogSource&quot;)<br> 
Debug.Listeners.Add(myTraceListener) <br>Trace.Listeners.Add(myTraceListener) <br> 
D. Dim myDebugListener As New<br> 
EventLogTraceListener(&quot;myEventLogSource&quot;) Dim myTraceListener As New<br> 
EventLogTraceListener(&quot;myEventLogSource&quot;) Debug.Listeners.Add(myDebugListener)<br> 
Trace.Listeners.Add(myTraceListener) <br> 

Answer: AB 

*** Verified. An EventLogTraceListener redirects output to an event log. Debug 
and trace share the same Listeners collection, so if you add a listener object 
to a Debug.Listeners collection in your application, it gets added to the 
Trace.Listeners collection as well, and vice versa.<br> 
<br> 
<br> 
<br> 
<br> 

22. You develop a Windows-based application that creates XML output from a DataSet 
object. The XML output is created by using the DataSet.WriteXml method and then 
is sent to another application. The second application requires the output to 
appear in the following format: <br> 
<br> 
<br> 
&lt;employee id=&quot;3&quot; name=&quot;Ron&quot; age=&quot;39&quot; /&gt;<br> 
<br> 
You need to write code to specify the format for the XML output. <br> 
Which code segment should you use? <br> 
<br> 
<br> 

A. ds.WriteXml(dataFile, XmlWriteMode.WriteSchema) <br> 
B. ds.WriteXml(dataFile, XmlWriteMode.IgnoreSchema) <br> 
C. Dim c As DataColumn<br> 
For Each c in ds.Tables(&quot;employee&quot;).Columns<br> 
ColumnMapping = MappingType.Attribute <br>Next <br> 
D. Dim c As DataColumn<br> 
For Each c in ds.Tables(&quot;employee&quot;).Columns<br> 
ColumnMapping = MappingType.Element<br> Next <br> 

Answer: C 

*** Verified. Some dumps say A, that is not correct.<br> 
<br> 

23. You are developing a Windows-based application that logs hours worked by your 
employees. Your design goals require you to maximize application performance 
and minimize impact on server resources. You need to implement a SqlCommand 
object that will send an SQL INSERT action query to a database each time a user 
makes a new entry. <br> 
To create a function named LineItemInsert, you write the following code: <br> 
<br> 
01 Function LineItemInsert(ByVal empid As Integer, Byval projectID As Integer, 
_ <br> 
02 ByVal hrs As Decimal, ByVal cnn As SqlConnection) As Integer<br> 
03 Dim SQL As String <br> 
04 Dim Ret As Integer <br> 
05 SQL = &quot;INSERT INTO TimeEntries &quot; 
&amp; (EmpID, ProjectID, Hours) &quot; &amp; _ 
06 &quot;VALUES (&quot; &amp; 
empID &amp; &quot;, &quot; &amp; projected &amp; &quot;, &quot; &amp; hrs &amp; 
&quot;)&quot; <br>
07 Dim cmd As New SqlCommand(SQL, cnn) 
08 <br> 
09 'Insert new code 
10 <br> 
11 End Function <br> 
<br> 
Your code must execute the SQL INSERT action query and verify the number of 
database records that are affected by the query. Which code segment should you 
add on line 9? <br> 
<br> 
<br> 
<br> 
A. cnn.Open()<br> Ret = Cmd.ExecuteNonQuery() <br>Cnn.Close()<br> Return Ret <br> 
B. cnn.Open(0)<br> Ret = Cmd.ExecuteScalar()<br> Cnn.Close() Return Ret <br> 
C. Dim reader as SqlDataReader<br> cnn.Open() <br>reader = Cmd.ExecuteReader()<br> 
Cnn.Close() <br>Return reader.RecordsAffected <br> 
D. Dim reader as SqlDataReader <br>cnn.Open() <br>reader = Cmd.ExecuteReader()<br> 
Cnn.Close() <br>Return <br>reader.GetValue() <br> 

Answer: A 

*** Verified. The SqlCommand.ExecuteNonQuery Method Executes a Transact-SQL 
statement against the Connection and returns the number of rows affected. This 
is the most effective solution. The SqlDataReader.RecordsAffected property gets 
the number of rows changed, inserted, or deleted by execution of the 
Transact-SQL statement.<br> 
C and D - There is no need to use the ExecuteReader() method.<br> 
<br> 

24. You use Visual Studio .NET to develop Windows-based application. You implement 
security by using the security classes of the .NET Framework. Your application 
includes the follwing procedure. <br> 
<br> 
01 Public Sub ApproveVaction(Byval user1 as string, byval role1 as string, _ <br> 
02 byval user2 as string, byval role2 as string) <br> 
03 dim principalperm1 as new principalpermission(user1, role1)<br> 
04 dim principalperm2 as new principalpermission(user2, role2) <br> 
05 'Insert new code. <br> 
06 'Additional procedure code goes here 07 End Sub <br> 
You must ensure that both User1 and User2 are members of the same security 
roles. <br> 
Which code segement should you insert on line 5? <br> 
<br> 
<br> 
<br> 
A. principalperm1.IsUnrestricted principalperm2.IsUnrestricted <br> 
B. principalperm1.IsSubSetOf(principalperm2) <br> 
C. principalperm1.Intersect(principalperm2).Demand() <br> 
D. principalperm1.Union(principalper2).Demand() <br> 

Answer: B 

*** Verified. The IsSubsetOf method returns true only if the identities and 
roles match exactly (or one of them are NULL).<br> 
<br> 

25. You use Visual Studio .NET to create an application that uses an assembly. The 
assembly will reside on the client computer when the application is installed. 
You must ensure that any future applications installed on the same computer can 
access the assembly. <br> 
Which two actions should you take? (Each correct answer represents part of the 
solution. Choose two) <br> 
<br> 
<br> 
A. Use XCOPY to install the assembly in the global assembly caches. <br> 
B. Use XCOPY to install the assembly in the Windows\Assembly folder. <br> 
C. Create a strong name for the assembly. <br> 
D. Recompile the assembly by using the Native Image Generator (Ngen.exe). <br> 
E. Modify the application configuration file to include the assembly. <br> 
F. User a deployment project to install the assembly in the global assembly 
cache. <br> 
G. User a deployment project to install the assembly in the Windows\System32 
folder. <br> 

Answer: CF 

*** Verified. The global assembly cache stores assemblies specifically 
designated to be shared by several applications on the computer. C - An 
assembly must have a strong name to be installed in the global assembly cache.<br> 
F - There are two ways to install an assembly into the global assembly cache:<br> 
 Using Microsoft Windows Installer 2.0. This could be achieved by a deployment 
project.<br> 
 Using the Global Assembly Cache tool (Gacutil.exe). This is not an option 
here.<br> 
<br> 

26. You use Visual Studio. NET to develop a Windows-based application named 
PatTrac. It uses the security class libraries of the .NET framework to 
implement security. PatTrac will run within the context of a Windows 2000 
domain named MedicalOffice. Calls to a remote Windows 2000 domain named 
Hospital will occur during the execution of PatTrac. <br> 
You want PatTrac to log on the Hospital domain by using a generic user account. 
<br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Create a new instance of the WindowsImpersonationContext class by calling 
the Impersonate method of the Genericidentity object and passing the token of 
the user whom you want to impersonate. <br> 
B. Create a new instance of the WindowsImpersonationContext class by calling 
the Impersonate method of the WindowsIdentify object and passing the token of 
the user whom you want to impersonate. <br> 
C. Create a new instance of the ZoneIdentifyPermission class by calling the 
Impersonate method of the GenericPrincipal object and passing the token of the 
user whom you want to impersonate. <br> 
D. Create a new instance of the ZoneIdentifyPermission class by calling the 
Impersonate method of the WindowsPrincipal object and passing the token of the 
user whom you want to impersonate. <br> 

Answer: B 

*** Verified. We must impersonate another user. The WindowsImpersonationContext 
Class, not ZoneIdentifyPermission class, should be used. Furthermore the 
Impersonate method must be used on an Windowsidentity object, not on a 
Genericidentity object.<br> 
<br> 

27. You use Visual Studio. NET to develop a Windows-based application. You plan to 
reuse a procedure written in Visual Basic 6.0. The procedure includes the following 
array declaration: <br> 
<br> 
Dim Employees (1 to 10) As String <br> 
You copy and paste the array declaration from the Visual basic 6.0 proejct into 
the new VB .NET project. Now you must ensure that the Employees array will 
compile in the VB .NET application. What should you do? <br> 
<br> 
<br> 
<br> 
A. Include the Option Base 1 statement in the Declaration section of the 
module. <br> 
B. Include the Option Base 0 statement in the Declaration section of the 
module. <br> 
C. Replace the Dim statement with the following code segment: Dim Employees (0 
to 9) As String <br> 
D. Replace the Dim statement with the following code segment: Dim Employees (9) 
As String <br> 
E. After the Dim statement, add the following code segment: ReDim Employees (0 
to 9) As String <br> 
F. After the Dim statement, add the following code segment: Dim Employees (9) 
As String <br> 

Answer: D 

*** Verified. Array lower bounds is supported in Visual Basic 6.0, but not in 
Visual Basic .Net.<br> 
<br> 

27. You develop a Windows form that provides online help for users. You want the 
help functionality to be available when users press the F1 key. Help text will 
be displayed in a pop-up window for the text box that has focus. To implement 
this functionality, you need to call a method of the HelpProvider control and 
pass the text box and the help text. <br> 
Which method should you call? <br> 
<br> 
<br> 
<br> 
A. SetShowHelp <br> 
B. SetHelpString <br> 
C. SetHelpKeyword <br> 
D. ToString <br> 

Answer: B 

*** Verified. To associate a specific Help string with another control, use the 
SetHelpString method.<br> 
The string that you associate with a control using this method is displayed in 
a pop-up window when the user presses the F1 key while the control has focus.<br> 
<br> 

28. You use Visual Studio .NET to create a class library project. Another developer 
named Lilliane uses ASP.NET to create an Internet application for your 
company's Web site. Lilliane deploys your class library to the \bin folder of 
her ASP.NET application on your company's development Web server. She has 
access to your source code through a share on another network server. Lilliane 
reports that her application can instantiate and use classes from your class 
library. However, when she is debugging her application, she cannot step into 
code within your class library. You must ensure that developers who use your 
class library can step through the code for debugging purposes. <br> 
Which three actions should you take? (Each correct answer represents part of 
the solution. Choose three) <br> 
<br> 
<br> 
A. Use the Build Configuration Manager to set the Active Solustion 
Configuration option to Debug. Set the Project Configuration to Debug. Build 
your class library. <br> 
B. Add the class library project to the ASP.NET solution. <br> 
C. Copy the .dll file from the Debug folder of the class library project to the 
\bin folder of the ASP.NET application. <br> 
D. Copy the .pdb file from the Debug folder of the class library project to the 
\bin folder of the ASP.NET application. <br> 
E. Copy the TempPE folder from Debug folder of the class library project to the 
\bin folder of the ASP.NET application. <br> 
F. Copy the source code from the class library to the ASP.NET application 
folder on the Web server. <br> 
G. Register the class library on the Web server by using RegSvr323.exe. <br> 

Answer: ACD 

*** Verified.<br> 
<br> 

29. You use Visual Studio .NET to create a Windows-based application that will be 
distributed to your customers. You add a setup project to your solution to 
create a distribution package. You deploy the distribution package on a test 
computer. <br> 
However, you discover that the distribution package does not create a shortcut 
to your application on the Programs menu of the test computer. You need to 
modify your setup project to ensure that this shortcut will be available on 
your customers Programs menus. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Navigate to the User's programs Menu folder in the File System on the Target 
machine hierarchy. Add the primary output from your application. <br> 
B. Navigate to the User's programs Menu folder in the File System on Target 
machine hierarchy. Create a shortcut to your application and move the shortcut 
to the User's Programs Menu folder in the same hierarchy. <br> 
C. Navigate to the Install folder in the Customer Actions hierarchy. Create a 
custom action that adds the primary output from your application to the User's 
Programs Menu folder. <br> 
D. Navigate to the Install folder in the Customer Actions hierarchy. Create a 
custom action that adds a shortcut to your application's executable file to the 
User's Programs Menu folder. <br> 

Answer: A 

*** Verified.<br> 
<br> 

30. You develop a Windows-based application that enables users to enter and edit 
customer order. The application contains a DataSet object named 
orderEntryDataSet and DataTable object named orderDataTable and 
orderDetailDataTable. <br> 
orderDetailDataTable requires two columns to make a unique primary key. You 
need to define a primary key for orderDetailDataTable. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Set the DataTable.PrimaryKey property to a string value that lists the 
column names that make the primary key. <br> 
B. Set the DataTable.PrimaryKey property to an array of DataColumn objects that 
reference the column that make the primary key. <br> 
C. Iterate through the DataTable.Columns collection and set the DataType 
property of the columns that make the primary key. <br> 
D. Create a UniqueConstraint on the columns that make the primary key. <br> 

Answer: B 

*** Verified.<br> 
<br> 

31. You use Visual Studio .NET to develop a component named MyComponent. You plan 
to develop several client applications that use MyComponent. You need to deploy 
MyComponent with each of these applications. You will create a distribution 
package to be included with each application. <br> 
Which type of project should you create? <br> 
<br> 
<br> 
<br> 
A. CAB project. <br> 
B. Merge module project. <br> 
C. Setup Project. <br> 
D. Web setup project. <br> 

Answer: B 

*** NOT Verified! <br> 

32. You develop a Windows-based inventory management application that interacts 
with a Microsoft SQL Server database. Your application enables users to update 
information about items in inventory. Each time a user changes an inventory 
item, your application executes a SQL Server stored procedure to update rows in 
the database. The stored procedure will run many times during each user 
session. Your application will use a SqlCommand object to execute the stored 
procedure. You must revise your code so that the use of this object optimizes 
query performance. <br> 
What should you do? <br> 
<br> 
<br> 

A. Call the SqlCommand.DeriveParameters method before each call to 
SqlCommand.ExecuteNonQuery. <br> 
B. Call the SqlCommand.Prepare method before each call to 
SqlCommand.ExecuteNonQuery. <br> 
C. Call the SqlCommand.DeriveParameters method before the first call to 
SqlCommand.ExecuteNonQuery. <br> 
D. Call the SqlCommand.Prepare method before the first call to 
SqlCommand.ExecuteNonQuery. <br> 

Answer: D 

*** Verified <br> 

33. You use Visual Studio .NET to create a Windows-based application. Your 
application will be used by five customer service representatives to access a 
central database. All five representatives use client computers that are 
connected to the company intranet. All client computers have Windows XP 
Professional and the .NET Framework installed. When you distribute the 
application, you must ensure that it uses the smallest possible hard disk space 
on the client computers. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Copy your application to each client computer. Create a shortcut to your 
application on the desktop of each client computer. <br> 
B. Copy your application to a shared folder on your company intranet. Create a 
shortcut to your application on the desktop of each client computer. <br> 
C. Create a distribution package by using the Visual Studio.NET Setup Wizard. 
Exclude the dependency for the .NET Framework. Install the distribution package 
on each client computer. <br> 
D. Create a distribution package by using the Visual Studio.NET Setup Wizard. 
Set the distribution package's Compression property to Optimized for size. 
Install the distribution package on each client computer. <br> 

Answer: A 

*** Verified.<br> 
<br> 

34. You use Visual Studio .NET to develop a Windows-based application. Your 
application will display customer order information from a Microsoft SQL Server 
database. The orders will be displayed on a Windows Form that includes a 
DataGrid control named DataGrid1. DataGrid1 is bound to a DataView object. 
Users will be able to edit order information directly in DataGrid1. You must 
give users the option of displaying only edited customer orders and updated 
values in DataGrid1. <br> 
What should you do? <br> 
<br> 
<br> 

A. Set the RowStateFilter Property of the DataView object to 
DataViewRowState.ModifiedOriginal. <br> 
B. Set the RowStateFilter Property of the DataView object to 
DataViewRowState.ModifiedCurrent. <br> 
C. Set the RowFilter Property of the DataView object to 
DataViewRowState.ModifiedOriginal. <br> 
D. Set the RowFilter Property of the DataView object to 
DataViewRowState.ModifiedCurrent. <br> 

Answer: B 

*** Verified.<br> 
<br> 

35. You plan to develop a customer information application that uses a Microsoft SQL 
Server database. This application will be used frequently by a large number of 
users. Your application code must obtain the fastest possible performance when 
accessing the database and retrieving large amounts of data. You must 
accomplish this goal with the minimum amount of code. <br> 
How should you design your application? <br> 
<br> 
<br> 
<br> 
A. Use classes in the System.Data.OleDb namespace. <br> 
B. Use classes in the System.Data.SqlClient namespace. <br> 
C. Use remoting to connect to the SQL Server computer. <br> 
D. Use interoperability to include legacy COM-based data access components. <br> 

Answer: B 

*** Verified.<br> 
<br> 

36. You need to create an OleDbCommand object to retrieve information about postal 
codes for your mailing list application. You create an OleDbConnection object 
named conn. You need to instantiate the OleDBCommand object and set the 
CommandText and Connection properties. <br> 
What are two possible code segments for you to use? (Each correct answer 
represents a complete solution. Choose two) <br> 
<br> 
<br> 
A. Dim comm As New OleDbCommand() <br>comm.CommandText =&quot;SELECT * FROM 
Regions&quot; <br>comm.Connection = conn <br> 
B. Dim comm As New OleDbCommand(&quot;sp_GetRegions&quot;, conn)<br> 
comm.CommandType = CommandType.Text <br> 
C. Dim comm As New OleDbCommand(&quot;SELECT * FROM Regions&quot;, conn)<br> 
comm.CommandType = CommandType.Text <br> 
D. Dim comm As New OleDbCommand(&quot;sp_GetRegions&quot;, conn)<br> 
comm.CommandType = CommandType.TableDirect <br> 
E. Dim comm As New OleDbCommand() <br>comm.CommandType =&quot;SELECT * FROM 
Regions&quot; <br>comm.Connection = conn <br> 

Answer: AC 

*** Verified.<br> 
<br> 
<br> 

37. You use Visual Studio.NET to develop an application for users on your company 
intranet. All client computers use Internet Explorer as their Web browser. You 
plan to create a setup package to distribute your application. <br> 
<br> 
The setup package must fulfill the following requirements: <br> 
It is placed in a network folder that is accessible to users. <br> 
It is accessible through a link on your company's intranet. <br> 
It includes an uninstaller for the application. <br> 
<br> 
Which type of project should you create? <br> 
<br> 
<br> 
<br> 
A. CAB project <br> 
B. Merge module project. <br> 
C. Setup project. <br> 
D. Web setup project. <br> 

Answer: D 

*** Verified. To deploy a Web application to a Web server, you create a Web 
Setup project, build it, copy it to the Web server computer, and run the 
installer to install the application on the server using the settings defined 
in your Web Setup project. Setup projects allow you to create installers in 
order to distribute an application. The resulting Windows Installer (.msi) file 
contains the application, any dependent files, information about the application 
such as registry entries, and instructions for installation. <br> 


38. You develop a Windows-based application by using Visual Studio. NET. The 
application included numerous method calls at startup. After optimizing your 
application code, you test the application on a variety of client computers. <br> 
However, the startup time is too slow. You must ensure that your application 
starts as quickly as possible the first time it runs. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Precompile your application by using the Native Image Generator (Ngen.exe). 
Install the precompiled application on the client computers. <br> 
B. Install your application on the client computers. Precompile your 
application by using the Native Image Generator (Ngen.exe). <br> 
C. Precompile your application by using the JIT compiler. Install the 
precompiled application on the client computers. <br> 
D. Install your application on the client computers. Precompile your 
application by using the JIT compiler. <br> 

Answer: A 

*** Verified. Pre-compiling assemblies with Ngen.exe can improve the startup 
time for applications, because much of the work required to execute code has 
been done in advance. We precompile the application and then install it.<br> 
<br> 

39. You use Visual Studio .NET to create an application that will be distributed to 
employees within your company. You create and deploy a distribution package to 
test a computer running Windows 2000 Professional. Later you discover that your 
name is listed as the support contact for your application by the Add/Remove 
Programs option of Control Panel. <br> 
You need to change the support contact to the name of our help desk 
administrator. <br> 
Which property of the setup project should you change? <br> 
<br> 
<br> 
<br> 
A. Author <br> 
B. Comments <br> 
C. Manufacturer <br> 
D. Support Phone <br> 

Answer: A 

*** Verified. The Author property specifies the name of the author of an 
application or component. Once the application is installed, the property is 
also displayed in the Contact field of the Support Info dialog box.<br> 
<br> 

40. You use Visual Studio .NET to create an assembly that will be used by other 
applications, including a standard COM client application. You must deploy your 
assembly and the COM application to a client computer. You must ensure that the 
COM application can instantiate components within the assembly as COM 
components. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Create a strong name of the assembly by using the strong Name tool (Sn.exe). 
<br> 
B. Generate a registry file for the assembly by using the Assembly Registration 
tool (Regasm.exe). Register the file on the client computer. <br> 
C. Generate a type library for the assembly by using the Type Library Importer 
(Tlbimp.exe). Register the file on the client computer. <br> 
D. Deploy the assembly to the global assembly cache on the client computer. Add 
a reference to the assembly in the COM client application. <br> 

Answer: B 

*** Verified. The Assembly Registration tool reads the metadata within an 
assembly and adds the necessary entries to the registry, which allows COM 
clients to create .NET Framework classes transparently. Once a class is 
registered, any COM client can use it as though the class were a COM class. 
Not, Sn.exe - Strong Name, is used to give assemblies strong names for unique 
identification.<br> 
<br> 

41. You develop a Windows-based application by using Visual Studio .NET and 
Microsoft SQL server. The application will perform numerous Assert, Deny and 
PermitOnly security operations while it is executing. You must ensure that the 
application is optimized for fast run-time execution. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Perform declarative security checks <br> 
B. Perform imperative security checks <br> 
C. Perform all security checks by using SQL Server security <br> 
D. Implement a custom security class that retrieves security information from 
the SQL Server database. <br> 

Answer: A 

*** Verified. Declarative security checks in the application would be the 
fastest solution.<br> 

42. Another developer in your company uses Visual Studio .NET to create a component 
named MyComponent. You deploy MyComponent to a server. When you execute 
MyComponent, you receive the following error message: <br> 
&quot;System.Security.Policy.PolicyException: Failed to acquire required 
permissions.&quot; As quickly as possible, you need to discover which 
permissions are required by MyComponent. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Request the source code from the developer who created MyComponent. Examine 
the source code to find the required permissions. <br> 
B. Run the Microsoft CLR Debugger (DbgCLR.exe) on the server to view the 
permissions requested by the application at run time. <br> 
C. Run the Runtime Debugger (Cordbg.exe) on the server to view the permissions 
requested by the application at run time. <br> 
D. Run the Permissions View tool (Permview.exe) on the server to view the 
permissions required by MyComponent. <br> 
E. Run the MSIL Disassembler (Iidasm.exe) on the server to view permissions 
requested by MyComponent that were denied. <br> 

Answer: D 
<br> 
*** Verified. Developers can use Permview.exe to verify that they have applied 
permission requests correctly to their code. Additionally, you can run 
Permview.exe to determine the permissions an assembly requires to execute.<br> 
<br> 

43. You use Visual Studio .NET to develop a Windows-based application whose project 
name is RetailMgmt. You create an application configuration file that will be 
installed on the client computer along with RetailMgmt. You must ensure that 
the settings in the application configuration file are applied when RetailMgmt 
is executed. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Name the configuration file RetailMgmt.exe.config and copy it to the 
Windows\Sytem32 folder <br> 
B. Name the configuration file RetailMgmt.confing and copy it to the 
Windows\Sytem32 folder <br> 
C. Name the configuration file RetailMgmt.exe.config and copy it to the 
application folder <br> 
D. Name the configuration file RetailMgmt.confing and copy it to the 
Windows\Sytem32 folder <br> 
E. Name the configuration file RetailMgmt.exe.config and copy it to the global 
assembly cache. <br> 

Answer: C 
<br> 
*** Verified. The configuration file for an application hosted by the 
executable host is in the same directory as the application. The name of the 
configuration file is the name of the application with a .config extension.<br> 
In this scenario the configuration file should named RetailMgmt.exe.config and 
be placed in the application folder.<br> 
<br> 

44. You use Visual Studio .NET to develop a Windows-based application named 
Advocate Resource Assistant (ARA). ARA contains a class named Client. The 
Client class is defined by the following code segment: <br> 
<br> 
Namespace Fabrikam.Buslayer<br> 
Public Class Client<br> 
Public Function<br> 
GetPhone(clientID as Integer) as String<br> 
'More code goes here<br> 
End Function<br> 
'Other functions go here<br> 
End Class<br> 
End Namespace <br> 
The client class is invoked from ARA by using the following code segment: <br> 
<br> 
Public Class ClientForm Inherits System.Windows.Forms.Form<br> 
Private Sub<br> 
SetPhoneNumber(ByVal PostalCode As String)<br> 
Dim client as New Client()<br> 
TextBox1.Text = client.GetPhone(postalcode)<br> 
End Sub<br> 
End Class <br><br> 

When you try to build your project, you receive the following error message: <br> 
&quot;Type 'Client' is not defined.&quot; What are two possible ways to correct 
this problem? (Choose two) <br> 
<br> 
<br> 
A. Fully qualify the Client class with the Fabrikam.BusLayer namespace. <br> 
B. Fully qualify the Client class with ARA namespace. <br> 
C. Import the Fabrikam.BusLayer namespace in the ClientForm class. <br> 
D. Inherit the Fabrikam.BusLayer namespace in the ClientForm class. <br> 
E. Declare the client object variable by using the WithEvents keyword. <br> 
F. Declare the client object variable by using the Implements keyword. <br> 
<br> 

Answer: AC 
<br> 
*** Verified. A - We could use a fully qualified name; Fabrikam.Buslayer.Client 
and C - We could import the Fabrikam.BusLayer namespace by creating an alias: 
Imports client = Fabrikam.Buslayer.Client <br> 
<br> 

45. You develop a Windows-based application. Its users will view and edit employee 
attendance data. The application uses a DataSet object named customDataSet to 
maintain the data while users are working with it. After a user edits data, 
business rule validation must be performed by a middle-tier component named 
mycomponent. You must ensure that your application sends only edited data rows 
from customDataSet to mycomponent. <br> 
Which code segment should you use? <br> 
<br> 
<br> 
<br> 
A. Dim changeDataSet As New DataSet<br> If customDataSet.HasChanges then 
myComponent.Validate(changeDataSet) <br> 
B. Dim changeDataSet As New DataSet <br>If customDataSet.HasChanges then 
myComponent.Validate(customDataSet) <br> 
C. Dim changeDataSet As DataSet = customDataSet.GetChanges()<br> 
myComponent.Validate(changeDataSet) <br> 
D. Dim changeDataSet As DataSet = customDataSet.GetChanges()<br> 
myComponent.Validate(customDataSet) <br> 

Answer: C 
<br> 
*** Verified. DataSet.GetChanges method gets a copy of the DataSet containing 
all changes made to it since it was last loaded, or since AcceptChanges was 
called. It is used to create a second DataSet that features only the changes to 
the data. We then validate the changes, the changedDataSet.<br> 
<br> 

46. You use Visual Studio .NET to create a Windows-based data management 
application named MyApp. You implement the following code segment: <br> 
Dim oSwitch As New_ TraceSwitch(&quot;MySwitch&quot;, &quot;MyTraceSwitch&quot;)<br> 
Dim oWriter As New IO.StreamWritter(IO.File.Open(&quot;c:\MyApp.txt&quot;, IO.FileMode.Append))<br> 
Dim oListener As New TextWriterTraceListener(oWriter)<br> 
Trace.Listeners.Add(oListener)<br> 
Try CustomerUpdate()<br> 
Catch oEx As Exception<br> 
Trace.WriteLineIf(oSwitch.TraceError, &quot;Error: &quot; &amp; oEx.Message)<br> 
Finally Trace.Listeners.Clear()<br> 
oWriter.Close() <br> 
oWriter. = Nothing<br> 
End Try <br> 

You compile a debug version of the application and deploy it to a user's 
computer. The user reports errors, which are generated within the 
CustomerUpdate procedure. You decide to enable logging of the error messages 
generated by CustomerUpdate. You want to use the minimum amount of 
administrative effort. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Start the application with the following command line: /TRACE MySwitch 1. <br> 
B. Start the application with the following command line: /d:TRACE=True. <br> 
C. Start the application with the following command line: /XML <br> 
D. Create an environment variable on the user's computer. Name the variable 
MySwitch and assign it a value of 1. <br> 
E. Edit your application's config file to set the value of MySwitch to 1. <br> 

Answer: E 
<br> 
*** Verified. After your application has been distributed, you can still enable 
or disable trace output by configuring the trace switches in your application. 
You can change the values of the switch objects using the configuration file. 
In addition to specifying the name of a switch to configure, you must also 
specify a value for the switch. This value is an Integer. For BooleanSwitch, a 
value of 0 corresponds to Off, and any nonzero value corresponds to On.<br> 
<br> 

47. You use Visual Studio .NET to create a Windows-based application for online 
gaming. Each user will run the client version of the application on his or her 
local computer. In the game, each user controls two groups of soldiers, Group 1 
and group 2. You create a top-level menu item whose caption is Groups. Under 
this menu, you create two submenus. <br> 
One is named group1Submenu, and its caption is Group 1. The other is named 
group2Submenu, and its caption is Group2. <br> 
When the user selects the Groups menu. The two submenus will be displayed. The 
user can select only one group of soldiers at a time. You must ensure that a 
group can be selected either by clicking the appropriate submenu item or by 
holding down the ALT key and pressing 1 or 2. You must also ensure that the 
group currently select will be indicated by a dot next to the corresponding 
submenu item. You do not want to change the caption text of any of your menu 
items. <br> 
Which for actions should you take? (Each correct answer represents part of the 
solution. Choose four) <br> 
<br> 
<br> 
A. Set group1Submenu.Text to &quot;Group &amp;1&quot;. <br>Set group2Submenu.Text 
to &quot;Group &amp;2&quot;. <br> 
B. Set Group1.ShortCut to &quot;ALT1&quot;. <br>Set Group2.ShortCut to 
&quot;ALT2&quot;. <br> 
C. In the group1Submenu.Click event, place the following code segment:<br> 
group1Submenu.DefaultItem = True <br>In the group2Submenu.Click event, place the 
following code segment:<br> group2Submenu.DefaultItem = True <br> 
D. In the group1Submenu.Click event, place the following code segment:<br> 
group2Submenu.DefaultItem = False<br> In the group2Submenu.Click event, place the 
following code segment: <br>group1Submenu.DefaultItem = False <br> 
E. In the group1Submenu.Click event, place the following code segment:<br> 
group1Submenu.Checked = True<br> In the group2Submenu.Click event, place the 
following code segment:<br> group2Submenu.Checked = True <br> 
F. In the group1Submenu.Click event, place the following code segment:<br> 
group2Submenu.Checked = False <br>In the group2Submenu.Click event, place the 
following code segment:<br> group1Submenu.Checked = False <br> 
G. Set group1Submenu.RadioCheck to True. <br>Set group2Submenu.RadioCheck to True. <br> 
H. Set group1Submenu.RadioCheck to False. <br>Set group2Submenu.RadioCheck to 
False. <br> 

Answer: AEFG 
<br> 
*** Verified. A - The &amp; sign is used to define the required Access key. E, 
F - The menu item's Checked property is either true or false, and indicates 
whether the menu item is selected. We should set the clicked Submenu Checked 
property to True, and the other Submenu Checked property to False. G - The menu 
item's RadioCheck property customizes the appearance of the selected item: if 
RadioCheck is set to true, a radio button appears next to the item; <br> 


48. You use Visual Studio .NET to develop a Windows-based application that 
interacts with a Microsoft SQL Server database. Your application contains a 
form named CustomerForm. You add the following designtime components to the 
form: <br> 
<br> 
SqlConnection object named NorthwindConnection SqlDataAdapter object named 
NorthwindDataAdapter. <br> 
DataSet object named NorthwindDataSet. <br> 
Five TextBox controls to hold the values exposed by NorthwindDataSet. <br> 
<br> 
At design time, you set the DataBindings properties of each TextBox controls to 
the appropriate column in the DataTable object of NorthwindDataSet. When you 
test the application, you can successfully connect to the database. <br> 
However, no data is displayed in any text boxes. You need to modify your 
application code to ensure that data is displayed appropriately. Which behavior 
should occur while the CustomerForm.Load event handler is running? <br> 
<br> 
<br> 
<br> 
A. Execute the Add method of the TextBoxes DataBindings collection and pass in 
NorthwindDataSet. <br> 
B. Execute the BeginInit method of NorthwindDataSet. <br> 
C. Execute the Open method of NorthwindConnection. <br> 
D. Execute the FillSchema method of NorthwindDataAdapter and pass in 
NorthwindDataSet. <br> 
E. Execute the Fill method of NorthwindDataAdapter and pass in 
NorthwindDataSet. <br> 

Answer: E 
<br> 
*** Verified. Dataset is a container; therefore, you need to fill it with data. 
You can populate a dataset by calling the Fill method of a data adapter.<br> 
<br> 

49. You are a developer for a company that provides free software over the 
Internet. You are developing an e-mail application that users all over the 
world can download. The application displays text strings in the user 
interface. At run time, these text strings must appear in the language that is 
appropriate to the locale setting of the computer running the application. You 
have resources to develop version of the application for only four different 
cultures. You must ensure that your application will also be usable by people 
of other cultures. <br> 
How should you prepare the application for deployment? <br> 
<br> 
<br> 
<br> 
A. Package a different assembly for each culture. <br> 
B. Package a different executable file for each culture. <br> 
C. Package a main assembly for source code and the default culture. Package 
satellite assemblies for the other cultures. <br> 
D. Package a main assembly for source code. Package satellite assemblies for 
each culture. <br> 

Answer: C 
<br> 
*** Verified. When you build a project, the resource files are compiled and 
then embedded in satellite assemblies, or assemblies which contain only the 
localized resources. The fallback resources are built into the main assembly, 
which also contains the application code.<br> 
<br> 

50. You use Visual Studio .NET to create an application that interacts with a 
Microsoft SQL Server database. You create a SQL Server stored procedure named 
CustOrderDetails and save it in the database. Other developers on your team 
frequently debug other stored procedures. You need to verify that your stored 
procedure is performed correctly. You need to step through CustOrderDetails 
inside the Visual Studio .NET debugger. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Run CustOrderDetails by using the Visual Studio .NET Server Explorer. <br> 
B. Step into CustOrderDetails by using the Visual Studio .NET Server Explorer. <br> 
C. From the Command window, use Ctrl+E to run CustOrderDetails. <br> 
D. Move CustOrderDetails from the Visual Studio .NET Server Explorer window to 
a Windows Form. Run the application in Debug mode and step though 
CustOrderDetails. <br> 

Answer: B 
<br> 
*** Verified. To debug a stored procedure from Server Explorer 1 - Establish a 
connection to a database using Server Explorer. 2 - Expand the database name 
node. 3 - Expand the Stored Procedures node. 4 - Right-click the stored 
procedure you want to debug and choose Step Into Stored Procedure from the shortcut 
menu.<br> 
<br> 

51. You use Visual Studio .NET to create a Windows-based application. The 
application includes a form named GraphForm, which displays statistical data in 
graph format. You use a custom graphing control that does not support resizing. 
You must ensure that users cannot resize, minimize, or maximize GraphForm. <br> 
Which three actions should you take? (Each answer represents part of the 
solution. Choose three) <br> 
<br> 
<br> 
A. Set GraphForm.MinimizeBox to False. <br> 
B. Set GraphForm.MaximizeBox to False. <br> 
C. Set GraphForm.ControlBox to False. <br> 
D. Set GraphForm.ImeMode to Disables. <br> 
E. Set GraphForm.WindowState to Maximized. <br> 
F. Set GraphForm.FormBorderStyle to one of the Fixed styles. <br> 
G. Set GraphForm.GridSize to the appropriate size. <br> 

Answer: ABF 
<br> 
*** Verified. We disable the Minimize and Maximize buttons with the 
GraphForm.Minimizebox and the GraphForm.Maximizebox properties. Furthermore we 
should use a fixed FormBorderStyle to prevent the users from manually resizing 
the form.<br> 
<br> 

52. You develop a Windows-based application named CustOrders. You implement the 
Trace object within your application code. You will use this object to record 
application information, such as errors and performance data, in a log file. 
You must have the ability to enable and disable Trace logging. This 
functionality must involve the minimum amount of administrative effort. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Create a Boolean constant in your application named #TraceLogging and set it 
to False. Each time your code uses Trace logging, use a #if..#Then statement to 
evaluate your #TraceLogging constant. <br> 
B. On each computer that will host your application, create an environment 
variable named CustOrders.Trace. Set the environment variable to True when you 
want to enable Trace logging. Set it to False when you want to disable Trace 
logging. <br> 
C. On each computer that will host your application, edit the shortcut used to 
start your application. Add /d:TRACE=True to the Target property. <br> 
D. Use the TraceSwitch class within your code. Each time your code uses Trace 
logging, consult the TraceSwitch level to verify whether to log information. 
Change the TraceSwitch level by editing your applications .config file. <br> 

Answer: D 
<br> 
*** Verified. By placing Trace Switches in your code, you can control whether 
tracing occurs and how extensive it is.<br> 
<br> 

53. You use Visual Studio .NET to create a component named Request. This component 
includes a method named AcceptRequest, which tries to process new user requests 
for services. AcceptRequest calls a private function named Validate. You must 
ensure that any exceptions encountered by Validate are bubbled up to the parent 
form of Request. The parent form will then be responsible for handling the 
exceptions. You want to accomplish this goal by writing the minimum amount of 
code. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Use the following code segment in AcceptRequest:<br> Me.Validate() <br> 
B. Use the following code segment in AcceptRequest:<br> Try Me.Validate() <br>Catch ex 
As Exception <br>Throw ex <br>End Try <br> 
C. Use the following code segment in AcceptRequest: <br>Try Me.Validate()<br> Catch ex 
As Exception <br>Throw new Exception (&quot;Exception in AcceptRequest&quot;, ex)<br> 
End Try <br> 
D. Create a customer Exception class named RequestException by the following 
code segment:<br> Public Class RequestException Inherits 
System.ApplicationException <br> 
Public Sub New() 
End Sub<br> 
Public Sub New (message As String) MyBase.New(message)<br> 
End Sub<br> 
Public Sub New (message As String, inner As Exception)<br> 
MyBase.New(message, inner) <br> 
End Sub<br> 
End class<br><br> 
In addition, use the 
following code segment in AcceptRequest:<br> 
Try Me.Validate()<br> 
Catch ex As Exception<br> 
Throw new RequestException(&quot;Exception in AcceptRequest&quot;,ex)<br> 
End Try <br> 

Answer: B 
<br> 
*** Verified. We use a Try...Catch statement to catch any exceptions from the 
Validate function. We then throw any exceptions, without adding any further 
information (not C), to the parent form of Request.<br> 
<br> 

55. You develop a Windows-Based application that accesses a Microsoft SQL Server 
database. Users must supply a user name and password when they start the 
application. This information is then used to dynamically build a connection 
string. When you test the application, you discover that it is not using the 
SqlClient connection pooling feature. You must reduce the time needed to 
retrieve information. <br> 
How should you modify the connection string? <br> 
<br> 
<br> 
<br> 
A. to use the Windows user logon when connecting to the database. <br> 
B. to use the SQL Server used login when connecting to the database. <br> 
C. to use the same application logon ID and password for every connection to 
the database. <br> 
D. to use the guest login ID and password for every connection to the database. 
<br> 

Answer: C 
<br> 
*** Verified. We must use the same connection string to only use one connection 
pool.<br> 
The performance of the application can be enhanced by having the application 
share, or &quot;pool,&quot; connections to the data source. When a connection 
is opened, a connection pool is created based on an exact matching algorithm 
that associates the pool with the connection string in the connection. Each 
connection pool is associated with a distinct connection string. When a new 
connection is opened, if the connection string is not an exact match to an 
existing pool, a new pool is created.<br> 
<br> 

56. You use Visual Studio .NET to create a component that will be shared by two 
client applications. Eventually, you plan to deploy new version of this shared 
component. However, not all of the new versions will be compatible with both 
client applications. When you deploy the shared component and the client 
applications, you must ensure that you can upgrade the shared component for a 
single client application. You must also minimize the need for configuration 
changes when you deploy new version of the component. <br> 
What are two possible ways to achieve your goal? (Each correct answer 
represents a complete solution. Choose two) <br> 
<br> 
<br> 
A. Deploy each client application to its own folder. Deploy the shared 
component to its own folder. Register the shared component by using RegSvr32 
with the /s option. <br> 
B. Deploy each client application to its own folder. Deploy a separate copy of 
the shared component to each client application folder. When you deploy a new 
version of the component, replace the older version only if the new version 
remains compatible with the client application in the same folder. <br> 
C. Compile the client applications with reference to the shared component. 
Deploy both client applications and the shared component to a single folder. 
When you deploy a new version of the component, increment its version number. <br> 
D. Create a strong name of the shared component and specify a version number. 
Compile each client application and bind it to the shared component. Deploy the 
shared component to the global assembly cache on the client computer. Deploy 
each client application to its own folder. When you deploy a new version of the 
component, increment its version number. <br> 

Answer: BD 
<br> 
*** Verified.<br> 
<br> 

57. You develop an inventory management application that will call a Microsoft SQL 
Server stored procedure named sp_GetDailySales. The stored procedure will run a 
query that returns your daily sales total as an output parameter. <br> 
This total will be displayed to users in a message box. Your application uses a 
SqlCommand object to run sp_GetDailySales. <br> 
<br> 
You write the following code to call sp_GetDailySales: <br> 
Dim cnn As SqlConnection = New SqlConnection(myConnString) <br> 
Dim cmd As SqlCommand = New _ SqlCommand(&quot;sp_GetInventoryLevel&quot;, cnn) <br> 
cmd.CommandType = CommandType.StoredProcedure <br> 
Dim parm As SqlParameter =cmd.Parameters.Add(&quot;@ItemTotal&quot;, SqlDbType.Int) <br> 
parm.Direction=ParameterDirection.Output<br> 
cnn.Open() <br> 
cmd.ExecuteNonQuery() <br> 
Now you must write additional code to access the output parameter. <br> 
Which code segment should you use? <br> 
<br> 
<br> 
<br> 
A. MessageBox.Show(&quot;Total is: &quot; &amp; 
cmd.Parameters(&quot;@Output&quot;).Value.ToString()) <br> 
B. MessageBox.Show(&quot;Total is: &quot; &amp; cmd.Parameters(&quot;@Output&quot;).ToString()) 
<br> 
C. MessageBox.Show(&quot;Total is: &quot; &amp; 
cmd.Parameters(&quot;@ItemTotal&quot;).Value.ToString()) <br> 
D. MessageBox.Show(&quot;Total is: &quot; &amp; 
cmd.Parameters(&quot;@ItemTotal&quot;).ToString()) <br> 

Answer: C 
<br> 
*** Verified. The @ItemTotal parameter is declared as an output parameter with 
SQL Server data type INT. We use the Value property of the SQLParameter class 
to retrieve the value of this parameter. We must also convert the INT value to 
a string value with the ToString method. We then supply this string to the 
MessageBox.Show method.<br> 
<br> 

58. You develop a Windows-based application that includes several menus. Every 
top-level menu contains several menu items and certain munus contain items that 
are mutually exclusive. You decide to distinguish the single most important 
item in each menu by changing its caption text to bold type. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Set the Text property to &quot;True&quot;. <br> 
B. Set the DefalutItem property to True. <br> 
C. Set the Checked property to True. <br> 
D. Set the OwnerDraw property to True. <br> 

Answer: B 
<br> 
*** Verified.<br> 
<br> 

59. You use Visual Studio .NET to develop a Windows-based application. Your 
application includes a form named InformationForm, which enables users to edit 
information stored in a database. All user changes to this information must be 
saved in the database. <br> 
You need to write code that will prevent InformationForm from closing if any 
database changes are left unsaved. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Include Me.Activate in the Closing event handler of InformationForm. <br> 
B. Include Me.Activate in the Closed event handler of InformationForm. <br> 
C. Include Me.Activate in the Leave event handler of InformationForm. <br> 
D. Change a property of the System.ComponentModel.CancelEventArgs parameter in 
the Closing event handler of InformationForm. <br> 
E. Change a property of the System.EventArgs parameter in the Closed event 
handler of InformationForm. <br> 
F. Change a property of the System.EventArgs parameter in the Leave event 
handler of InformationForm. <br> 

Answer: D 


60. You develop an application that will be sold commercially. You create a Visual 
Studio .NET setup project to distribute the application. You must ensure that 
each user accepts your license agreement before installation occurs. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Add a launch condition to your setup project. Add your license agreement to 
the Message property of the launch condition. <br> 
B. Open the user interface designer for you setup project. Select the Welcome 
dialog box from the Start object and add your license agreement to the 
CopyrightWarning property. <br> 
C. Save your license agreement in Rich Text Format and add the file to your 
setup project. Open the property pages for the setup project and set the 
Certificate to the name of your Rich Text file. <br> 
D. Save your license agreement in Rich Text Format and add the file to your 
setup project. Open the user interface designer for the setup object. From the 
Start object, select the License Agreement dialog box and set the LicenseFile 
property to the name of your Rich Text file. <br> 

Answer: D 


61. You develop a Windows-based application by using Visual Studio .Net. You use 
the companies intranet to deploy the application to client computers. You use 
the security configuration of the .Net Framework to configure security for your 
application at the enterprise policy level. <br> 
Virus attacks cause the IT manager, at the company, to crap his pants then to 
tighten security, at the machine level. Users report that they can no longer 
execute your application. Imagne that, the IT manager screwed things up again. 
How should you, the hero programmer who was blamed for the problem, correct the 
problem? <br> 
<br> 
<br> 
<br> 
A. Include the LevelFinal attribute in the intranet code group policy at the 
enterprise level by using the Permission View tool (Permview.exe). <br> 
B. Include the Exclusive attribute in the intranet code group policy at the 
enterprise level by using the Permission View tool (Permview.exe). <br> 
C. Include the LevelFinal attribute in the intranet code group policy at the 
enterprise level by using the Code Access Security Policy tool (Caspol.exe). <br> 
D. Include the Exclusive attributes in the intranet code group policy at the 
enterprise level by using the Code Access Security Policy tool (Caspol.exe). <br> 

Answer: C 

*** This question was modified slightly to interject a bit of jockularity into 
an intense time. The changes actually reflect reality, in a better sense. My 
changes, in no way effect the answer, so go forth and prosper.<br> 
<br> 

62. You use Visual Studio .Net to create a Windows-based accounting application. Your 
application will be deployed on computers running Windows 98, Windows 2000 
Professional and Windows XP Professional. <br> 
You must ensure that your application records information about errors raised 
from calls to a procedure named UpdateData. To do so, you plan to implement 
logging features. <br> 
Which code segment should you use? <br> 
<br> 
<br> 
<br> 
A. Dim oLog As New EventLog()<br> 
Dim oType As EventLogEnterType<br> 
Try UpdateData()<br> 
Catch eEx As Exception<br> 
If Not EventLog.SourceExists(&quot;AccountingApp&quot;) Then <br> 
EventLog.CreateEventSource(&quot;AccountingApp&quot;,&quot;Application&quot;)<br> 
End<br> 
If oLog.Source = &quot;AccountingApp&quot; <br> 
oLog.Log = &quot;Application&quot;<br> 
oType = EventLogEntryType.Error<br> 
oLog.WriteEntry(&quot;Error details: &quot; &amp; oEx.Message, oType) <br> 
End Try <br> 
B. Dim 1FH As Long<br> 
Try UpdateData()<br> 
Catch oEx As Exception<br> 
1PH = FreeFile()<br> 
Open logfilePath For Append As #1FH<br> 
Print #1FH,oEx.Message <br> 
Close #1FH <br> 
End Try <br> 
C. Dim oWriter As New IO.StreamWriter(IO.File.Open(logfilePath,IO.FileMode.Append)) <br> 
Dim oListener As New TextWriterTraceListener(oWriter)<br> 
Debug.Listeners.Add(oListener)<br> 
Try UpdateData()<br> 
Catch oEx As Exception<br> 
Debug.WriteLine(oEx.Message)<br> 
oWriter.Flush() <br> 
oWriter.Close() oWriter = Nothing<br> 
End Try <br> 
D. Dim oWriter As New IO.StreamWriter(IO.File.Open(logfilePath,IO.FileMode.Append))<br> 
Dim oListener As New TextWriterTraceListener(oWriter)<br> 
Trace.Listeners.Add(oListener)<br> 
Try UpdateData()<br> 
Catch oEx As Exception<br> 
Trace.WriteLine(oEx.Message)<br> 
Trace.Listeners.Clear() <br> 
oWriter.Close()<br> 
oWriter =Nothing<br> 
End Try <br> 

Answer: D 
<br> 
*** Verified. Please make life easier for yourself and others who work with 
your code after you, by please useing Try/Catch blocks, in your code, whenever 
possible. Even if its just to print out a more user friendly error message to 
the user, when something doesnt work.<br> 
<br> 

63. You develop a Windows-based application that accesses a Microsoft SQL Server 
database. The application includes a form named CustomerForm, which contains a 
Button control named SortButton. The database includes a table named Customers. 
Data from Customers will be displayed on CustomerForm by means of a DataGrid 
control named DataGrid1. <br> 
The following code segment is used to fill DataGrid1: <br> 
Private Sub FillDataGrid() <br> 
Dim oConn As New SqlConnection(MyConString)<br> 
Dim oDA As New SqlDataAdapter(&quot;SELECT CustomerID, CompanyName, ContactName, Phone 
From Customers&quot;, oConn)<br> 
Dim oDS As New DataSet()<br> 
oDA.MissingSchemaAction =MissingSchemaAction.AddWithKey <br> 
oDA.Fill(oDS, &quot;Customers&quot;) <br> 
Dim oDV As New DataView(oDS.Tables(&quot;Customers&quot;)) <br> 
oDV.Sort = &quot;CustomerName ASC, ContactName ASC&quot; <br> 
oDV.ApplyDefaultSort = True <br> 
DataGrid1.DataSource =oDV <br> 
End Sub <br> 

The primary key for Customers is the CustomerID column. You must ensure that 
the data will be displayed in ascending order by primary key when the user 
selects SortButton. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Set the Sort property of the DataView object to an empty string. <br> 
B. Set the ApplyDefaultSort property of the DataView object to False. <br> 
C. Include an ORDER BY clause in the SELECT statement when you create the 
DataAdapter object. <br> 
D. Set the RowFilter property of the DataView object to CustomerID. <br> 

Answer: A 
<br> 
*** Verified. The initial form shows the data sorted with the DataView when the 
DataGrid is loaded.<br> 
When the SortButton is clicked, you would then set the sort property of the 
DataView object to an empty string to allow the default sort to occur from sql 
by primary key. Remember, a primary key causes a physical ordering of data, in 
the database. This is an excelent example of how to use and fill an 
SqlDataAdapter.<br> 
Also a good example of using a DataView for sorting data.<br> 
<br> 

64. You develop a customer contact application that will enable users to view and 
update customer data in a Windows Form. Your application uses a DataTable 
object and a DataAdapter object to manage the data and interact with a central 
database. <br> 
Your application design must fulfill the following requirements: <br> 
After a user completes a set of updates, the changes must be written in the 
database. <br> 
The data stored in the DataTable object must indicate that the database updates 
are complete. <br> 
What code segment should you use to accomplish this? <br> 
<br> 
<br> 
<br> 
A. DataTable.AcceptChanges() <br>DataAdapter.Update(DataTable) <br> 
B. DataAdapter.Update(DataTable) <br>DataTable.AcceptChanges() <br> 
C. DataTable.Reset() <br> DataAdapter.Update(DataTable) <br> 
D. DataAdapter.Update(DataTable) <br>DataTable.Reset() <br> 

Answer: B 
<br> 
*** Verified <br> 

65. You develop a Windows-based application that contains a form named Contact. You 
need to write code to initialize all class-level variables in Contact as soon 
as Contact is instantiated. You will place your code in a public procedure in 
the Contact class. <br> 
Which public procedure should you use? <br> 
<br> 
<br> 
<br> 
A. Create <br> 
B. Initialize <br> 
C. Load <br> 
D. New <br> 
Answer: D 

*** Verified <br> 

66. Your company uses Visual Studio .Net to create a Windows-based application for 
a hospital. The application is named PatientTracker, and it calls an assembly 
named Schedule. Six months pass. The hospital asks your company to develop a 
new Windows-based application. The new application will be named 
PhysicianTracker, and it will also call Schedule to serve both applications. Before 
you can use Schedule in PhysicianTracker, you need to complete some preliminary 
tasks. <br> 
Which three actions should you take? (Each correct answer represents part of 
the solution. Choose three) <br> 
<br> 
<br> 
A. Create a strong name for Schedule. <br> 
B. Use side-by-side execution to run Schedule. <br> 
C. Install Schedule in the global assembly cache. <br> 
D. Move Schedule to the Windows\System32 folder. <br> 
E. Create a reference in PhysicanTracker to Schedule. <br> 
F. Create a reference in PhysicanTracker to PatientTracker. <br> 

Answer: ACE 

*** Verified. You should be noticing a trend here reguarding strong naming and 
the global assembly cache.<br> 
<br> 
<br> 

67. You use Visual Studio .Net to develop a Windows-based application that contains 
a single form. This form contains a Label control named labelValue and a 
TextBox control named textValue. labelValue displays a caption that identifies 
the purpose of textValue. You want to write code that enables users to place 
focus in textValue when they press ALT+V. This key combination should be 
identified to users in the display of labelValue. <br> 
Which three actions should you take? (Each correct answer represents part of 
the solution. Choose three) <br> 
<br> 
<br> 
A. Set labelValue.UseMnemonic to True. <br> 
B. Set labelValue.Text to &quot;&amp;Value&quot;. <br> 
C. Set labelValue.CausesValidation to True. <br> 
D. Set textValue.CausesValidation to True. <br> 
E. Set textValue.TabIndex to exactly one number less than labelValue.TabIndex. <br> 
F. Set textValue.TabIndex to exactly one number more than labelValue.TabIndex. <br> 
G. Set textValue.Location so that textValue overlaps with labelValue on the 
screen. <br> 
H. Add the following code to the Load event of MainForm: 
text.Value.Controls.Add(labelValue); <br> 

Answer: ABF 

*** Verified.<br> 
<br> 
<br> 

68. You develop an application, remote, that enables mobile salespeople to look up 
contact information in a database. The salespeople use portable computers 
running Windows XP Professional. Because of the large size of the database, you 
want to create a distribution package to distribute your application and the 
database on a CD-ROM. However, you discover that the total size of the 
distribution package exceeds the capacity of a 650-MB CD-ROM. You want to 
reduce the size of the distribution package so it will fit on a single CD-ROM. <br> 
Which two actions should you take? (Each correct answer represents part of the 
solution. Choose two) <br> 
<br> 
<br> 
A. Exclude the .Net Framework dependency from your distribution package. <br> 
B. Use a third-party compression utility to compress the .Net Framework 
dependency files. <br> 
C. Set the package files option of your setup project to 'In cabinet file(s)' 
and set the maximum CAB file size to 650 MB. <br> 
D. Set the Compression property of your setup project to Optimized for size. <br> 
E. Set the Bootstrapper property of you setup project to None. <br> 

Answer: AD 

*** Verified.<br> 
<br> 
<br> 

69. You develop a new sales analysis application that reuses existing data access 
components. One of these components returns a DataSet object that contains the 
data for all customer orders for the previous year. You want your application 
to display orders for individual product numbers. Users will specify the 
appropriate product numbers, at run time. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Use the DataSet.Reset method. <br> 
B. Set the RowFilter property of the DataSet object by using a filter 
expression. <br> 
C. Create a DataView object and set the RowFilter property by using a filter 
expression. <br> 
D. Create a DataView object and set the RowStateFilter property by using a 
filter expression. <br> 

Answer: C 
<br> 
*** Verified.<br> 
<br> 
<br> 

70. You plan to use Visual Studio .Net to create a class named BusinessRules, which 
will be used by all applications in your company. BusinessRules defines 
business rules and performs calculations based on those rules. Other developers 
in your company must NOT be able to override the functions and subroutines 
defined in BusinessRules with their own definitions. <br> 
Which two actions should you take to create BusinessRules? (Each correct answer 
represents part of the solution. <br> 
Choose two) <br> 
<br> 
<br> 
A. Create a Windows control library project. <br> 
B. Create a class library project. <br> 
C. Create a Windows Service project. <br> 
D. Use the following to define BusinessRules: Protected Class BusinessRules. <br> 
E. Use the following to define BusinessRules: Public Shadows Class 
BusinessRules. <br> 
F. Use the following to define BusinessRules: Public NotInheritable Class BusinessRules. 
<br> 
G. Use the following to define BusinessRules: Public MustInherit Class 
BusinessRules. <br> 

Answer: BF 

*** Verified. A class library is where you would want to create global glasses 
and Public will make it available for anyone to use, while NotInheritable makes 
it non-overrideable.<br> 
<br> 
<br> 

71. You develop a Windows control named FormattedTextBox, which will be used by 
many developers in your company. FormattedTextBox will be updated frequently. 
You create a custom bitmap image named CustomControl.bmp to represent 
FormattedTextBox in the Visual Studio .Net toolbox. The bitmap contains the 
current version number of the control, and it will be updated each time the 
control is updated. The bitmap will be stored in the application folder. If the 
bitmap is not available, the standard Textbox control bitmap must be displayed 
instead. <br> 
Which class attribute should you add to FormattedTextBox? <br> 
<br> 
<br> 
<br> 
A. &lt;ToolboxBitmap(GetType(TextBox))&gt;<br> 
Class FormattedTextBox <br> 
B. &lt;ToolboxBitmap(&quot;CustomControl.bmp&quot;)&gt;<br> 
Class FormattedTextBox <br> 
C. &lt;ToolboxBitmap(GetType(TextBox), &quot; CustomControl.bmp&quot;)&gt;<br> 
Class FormattedTextBox <br> 
D. &lt;ToolboxBitmap(GetType(TextBox))&gt; 
&lt;ToolboxBitmap(&quot;CustomControl.bmp&quot;)&gt;<br> 
Class FormattedTextBox <br> 

Answer: C 

*** Verified.<br> 
<br> 
<br> 

72. You use Visual Studio .Net to develop a Windows-based application. You 
implement the security classes of the .Net Framework. As users interact with 
your application, role-based validation will frequently be performed. <br> 
You must ensure that only Verified Windows NT or Windows 2000 domain users are 
permitted to access your application. <br> 
You add the appropriate Import statements for the System.Security.Principal 
namespace and the System.Threading namespace. <br> 
Which additional code segment should you use? <br> 
<br> 
<br> 
<br> 
A. AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)<br> 
Dim principal As WindowsPrincipal = CType(Thread.CurrentPrincipal,WindowsPrincipal) <br> 
B. AppDomain.CurrentDomain.SetThreadPrincipal(PrincipalPolicy.WindowsPrincipal)<br> 
Dim principal As WindowsPrincipal = CType(Thread.CurrentPrincipal,WindowsPrincipal) <br> 
C. Dim identity As WindowsIdenty = WindowsIdentity.GetCurrent()<br> 
Dim principal<br> 
New WindowsPrincipal(identity) <br> 
D. Dim identity As WindowsIdenty = WindowsIdentity.GetAnonymous()<br> 
Dim principal<br> 
New WindowsPrincipal(identity) <br> 

Answer: A 

*** Verified.<br> 
<br> 
<br> 

73. You use Visual Studio .Net to create a Windows-based application. On the main 
application form, you create a TextBox control named textConnectionString. 
Users can enter a database connection string in this box to access customized 
data from any database in your company. You also create a Help file to assist 
users in creating connection strings. The Help file will reside on your company 
intranet. Your application must load the Help file in a new browser window when 
the user presses the F1 key, but only if textConnectionString has focus. You 
must create this functionality by using the minimum amount of code. <br> 
In which event should you write the code to display the Help file? <br> 
<br> 
<br> 
<br> 
A. textConnectionString_KeyPress <br> 
B. textConnectionString_KeyDown <br> 
C. textConnectionString_KeyUp <br> 
D. textConnectionString_GiveFeedback <br> 
E. textConnectionString_HelpRequested <br> 

Answer: E 
<br> 
*** Verified.<br> 
<br> 
<br> 

74. You use Visual Studio .Net to develop a Windows-based application that will 
interact with a Microsoft SQL Server database. Your application will display 
employee information from a table named Employees. You use ADO.NET to access 
the data from the database. To limit the possibility of errors, you must ensure 
that any type of mismatch errors between your application code and the database 
are caught at compile time rather then at run time. <br> 
Which two actions should you take? (Each correct answer represents part of the 
solution. Choose two) <br> 
<br> 
<br> 
A. Create an XML schema for Employees. <br> 
B. Create an XML style sheet for Employees. <br> 
C. Create an XML namespace for Employees. <br> 
D. Create a typed DataSet object based on the XML schema. <br> 
E. Create a typed DataSet object based on the XML style sheet. <br> 
F. Create a TypeDelegator class based on the XML namespace. <br> 

Answer: AD 

*** Verified. My friends, you should know this! <br> 
<br> 

75. You execute a query on your external Oracle database named SalesDate by using 
an OleDbCommand object. The query uses the Average function to return a single 
value that represents the average price of products in the inventory table. You 
want to optimize performance when you execute this query. To execute this query 
from your ADO.NET code, you need to use a method of the OleDbCommand object. <br> 
Which method should you use? <br> 
<br> 
<br> 
<br> 
A. ExecuteNotQuery <br> 
B. ExecuteScalar <br> 
C. ToString <br> 
D. ExecuteReader <br> 

Answer: B 

*** Verified. For optimum performance, you should always use ExecuteScalar when 
your retreiving a single value.<br> 
<br> 
<br> 

76. You create an assembly by using Visual Studio .Net. The assembly is responsible 
for writing and reading order entry information to and from an XML data file. 
The assembly also writes and reads values to and from the Windows registry 
while it is being consumed. The assembly will be distributed to client 
computers by using your company's intranet. All client computers are configured 
to implement the default .NET security policy. You need to implement security 
in the assembly. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Implement declarative security and execute the permission demand to allow 
access to the file system and Windows registry. <br> 
B. Implement declarative security and execute the minimum permission request to 
allow access to the file system and Windows registry. <br> 
C. Implement imperative security and execute the permission demand to allow 
access to the file system and Windows registry. <br> 
D. Implement imperative security and execute the minimum permission request to 
allow access to the file system and Windows registry. <br> 

Answer: B 
<br> 
*** Verified. Declarative security checks in the application would be the 
fastest solution, while the minimum permission request allows access to the 
file system and Windows registry.<br> 
<br> 
<br> 

77. You develop a Windows-based application that contains a class named Contact. 
Contact uses ADO.NET to interact with a Microsoft SQL Server database. Contact 
requires an active connection to the database while it is being consumed. You 
must ensure that all resources used by Contact are properly released, as soon 
as, the class stops being consumed. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. In Contact, create a Sub procedure named Finalize to override 
System.Object.Finalize. Place the appropriate cleanup code in the Finalize 
procedure and call MyBase.Finalize. <br> 
B. In Contact, create a Sub procedure named Closed. Place the appropriate 
cleanup code in the Closed procedure. <br> 
C. Implement the Dispose method of the IDisposable interface. Place the 
appropriate cleanup code in the implemented Dispose method. Call the Dispose 
method of you form before releasing the reference. <br> 
D. Implement the Finalize method in the System.Windows.Form interface. Place 
the appropriate cleanup code in the implemented Finalize method. Call the 
Dispose method of your form before releasing the reference. <br> 

Answer: C 
<br> 
*** Verified.<br> 
<br> 
<br> 

78. You develop a Windows-based application that interacts with a Microsoft SQL 
Server database. The application inserts new rows into the database by calling 
the following stored procedure. <br> 
(Line numbers are included for reference only.) 
01 ALTER PROCEDURE <br> 
dbo.sp_UpdatePrice (@category int, @totalprice money OUTPUT) <br> 
02 AS<br> 
03 SET NOCOUNT ON <br> 
04 UPDATE Products SET UnitPrice = UnitPrice * 1.1 WHERE CategoryID= @category <br> 
05 SELECT ProductName FROM Products WHERE CategoryID = @category <br> 
06 RETURN @totalprice <br> 

Your application uses the ExecuteReader method of the SqlCommand object to call the stored procedure and create a SqlDataReader 
object. After the stored procedure runs, your code must examine the 
SqlDataReader.RecordsAffected property to verify that the correct number of 
records is successfully updated. <br> 
However, when you execute the stored procedure, the 
SqlDataReader.RecordsAffected property always returns 1. <br> 
How should you correct this problem. <br> 
<br> 
<br> 
<br> 
A. Change line 3 to SET ROWCOUNT 0 <br> 
B. Change line 3 to SET NOCOUNT OFF <br> 
C. Change line 6 to RETURN 0 <br> 
D. Change line 6 to RETURN @category <br> 

Answer: B 
<br> 
<br> 

79. You develop a Windows-based application for your payroll department. The 
application will include a procedure named Signin, which must allow users to 
report that they are present in their offices. The procedure must also allow 
each user to sign in other users. The procedure must return a Boolean variable 
indicating success or failure. <br> 
In most cases, the procedure will be called with no parameters. When no 
parameters are passed in, the procedure should recognize the user by the 
information stored in global variables. When one user signs in another user, 
the procedure should accept a string variable parameter that represents the 
user name of the user who is signed in. <br> 
You want to define your procedure to present the most efficient contract to the 
consumer. <br> 
Which two code segments should you use? (Each correct answer represents part of 
the solution. Choose two) <br> 
<br> 
<br> 
A. Public Function SignIn() As Boolean. <br> 
B. Public Function SignIn(userName As String) As Boolean <br> 
C. Public Function SignIn(userName As String, Success As Boolean) As Boolean <br> 
D. Public Function SignInWithName(userName As String) As Boolean <br> 
E. Public SignIn(username As String) <br> 
F. Public Sub SignInWithName(userName As String) <br> 

Answer: AB 

*** Verified.<br> 
<br> 
<br> 

80. You use Visual Studio .Net to develop a data entry form for a Windows-based 
application. The form will display one record at a time form a database. The 
form must include four Button controls. Each control will be used to navigate 
through the data in the database. You decide to create one procedure to handle 
the Click event for all four controls. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Create a control array consisting of four Button controls. Your code will 
inspect the Index argument that is passed into the Click event. <br> 
B. Create a control array consisting of four Button controls. Your code will 
inspect the Index property of the sender parameter of the Click event. <br> 
C. Create four individual Button controls. Create a procedure named 
NavButtons_Click to handle the Click event for all four controls by using the 
AddHandler keyword. <br> 
D. Create four individual Button controls. Create a procedure named 
NavButtons_Click to handle the Click event for all four controls by using the 
Implements keyword. <br> 
Answer: C 

*** Verified.<br> 
<br> 
<br> 

81. You use Visual Studio .Net to develop a Windows-based application. The 
application includes several menu controls that provide access to most of the 
application's functionality. One menu option is named calculateOption. <br> 
When a user chooses this option, the application will perform a series of 
calculations based on information previously entered by the user. To provide 
user assistance, you create a TextBox control named UserHelp. The corresponding 
text box must display help information when the user pauses on the menu option 
with a mouse or navigates to the option by using the arrow keys. You need to 
add the following code segment: <br> 
UserHelp.Text = &quot;This menu option calculates the result..&quot;; In which 
event should you add this coed segment? <br> 
<br> 
<br> 
<br> 
A. calculateOption_Click <br> 
B. calculateOption_Popup <br> 
C. calculateOption_Select <br> 
D. calculateOption_DrawItem <br> 
E. calculateOption_MeasureItem <br> 

Answer: C 

*** Verified. If you've done any development with .Net you are aware of the 
different events that fire in code behind and when you need to use them. The _Select 
event is fired in this instance.<br> 
<br> 
<br> 

82. You create a Visual Studio .NET setup project to distribute an application. You 
add a SQL script named appDB.SQL. You must ensure that the SQL script is 
executed during the installation process. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Add a custom action to your setup project. Select appDB.SQL as the source 
path. <br> 
B. Add a batch file to your setup procject to execute appDB.SQL. Add a launch 
condition to to setup project. Set the Condition property to the batch file. <br> 
C. Create a new Visual Studio .Net project that executes appDB.SQL. Include the 
new project with your setup project. Add a custom action that launches the new 
project during installation. <br> 
D. Add a launch condition to your setup project. Set the Condition property to 
appDB.SQL. <br> 

Answer: A 

*** Verified.<br> 
<br> 
<br> 

83. You use Visual Studio .Net to create a custom control named Stats. Stats will 
operate by periodically polling your network and updating the network 
statistics displayed to each user. Stats contains a Timer control named Timer1. 
<br> 
You set the control's Interval property to 500 milliseconds. You write code in 
the Tick event handler for Timer1 to poll the network status. You also create a 
procedure named RedrawControl to update the statistics displayed in Stats. When 
the form that contains Stats is minimized or hidden behind another window, the 
control should not consume unnecessary resources by updating the display. You 
must ensure that this condition is met. In addition, you want to write the 
minimum amount of code needed to finish developing Stats. <br> 
Which two actions should you take? (Each correct answer represents part of the 
solution. Choose two) <br> 
<br> 
<br> 
A. Place the following code segment in the Tick event handler for Timer1: 
RedrawControl() <br> 
B. Place the following code segment in the Tick event handler for Timer1: 
Me.Invalidate() <br> 
C. Place the following code segment in the Paint event handler for Timer1: If 
Me.Visible = True Then Me.Invalidate() <br> 
D. Place the following code segment in the Tick event handler for Timer1: If 
Me.Visible = True Then Me.Invalidate() <br> 
E. Place the following code segment in the Paint event handler for Stats: 
RedrawControl(1) <br> 
F. Place the following code segment in the Paint event handler for Stats: 
Me.Invalidate <br> 

Answer: DE 

*** Verified.<br> 
<br> 
<br> 

84. You create an assembly by using Visual Studio .Net. The assembly is consumed by 
other .Net applications to manage the creation and deletion of XML data files. 
The assembly includes a method named DeleteXMLFile that uses the Win32 API to 
delete the XML data files. A security exception is thrown when DeleteXMLFile is 
called from another .Net application. You must modify DeleteXMLFile to ensure 
that this method can execute functions exposed by the Win32 API. To do so, you 
create a SecurityPermission object that represents the right to call unmanaged 
code. <br> 
Which method of the SecurityPermission object should you call? <br> 
<br> 
<br> 
<br> 
A. Assert <br> 
B. Demand <br> 
C. PermitOnly <br> 
D. RevertDeny <br> 

Answer: A 

*** Verified.<br> 
<br> 
<br> 

85. You develop a Windows-based application that will retrieve employee vacation 
data and display it in a DataGrid control. The data is managed locally in a 
DataSet object named employeeDataSet. You need to write code that will enable 
users to sort data by department. <br> 
Which code segment should you use? <br> 
<br> 
<br> 
<br> 
A. Dim dvDept As New DataView()D<br> 
dvDept.Table = employeeDataSet.Tables(0)<br> 
dvDept.Sort = &quot;ASC&quot; <br> 
DataGrid1.DataSource = dvDept <br> 
B. Dim dvDept As New DataView() <br> 
dvDept.Table = employeeDataSet.Tables(0)<br> 
dvDept.Sort = &quot;Department&quot; <br> 
DataGrid1.DataSource = dvDept <br> 
C. Dim dvDept As New DataView() <br> 
dvDept.Table = employeeDataSet.Tables(0)<br> 
dvDept.ApplyDefaultSort = True <br> 
DataGrid1.DataSource = dvDept <br> 
D. Dim dvDept As New DataView() <br> 
dvDept.Table = employeeDataSet.Tables(0)<br> 
dvDept.ApplyDefaultSort = False <br> 
DataGrid1.DataSource = dvDept <br> 

Answer: B 

*** Verified.<br> 
<br> 
<br> 

86. You develop a Windows-based application that stores and retrieves data in a 
Microsoft SQL Server database called Sales. Your application uses ADO.NET and 
the SqlClient managed provider. You need to identify the security level of all 
errors returned from SQL Server. <br> 
What should your error-handling code do? <br> 
<br> 
<br> 
<br> 
A. Catch the SqlException that is thrown when the error occurs and access the 
Source property. <br> 
B. Catch the SqlException that is thrown when the error occurs and access the 
Class property. <br> 
C. Examine the State property of the SqlConnection object for the status of the 
connection after the error occurs. <br> 
D. Examine the DataSource property of the SqlConnection object for the status 
of the connection after the error occurs. <br> 

Answer: B 

*** Verified.<br> 
<br> 
<br> 

87. You develop a Windows-based application by using Visual Studio .Net. The 
application tracks information about customers, orders and shipping. Ten users 
will use the application on the client computers running Windows 2000 <br> 
Professional. You deploy the application by copying the contents of the 
project's \bin folder to the client computers. Nine users report that the 
application runs as expected. One user receives the following error message 
when the application is first exectuted: <br> 
&quot;The dynamic link library mscoree.dll could not be found in the specified 
path C:\Program File\Orders 
App;.;C:\WINN\System32;C:\WINNT\System;C:\WINNT\System32;C:\WINNT;C:\WINNT\System32\Wbem.&quot; 
You need to correct this problem on the client computer. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Install MDAC 2.7. <br> 
B. Install Internet Explorer 6. <br> 
C. Install the redistribute package for the .NET Framework. <br> 
D. Recopy the contents of the \bin folder. <br> 

Answer: C 

*** Verified.<br> 
<br> 
<br> 

88. You use Visual Studio .Net to create a data entry form. The form enables users 
to edit personal information such as address and telephone number. The form 
contains a text box named textPhoneNumber. If a user enters an invalid 
telephone number, the form must notify the user of the error. You create a 
function named ValidPhone that validates the telephone number entered. You 
include an ErrorProvider control named ErrorProvider1 in your form. <br> 
Which additional code segment should you use? <br> 
<br> 
<br> 
<br> 
A. Private Sub textPhone_Validating (ByVal sender As Object, ByVal e As 
System.ComponentModel.CancelEventArgs) _ Handles textPhoneNumber.Validating<br> 
If ValidPhone() = False then ErrorProvider1.SetError(textPhone, &quot;InvalidPhone. &quot;)<br> 
End Sub <br> 
B. Private Sub textPhone_Verified (ByVal sender As Object, ByVal e As 
System.EventArgs) _ Handles textPhoneNumber.Verified 
If ValidPhone() = False then ErrorProvider1.SetError(textPhone, &quot;Invalid Phone. &quot;) <BR> 
End Sub <br> 
C. Private Sub textPhone_Validating (ByVal sender As Object, ByVal e As 
System.ComponentModel.CancelEventArgs) _ Handles textPhoneNumber.Validating If 
ValidPhone() = False then ErrorProvider1.GetError(textPhone, &quot;Invalid 
Phone. &quot;) End Sub <br> 
D. Private Sub textPhone_Verified (ByVal sender As Object, ByVal e As 
System.EventArgs) _ Handles textPhoneNumber.Verified If ValidPhone() = False 
then ErrorProvider1.GetError(textPhone) End Sub <br> 
E. Private Sub textPhone_Validating (ByVal sender As Object, ByVal e As 
System.ComponentModel.CancelEventArgs) _ Handles textPhoneNumber.Validating If 
ValidPhone() = False then ErrorProvider1.UpdateBinding() End Sub <br> 
F. Private Sub textPhone_Verified (ByVal sender As Object, ByVal e As 
System.EventArgs) _ Handles textPhoneNumber.Verified If ValidPhone() = False 
then ErrorProvider1.UpdateBinding() End Sub <br> 

Answer: A 

*** Verified. Use setError, not GetError! Use Validating, not Verified! <br> 
<br> 

89. You develop a Windows-based application that enables users to update customer 
contact information. Your application uses a DataSet object to maintain the 
customer data while users are reviewing and editing it. When a user finishes 
updating the data, your application uses the DataSet.WriteXml method to create 
an XML data file. <br> 
The tag name of the root element of the XML data file must be: CustomerInfo You 
need to add code to your application to ensure that this tag name is set 
correctly. <br> 
Which code segment should you use? <br> 
<br> 
<br> 
<br> 
A. dsCustomer.Namespace = &quot;CustomerInfo&quot;. <br> 
B. dsCustomer = New DataSet(&quot;CustomerInfo&quot;). <br> 
C. dsCustomer.Prefix = &quot;CustomerInfo&quot;. <br> 
D. dsCustomer.WriteXml(&quot;CustomerInfo&quot;). <br> 

Answer: A 

*** Verified.<br> 
<br> 
<br> 

90. You are preparing a localized version of a Windows Form. Users of this form 
speak a language that prints text from right to left. User interface elements 
on the form need to conform to this alignment. You must ensure that all user 
interface elements are properly formatted when the localized Windows Form runs. 
You must also ensure that the form is easy to update and maintain. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Set the RightToLeft property on each control on the form to Yes. <br> 
B. Set the RightToLeft property of the form to Yes. <br> 
C. Set the Language property of the form to the appropriate language. <br> 
D. Set the Localizable property of the form to True. <br> 

Answer: B 

<br> 

91. You use Visual Studio .NET to develop a Windows-based application that 
interacts with a Microsoft SQL Server database. Your application contains a 
form named CustomerForm. You add the following design-time components to the 
form: <br> 
SqlConnection object named NorthwindConnection. <br> 
SqlDataAdapter object named NorthwindDataAdapter. <br> 
DatSet object named NorthwindDataSet. <br> 
Five TetBox controls to hold the values exposed by NorthwindDataSet. <br> 
At design time, you set the DataBindings properties of each TextBox control to 
the appropriate column in the DataTable object of NorthwindDataSet. When you 
test the application, you can successfully connect to the database. <br> 
However, no data is displayed in any text boxes. You need to modify your 
application code to ensure that data is displayed appropriately. Which behavior 
should occur while the CustomerForm.Load event handler is running? <br> 
<br> 
<br> 
<br> 
A. Execute the Add method of the TextBoxes DataBindings collection and pass in 
NorthwindDataSet. <br> 
B. Execute the BeginInit method of NorthwindDataSet. <br> 
C. Execute the Open method of NorthwindConnection. <br> 
D. Execute the FillSchema method of NorthwindDataAdapter and pass in 
NorthwindDataSet. <br> 
E. Execute the Fill method of NorthwindDataAdapter and pass in 
NorthwindDataSet. <br> 

Answer: E 

*** Verified. Dataset is a container; therefore, you need to fill it with data. 
You can populate a dataset by calling the Fill method of a data adapter.<br> 
<br> 
<br> 

92. You use Visual Studio .Net to create a Windows Service application. You compile 
a debug version and install it on your computer, which runs Windows 2000 
Server. You start the application from the Windows 2000 Service Control 
Manager. Now you need to begin debugging it within Visual Studio .Net. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Add a reference to the application within Visual Studio .Net. Add 
breakpoints to the code. Invoke the breakpoints by sending Stop, Pause and 
Continue commands from the Service Control Manager. <br> 
B. Select Processes from the Debug menu and attach the debugger to your 
application. <br> 
C. Place a breakpoint in the OnStart method of the application and then run it. 
<br> 
D. Place a breakpoint in the Main procedure of the application and then run it. 
<br> 

Answer: B 

*** Verified.<br> 
<br> 
<br> 
<br> 
<br> 
<br> 

93. You use Visual Studio .NET to create several applications that will be deployed 
commercially over the Internet. You must ensure that customers can verify that 
authenticity of your software. <br> 
Which action or actions should you take? (Choose all that apply) <br> 
<br> 
<br> 
A. Sign your portable executables by using Signcode.exe <br> 
B. Generate an X.509 certificate by using Makecert.exe <br> 
C. Purchase an X.509 certificate from a certificate authority <br> 
D. Purchase a Software Publisher Certificate from a certificate authority <br> 
E. Convert your certificate to a Software Publisher Certificate by using 
Certspc.exe <br> 

Answer: AD 

*** Verified. D - We must use a Software Publisher Certificate from a 
certificate authority. A - We then use this certificate to sign the portable 
executables with the Signcode.exe utility.<br> 
<br> 
<br> 

94. You develop a Windows-based time and billing application. You create a simple 
user interface to capture user-entered data. The application passes an object array 
of user-entered values to a function named AddUpDataTimeEntry. This function 
uses the LoadDataRow method of the Data Table object either to update an 
existing record in the table or to add a new record. When you test your 
application, you frequently receive an exception of type InalidCastException. <br> 
What is the cause of this error? <br> 
<br> 
<br> 
<br> 
A. You are trying to load a duplicate value into a Data Table column that has a 
unique constraint <br> 
B. The number of items in your object array does not match the number of 
columns in the Data Table object. <br> 
C. The data that you are trying to load into a column is not the correct data 
type specified for that column. <br> 
D. The columns in your Data Table object do not have the AllowDBNull property 
set to true. <br> 

Answer: C 

*** Verified. Unfortunatlly, I do this all to often. InvalidCastException Class 
implements the exception that is thrown for invalid casting or explicit 
conversion. An InvalidCastException is most often caused by an incorrect data 
type.<br> 
<br> 
<br> 

95. You use Visual Studio .NET to create an assembly that will be consumed by other 
Visual Studio .NET applications. No permissions should be granted to this 
assembly unless the assembly makes a minimum permission request for them. <br> 
Which code segment should you use? <br> 
<br> 
<br> 
<br> 
A. &lt;Assembly: PermissionSet(SecurityAction.PermitOnly, Unrestricted := 
True)&gt;<br> 
<br> 
B. &lt;Assembly: PermissionSet(SecurityAction.PermitOnly, Unrestricted := 
False)&gt;<br> 
<br> 
C. &lt;Assembly: PermissionSet(SecurityAction.RequestOptional, Unrestricted := 
True)&gt;<br> 
<br> 
D. &lt;Assembly: PermissionSet(SecurityAction.RequestOptional, Unrestricted := 
False)&gt;<br> 
<br> 

Answer: C 

*** Verified. Its quite interesting how most dumps have the correct answer for 
this question, without having anything in the answers. Oh well. The 
RequestOptional SecurityAction requests for additional permissions that are 
optional (not required to run). This action can only be used within the scope 
of the assembly. The assembly must have permission to request additional 
permission.<br> 
<br> 
<br> 

96. Your company standardizes on the .NET Framework as its software development 
platform. Subsequently, virus attacks cause your company to prohibit the 
execution of any applications downloaded from the Internet. <br> 
You must ensure that all client computers on your intranet can execute all .NET 
applications originating from your company. You must also ensure that the 
execution of .NET applications downloaded from the Internet is prohibited. <br> 
You must expend the minimum amount of administrative effort to achieve your 
goal. <br> 
Which policy should you modify? <br> 
<br> 
<br> 
<br> 
A. Application Domain <br> 
B. Enterprise <br> 
C. Machine <br> 
D. User <br> 

Answer: B 

*** Verified. An Enterprise policy applies to the whole domain of the company. 
It would require minimal administrative effort to set up.<br> 
<br> 
<br> 

97. You create a user control named ScrollControl, which you plan to sell to 
developers. You want to ensure that ScrollControl can be used only by 
developers who purchase a license to use it. You decide to use a license 
provided implemented by the LicFileLicense Provider class. Now you need to add 
code to ScrollControl to test for a valid control license. <br> 
Which two code segments should you add? (Each correct answer represents part of 
the solution. Choose two) <br> 
<br> 
<br> 
A. &lt;LicenseProvider(GetType(LicFileLicenseProvider))&gt;<br> 
<br> 
B. &lt;LicenseProvider(GetType(ScrollControl))&gt;<br> 
<br> 
C. In the Load event handler for ScrollControl, place the following code 
segment: <br> 
Try LicenseManger.Validate(GetType(ScrollControl)) Catch ex As 
Exception 'Insert code to disallow use.<br> 
End Try <br> 
D. In the Load event handler for ScrollControl, place the following code 
segment: Try Dim ControlLicense As License<br> 
LicenseManger.Validate(GetType(ScrollControl), Me)<br> 
Catch ex As Exception<br> 
'Insert code to disallow use. End Try <br> 
E. In the Load event handler for ScrollControl, place the following code 
segment: 
Try Dim bLicensed As Boolean bLicensed = LicenseManger.IsValid(GetType(ScrollControl))<br> 
Catch ex As Exception 'Insert<br> 
code to disallow use. End Try <br> 
F. In the Load event handler for ScrollControl, place the following code 
segment: <br> 
Try Dim bLicensed As Boolean <br> 
Dim ControlLicense As License bLicensed =LicenseManger.IsValid(GetType(ScrollControl), Me, ControlLicense)<br> 
Catch ex As Exception 'Insert code to disallow use. <br>End Try 

Answer: AD 

*** Verified. To enable licensing for your component 1 - Apply a LicenseProviderAttribute 
to the LicFileLicenseProvider class. (This is A) 2 - Call 
LicenseManager.Validate or LicenseManager.IsValid in the constructor. (This is 
D) <br> 
<br> 
<br> 

98. You use Visual Studio .NET to create a Windows-based application. You need to 
make the application accessible to users who have low vision. These users 
navigate the interface by using a screen reader, which translates information 
about the controls on the screen into spoken words. The screen reader must be 
able to identify which control currently has focus. One of the TextBox controls 
in your application enables users to enter their names. <br> 
You must ensure that the screen reader identifies this TextBox control by 
speaking the word &quot;name&quot; when a user changes focus to this control. <br> 
Which property of this control should you configure? <br> 
<br> 
<br> 
<br> 
A. Tag <br> 
B. Next <br> 
C. Name <br> 
D. AccessibleName <br> 
E. AccessibleRole <br> 

Answer: D 

*** Verified. The AccessibleName property is the name that will be reported to 
the accessibility aids.<br> 
<br> 
<br> 

99. You develop a Windows-based application by using Visual Studio .NET. The 
application uses a SqlConnection object for database access. You typically run 
this application on a computer that has limited RAM and hard disk space. After 
the code finishes using the SqlConnection object, you must ensure that the 
connection is closed and that any resources consumed by the object are released 
immediately. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Call the Finalize method of the SqlConnection object. <br> 
B. Call the Dispose method of the SqlConnection object. <br> 
C. Set the SqlConnection object equal to nothing. <br> 
D. Set the SqlConnection object equal to &quot;&quot;. <br> 

Answer: B 

*** Verified.<br> 
<br> 
<br> 

100. You use Visual Studio .NET to create an application that will be deployed to 
several client computers. You plan to create a setup package to distribute your 
application. Because of licensing restrictions, you must ensure that the setup 
package can be installed only on computers that have a particular registry key. 
<br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Add a registry key to the setup project. Set the Transitive property of your 
key to True. <br> 
B. From the Properties window, set the private key file option to the registry 
key. <br> 
C. From the Launch Conditions window, add a search for the registry key. Add a 
launch condition to evaluate the search results. <br> 
D. Open the setup project source code in Visual Studio.NET. Add code to search 
for the registry key and to abort the setup of the registry key does not exist 
on the client computer. Recompile setup1.exe and include it with your setup 
package. <br> 

Answer: C 

*** Verified.<br> 
<br> 
<br> 

101. You develop a Windows-based order entry application by using Visual Studio 
.NET. The application includes a DataSet object. When a customer order exceeds 
the number of items currently available in stock, the application must create 
two separate entries in a database. The first entry specifies the total number 
of items in the customer order, as well as the number of items that can be 
supplied immediately from available stock. The second entry records backorder 
information, and specifies the number of items that must be supplied when new 
stock becomes available. <br> 
Backorder processing is handled by a separate component. You must ensure that 
all order information in the DataSet object is captured and passed to this 
component. To do so, you need to create a new DataSet object. <br> 
Which method should you use? <br> 
<br> 
<br> 
<br> 
A. DataSet.Clone <br> 
B. DataSet.Copy <br> 
C. DataSet.Merge <br> 
D. DataSet.GetChanges <br> 

Answer: D 

*** Verified.<br> 
<br> 
<br> 

102. You develop a Windows-based application. You plan to use ADO.NET to call a 
Microsoft SQL Server stored procedure named EmployeeData. This procedure 
accepts a parameter for querying the database by an employee's family name. You 
need to add code to your application to set up the parameter for use with the 
stored procedure. <br> 
Which three lines of code should you add? (Each correct answer represents part 
of the solution. Choose three.) <br> 
<br> 
<br> 
A. Dim parm1 As New SqlParameter() <br> 
B. Dim parm1 As New SqlParameter(&quot;@FamilyName&quot;, SqlDbType.VarChar) <br> 
C. parm1.Direction = ParameterDirection.Input <br> 
D. parm1.Direction = ParameterDirection.InputOutput <br> 
E. cmd.Parameters.Add(parm1) <br> 
F. parm1.Add (cmd) <br> 

Answer: BCE 

*** Verified.<br> 
<br> 
<br> 

103. You develop a Windows-based application that uses several functions to 
calculate a given inventory quantity. This quantity is stored in a variable named 
IQuantity. When you test your application, you discover that the value of 
IQuantity sometimes falls below zero. For debugging purposes, you want your 
application to generate an error message in such cases. You also want to be 
able to view the call stack to help identify the function call that is causing 
the miscalculation. You need to insert additional code after the calculation of 
IQuantity. <br> 
Which code segment should you use? <br> 
<br> 
<br> 
<br> 
A. Trace.Assert(IQuantity &gt;= 0, &quot;Inventory cannot be less than 
zero.&quot;) <br> 
B. Trace.Assert(IQuantity &lt; 0, &quot;Inventory cannot be less than 
zero.&quot;) <br> 
C. Trace.Fail(IQuantity &gt;= 0, &quot;Inventory cannot be less than 
zero.&quot;) <br> 
D. Trace.WriteLineIf(IQuantity &lt; 0, &quot;Inventory cannot be less than 
zero.&quot;) <br> 

Answer: A 

*** Verified.<br> 
<br> 
<br> 

104. Your development team creates an order entry application by using Visual Studio 
.NET. The application stores and retrieves data in a Microsoft SQL Server 
database. All database connections in the application are centralized in class 
variables within a class named MyDataClass. <br> 
Each time your application needs to access data from the database, it creates 
an instance of MyDataClass by using the following code segment: <br> 
<br> 
Dim oData As New MyDataClass() <br> 
When the oData variable is no longer needed, it is set to Nothing or goes out 
of scope. Initially, about 500 sales representatives use the application. 
Later, your company hires 50 new sales representatives who also use the 
application. <br> 
You discover that the database is running out of available connections because 
of the increased usage. You must ensure that database connections are released 
immediately when they are no longer needed. You must also maintain an optimum 
level of application performance. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Add the procedure Protected Overrides Finalize() to MyDataClass. Write code 
in the procedure to close all open database connections. <br> 
B. Add the procedure Private Sub Finalize() to MyDataClass. Write code in the 
procedure to close all open database connections. <br> 
C. Implement the IDisposable interface within MyDataClass. Write code in the 
Dispose procedure of IDisposable to close all open database connections. Call 
the Dispose method of MyDataClass before any reference to MyDataClass is set to 
Nothing or goes of scope. <br> 
D. Find each location in your code where a reference to MyDataClass is set to 
nothing or goes out of scope. Add code after each instance to manually invoke 
the Visual Studio.NET garbage collector. <br> 
E. Add code to the Terminate event of MyDataClass to close all open database 
connections. <br> 
F. Ensure that each reference to MyDataClass is set to Nothing before it goes 
of scope. <br> 

Answer: C 

*** C is Verified. Some dumps say A.<br> 
<br> 

105. You develop a contact management application that will enable users to retrieve 
information from a central database. After the data is returned to your 
application, users must be able to view it, edit it, add new records, and 
delete existing records. All user changes must then be saved in the database. 
Your application design requires several ADO.NET objects to work together to 
accomplish these requirements. You use classes from the System.Data and 
System.Data.OleDb namespaces. First you write the code to connect to the 
database. <br> 
Which four actions should you take next? (Each correct answer represents part 
of the solution. Choose four.) <br> 
<br> 
<br> 
A. Create an OleDbDataAdapter object and define the selectCommand property. <br> 
B. Create an OleDbCommand object and use the ExecuteScalar method. <br> 
C. Create a DataTable object as a container for the data. <br> 
D. Create a DataSet object as a container for the data. <br> 
E. Call the DataAdapter.Fill method to populate the DataSet object. <br> 
F. Call the DataAdapter.Update method to populate the DataSet object. <br> 
G. Call the DataAdapter.Update method to save changes to the database. <br> 
H. Call the DataSet.AcceptChanges method to save changes to the database. <br> 

Answer: ADEG 

*** Verified.<br> 
<br> 
<br> 

106. You use Visual Studio .NET to develop a Windows-based application for your 
human resources (HR) department. The HR department has two subdivisions named 
Benefits and Employee Information. The Benefits subdivision includes the 
Vacation group. Both subdivisions will use your application. You plan to create 
four forms modeled after the organizational structure of the HR department. The 
forms will be named HR, EmployeeInformation, Benefits, and Vacation. The forms 
must be arranged in a hierarchy so that each form includes all code and 
controls found on the forms above it, in the hierarchy. <br> 
The form at the top of the hierarchy will be a standard Windows Form. The form must 
also adhere to the following rules: <br> 
<br> 
All forms should include code to access the general HR database. <br> 
Only forms used by the Benefits subdivision should have access to the Benefits 
database table. <br> 
The forms used by the Employee Information subdivision should have access to 
the EmployeeInformation database table. <br> 
The forms used by the Vacation group should include custom code to calculate 
vacation time. <br> 
<br> 
Now you must create the form hierarchy. Which code segment should you use? <br> 
<br> 
<br> 
<br> 
A. Public Class HR Inherits System.Windows.Forms.Form<br> 
End Class<br> 
Public Class Benefits Inherits System.Windows.Forms.Form<br> 
Implements HR <br> 
End Class Public<br> 
Class Vacation Inherits System.Windows.Forms.Form<br> 
Implements Benefits<br> 
End Class<br> 
Public Class EmployeeInformation Inherits System.Windows.Forms.Form<br> 
Implements HR <br> 
End Class <br> 
B. Public Class HR Inherits System.Windows.Forms.Form<br> 
End Class <br> 
Public Class Benefits Inherits System.Windows.Forms.Form Implements<br> 
HR End Class <br> 
Public Class Vacation Inherits System.Windows.Forms.Form<br> 
Implements Benefits <br> 
End Class<br> 
Public Class EmployeeInformation Inherits System.Windows.Forms.Form<br> 
Implements Benefits<br> 
End Class <br> 
C. Public Class HR Inherits System.Windows.Forms.Form <br> 
End Class <br> 
Public Class<br> 
Benefits Inherits HR <br> 
End Class <br> 
Public Class Vacation Inherits Benefits <br> 
End Class <br> 
Public Class EmployeeInformation Inherits HR <br> 
End Class <br> 
D. Public Class HR Inherits System.Windows.Forms.Form<br> 
End Class <br> 
Public Class Benefits Inherits HR <br> 
End Class <br> 
Public Class Vacation <br> 
Inherits Benefits <br> 
End Class Public Class EmployeeInformation Inherits Benefits 
End Class <br> 

Answer: C 

*** Verified. Some dumps show the rules as the possible answers. Not good! <br> 
<br> 

108. You use Visual Studio .NET to develop a Microsoft Windows-based application. 
Your application contains a form named CustomerForm, which includes the 
following design-time controls: <br> 
SQLConnection object named NorthwindConnection SQLDataAdapter object named 
NorthwindDataAdapter DataSet object named CustomerDataSet Five TextBox controls 
to hold the values exposed by CustomerDataSet Button control named saveButton 
At design time you set the DataBindings properties of each TextBox control to 
the appropriate column in the DataTable object of CustomerDataSet. When the 
application runs, users must be able to edit the information displayed in the 
text boxes. All user changes must be saved to the appropriate database when 
saveButton is executed. The event handler for saveButton includes the following 
code segment: <br> 
<br> 
NorthwindDataAdapter.Update(CustomerDataSet) <br> 
You test the application. However, saveButton fails to save any values edited 
in the text boxes.You need to correct this problem. <br> 
What should your application do? <br> 
<br> 
<br> 
<br> 
A. Call the InsertCommand method of NorthwindDataAdapter. <br> 
B. Call the Update method of NorthwindDataAdapter and pass in 
NorthwindConnection. <br> 
C. Before calling the Update method, ensure that a row position change occures 
in CustomerDataSet. <br> 
D. Reestablish the database connection by calling the open method of 
NorthwindConection. <br> 

Answer: B 

*** Verified. Dataset is a container; therefore, you need to fill it with data. 
You can populate a dataset by calling the Fill method of a data adapter.<br> 
<br> 
<br> 

109. You use Visual Studio .NET to create an accounting application. Within this 
application, you are debugging a function named CreditCardValidate. This 
function contains several dozen variables and objects. You create a breakpoint 
at the top of CreditCardValidate and run the application within the Visual 
Studio .NET IDE. As you step though the code in CreditCardValidate, you need to 
examine the contents of the bValidationStatus variable. However, you want to 
avoid seeing the contents of all variables and objects within 
CreditCardValidate. You also need to complete the debugging process as quickly 
as possible. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Add a watch expression for CreditCardValidate. <br> 
B. Open the Locals window. <br> 
C. Open a QuickWatch dialog box for CreditCardValidate. <br> 
D. From the Command window, print the contents of each variable by using 
CreditCardValidate. <br> 

Answer: A 

*** Verified. I say, Not C, because Ctrl+alt+q - Displays the quick watch 
dialog box with the current value of the selected expression. But you have to 
close and reopen the quick watch to see the current value and the question 
stated &quot;As you step though the code&quot; and &quot;complete the debugging 
process as quickly as possible. If bValidationStatus is the only expression you 
add to the watch window, you won't see the other variables.<br> 
<br> 


110. You develop a Windows-based application that connects to a Microsoft SQL Server 
database. Errors sometimes occur when users execute stored procedures in the 
database. You need to add error-handling code to your application to capture 
detailed information about any stored procedure that causes an error. <br> 
Which code segment should you use? <br> 
<br> 
<br> 
<br> 
A. Try myConnection.Open() <br> 
Catch e as exception <br> 
'Insert error-handling code. <br> 
End try <br> 
B. Try myConnection.Open() <br> 
Catch e as SQLException <br> 
'Insert error-handling code. <br> 
End try <br> 
C. Try myConnection.Open() <br> 
Catch e as DataException <br> 
'Insert error-handling <br> 
code. End try <br> 
D. Try myConnection.Open() <br> 
Catch e as DBConcurrencyException<br> 
'Insert <br> 
error-handling code.<br> 
End try <br> 

Answer: B 

*** Verified.<br> 

111. You develop a Windows-based application named Payroll. Your application 
receives information in the form of an XML data file named dataFile. This file 
does not include any schema information. You need to write code to load the XML 
data into a DataSet object. <br> 
Which code segment should you use? <br> 
<br> 
<br> 
<br> 
A. Dim ds As New DataSet(&quot;PayrollData&quot;) ds.readXml(dataFile, 
XmlReadMode.IgnoreSchema) <br> 
B. Dim ds As New DataSet(&quot;PayrollData&quot;) ds.readXml(dataFile, 
XmlReadMode.InferSchema) <br> 
C. Dim ds As New DataSet(&quot;PayrollData&quot;) ds.readXml(dataFile, 
XmlReadMode.ReadSchema) <br> 
D. Dim ds As New DataSet(&quot;PayrollData&quot;) ds.readXml(dataFile, 
XmlReadMode.Fragment) <br> 

Answer: B 


*** Verified (In Transcender as well) <br> 

112. You develop a Windows-based customer service application that includes a search 
feature. Users will enter characters in a text box to look up customer 
information by family name. For convenience, users must be able to perform a 
search by entering only the first few characters of the family name. To enable 
this functionality, your application will capture the users input and store it 
in a variable named CustomerName. Your application must then submit a Microsoft 
SQL Server query to the central customer service database. <br> 
How should you write the query? <br> 
<br> 
<br> 
<br> 
A. SQL = &quot;SELECT PersonalName, FamilyName FROM Customers WHERE FamilyName 
= '&quot; &amp; CustName &amp; &quot;%'&quot; <br> 
B. SQL = &quot;SELECT PersonalName, FamilyName FROM Customers WHERE FamilyName 
LIKE '&quot; &amp; CustName &amp; &quot;%'&quot; <br> 
C. SQL = &quot;SELECT PersonalName, FamilyName FROM Customers WHERE FamilyName 
= '&quot; &amp; CustName &amp; &quot;*'&quot; <br> 
D. SQL = &quot;SELECT PersonalName, FamilyName FROM Customers WHERE FamilyName 
LIKE '&quot; &amp; CustName &amp; &quot;*'&quot; <br> 

Answer: B 

*** Verified. As everyone knows, the LIKE stmt is used for sub searches along 
with the %.<br> 
<br> 

113. You use Visual Studio .NET to create a Windows-based application. The 
application captures screen shots of a small portion of the visible screen. You 
create a form named CameraForm. You set the CameraForm.BackColor property to 
Blue. You create a button on the form to enable users to take a screen shot. 
Now, you need to create a transparent portion of CameraForm to frame a small 
portion of the screen. Your application will capture an image of the screen 
inside the transparent area. <br> 
The resulting appearance of CameraForm is shown in the exhibit: <br> 
<br> 
Not shown! <br> 
You add a Panel control to CameraForm and name it transparentPanel. You must 
ensure that any underlying applications will be visible within the panel. <br> 
Which two actions should you take? (Each correct answer represents part of the 
solution. Choose two.) <br> 
<br> 
<br> 
A. Set transparentPanel.BackColor to Red. <br> 
B. Set transparentPanel.BackColor to Blue. <br> 
C. Set transparentPanel.BackgroundImage to None. <br> 
D. Set transparentPanel.Visible to False. <br> 
E. Set CameraForm.Opacity to 0%. <br> 
F. Set CameraForm.TransparencyKey to Red. <br> 
G. Set CameraForm.TransparencyKey to Blue. <br> 

Answer: AF 

*** Verfied. A - Will set the Background color of the Panel to Red. F - Will 
then set the transparency color of the Form to Red as well. This will make only 
the Panel transparent, since the background color of the form is Blue.<br> 
<br> 

114. You develop a Windows-based application to manage business contacts. The 
application retrieves a list of contacts from a central database. The list of 
contacts is managed locally in a DataSet object named contactDataSet. <br> 
To set the criteria for retrieval, your user interface must enable users to 
type a city name into a TextBox control. <br> 
The list of contacts that match this name must be displayed in a DataGrid 
control. <br> 
Which code segment should you use? <br> 
<br> 
<br> 
<br> 
A. Dim dv As New DataView() <br> 
With dv .Table = contactDataSet.Tables(0) <br> 
.RowFilter = TextBox1.Text <br> 
End With <br> 
DataGrid1.DataSource = dv <br> 
B. Dim dv As New DataView()<br> 
With dv <br> 
.Table = contactDataSet.Tables(0) <br> 
.RowFilter = &quot;City = '&quot; &amp; TextBox1.Text &amp; &quot;'&quot; <br> 
End With <br> 
DataGrid1.DataSource = dv <br> 
C. Dim dv As New DataView() <br> 
With dv <br> 
.Table = contactDataSet.Tables(0) <br> 
.Sort = TextBox1.Text <br> 
End With <br> 
DataGrid1.DataSource = dv <br> 
D. Dim dv As New DataView()<br> 
 With dv <br> 
.Table = contactDataSet.Tables(0) <br> 
.Sort = &quot;city = '&quot; &amp; TextBox1.Text &amp; &quot;'&quot; <br> 
End With <br> 
DataGrid1.DataSource = dv <br> <br> 

Answer: B 

*** Verified. To form a RowFilter value, specify the name of a column followed 
by an operator and a value to filter on. The value must be in quotes. Here we 
use construct the rowfilter with the = operator, string concatenation (&amp;) 
and the TextBox1.Text property.<br> 
<br> 

115. You develop a Windows-based application named Purchase that exchanges data with 
an accounting application. Purchase receives purchase order data from the 
accounting application in XML format. Users of Purchase review and edit the 
data. Purchase maintains the data in a DataSet object while users are working. 
When they are finished making changes, Purchase must create an output file that 
will be returned to the accounting application. For verification and auditing 
purposes, the accounting application must receive both the user changes and the 
original values. Now you need to write code that will create the output file. <br> 
What should you do? <br> 
<br> 
<br> 
A. Call the DataSet.WriteXmlSchema method and specify a TextWriter object as 
the argument. <br> 
B. Call the DataSet.WriteXmlSchema method and specify an XmlWriter object as the 
argument. <br> 
C. Call the DataSet.WriteXml method and specify WriteSchema as the XmlWriteMode 
parameter. <br> 
D. Call the DataSet.WriteXml method and specify DiffGram as the XmlWriteMode 
parameter. <br> 

Answer: D 

*** Verified. A DiffGram is an XML format that is used to identify current and 
original versions of data elements. Here we use the DataSet.WriteXml method 
with the Diffgram XmlWriteMode to write the entire DataSet as a DiffGram, 
including original and current values.<br> 



116. You need to add several pairs of controls to Form1. You must fulfill the 
following requirements: Each pair of controls must represent one column in the Table. 
<br> 
Each pair must consist of a TextBox control and a Label control. <br> 
The LostFocus event of each TextBox control must call a procedure named 
UpdateDatabase. <br> 
Additional forms simular to Form1 must be created for other tables in the 
database. <br> 
Application performance must be optimized. <br> 
The amount of necessary code must be minimized. <br> 
What should you do? <br> 
<br> 
<br> 
<br> 
A. Create and select a TextBox control and a Label control. Write the 
appropriate code in the LostFocus event of the TextBox control. Repeatedly copy 
and paste the controls into Form1 until every column in Table 1 has a pair of 
controls. Repeat this process for the other forms. <br> 
B. Add a TextBox control and a Label controls to Form1. Write the appropriate 
code in the LostFocus event of the TextBox control. Create a control array from 
the TextBox control and the Label control. At run time, add additional pairs of 
controls to the control array until every column in Table1 has a pair of 
controls. <br> 
C. Create a new user control that includes a TextBox control and a Label 
control. Write the appropriate code in the LostFocus event of the TextBox 
control. For each column in Table1, add one instance of the user control to the 
Form1. Repeat this process for the other forms. <br> 
D. Create a new ActiveX control that includes a TextBox control and a Label 
control. For each column in Table1, add one instance of the ActiveX control to 
Form1. Repeat this process for the other forms. <br> 

Answer: C 
 
