Sample Test 1

Question 1

You have created a DataSet that contains a single DataTable object named Customers. The Customers DataTable has all the rows and columns from the Customers table in your database. You would like to bind only selected columns from the Customers table to a DataGrid control. You want a solution that requires minimum programming, and you want to have minimum impact on the performance of SQL Server. How should you proceed?

  • A. Create a second DataTable in the DataSet . Copy the desired data to the second DataTable . Bind the second DataTable to the DataGrid .

  • B. Create a Command object to retrieve the desired columns from the DataTable . Bind the Command object to the DataGrid .

  • C. Bind the DataGrid control to the entire DataTable . Use the Width property of the columns in the DataGrid to hide the columns that are not desired by setting them to zero width.

  • D. Create a DataView that retrieves only the desired rows from the DataTable . Bind the DataGrid control to the DataView .

Question 2

Your application includes a SqlDataAdapter object named sqlDataAdapter1 that was created by dragging and dropping the Customers table from a database to your form. Your application also includes a DataSet named dsCustomers1, based on this SqlDataAdapter object. What line of code should you use to load the data from the database into the DataSet ?

  • A. dsCustomers1= sqlDataAdapter1.Fill("Customers")

  • B. sqlDataAdapter1.Fill("dsCustomers1", "Customers")

  • C. sqlDataAdapter1.Fill(dsCustomers1, "Customers")

  • D. sqlDataAdapter1.Fill(dsCustomers1)

Question 3

You have recently deployed an expense reporting system in your company. The application relies heavily on its SQL Server database. All employees in the company have identical access permissions to the database. You have created the application in such a way that it uses each employee's logon name and password in the connection string to connect to SQL Server. Users of the application are consistently reporting slow performance. Your task is to optimize the performance of this application. You note that another application that uses the same SQL Server database is having good performance. Which one of the following steps will you take?

  • A. Compile the application to native code using ngen.exe .

  • B. Run the SQL Server Index Tuning Wizard.

  • C. Increase the maximum size of the connection pool.

  • D. Use the same connection string for all users.

Question 4

You are developing a Windows-based application named VerifyOrders. The VerifyOrders application receives data from the Orders application in XML format. The VerifyOrders application enables its users to review orders and make any changes required. When the users are done reviewing orders, the VerifyOrders application must create an output XML file, which is returned to the Orders application. The output XML file must contain the original as well as the changed values. Which of the following options will you choose to create such an output XML file?

  • A. Call the DataSet.WriteXmlSchema() method and pass an XmlWriter object as a parameter.

  • B. Call the DataSet.WriteXml() method and set the value for the XmlWriteMode parameter to IgnoreSchema .

  • C. Call the DataSet.WriteXml() method and set the value for the XmlWriteMode parameter to WriteSchema .

  • D. Call the DataSet.WriteXml() method and set the value for the XmlWriteMode parameter to DiffGram .

Question 5

You are writing a Visual Basic .NET Windows application that executes several stored procedures to update a SQL Server database. You use database transactions to ensure that either all updates to the database succeed or the changes are rolled back in case of an error. You used the following code segment to create the database connection and the transaction object in your program:

 Dim sqlConnection1 As SqlConnection = _             New SqlConnection(strConnString) sqlConnection1.Open() Dim sqlCommand1 As SqlCommand = New SqlCommand() Dim sqlTrans As SqlTransaction 

You need to prevent other users from updating or inserting rows into the database until the transaction is complete. Which one of the following statements enable you to fulfill this requirement?

  • A.

     sqlTrans = sqlConnection1.BeginTransaction( _    IsolationLevel.ReadCommitted) 
  • B.

     sqlTrans = sqlConnection1.BeginTransaction( _     IsolationLevel.Serializable) 
  • C.

     sqlTrans = sqlCommand1.BeginTransaction( _    IsolationLevel.ReadCommitted) 
  • D.

     sqlTrans = sqlCommand1.BeginTransaction( _     IsolationLevel.Serializable) 
Question 6

You need to develop a Windows application that exports the content of the Customers table to an XML file. The exported XML file will be used by a marketing company for various customer-relation programs. The marketing company requires that customer data be exported to the XML file in the following format:

 <Customers CustomerID="ALFKI"            ContactName="Maria Anders"            Phone="030-0074321" /> <Customers CustomerID="ANATR"            ContactName="Ana Trujillo"            Phone="(5) 555-4729" /> 

Which of the following code segments would you use to export the Customers table to an XML file in the specified format?

  • A.

     Dim c As DataColumn For Each c in dataSet1.Tables("Customers").Columns     c.ColumnMapping = MappingType.Attribute Next dataSet1.WriteXml("Customers.xml") 
  • B.

     Dim c As DataColumn For Each c in dataSet1.Tables("Customers").Columns     c.ColumnMapping = MappingType.Element Next dataSet1.WriteXml("Customers.xml") 
  • C.

     Dim c As DataColumn For Each c in dataSet1.Tables("Customers").Columns     c.ColumnMapping = MappingType.Attribute Next dataSet1.WriteXml("Customers.xml", _ XmlWriteMode.WriteSchema) 
  • D.

     Dim c As DataColumn For Each c in dataSet1.Tables("Customers").Columns     c.ColumnMapping = MappingType.Element Next dataSet1.WriteXml("Customers.xml", _ XmlWriteMode.WriteSchema) 
Question 7

You are developing a Windows Forms application that processes data from a SQL Server 7.0 database. The application reads the data from the database in a forward-only way and does not perform any update operation. You use the System.Data.SqlClient.SqlConnection object to connect to the SQL Server database. You then use a System.Data.SqlClient.SqlCommand object to run a stored procedure and retrieve the results into a System.Data.SqlClient.SqlDataReader object. The application reads two fields from each row of data and concatenates their values into a string variable. What can you do to optimize this application?

  • A. Replace the SqlConnection object with an OleDbConnection object.

  • B. Replace the stored procedure with a SQL statement.

  • C. Replace the SqlDataReader object with a DataSet object.

  • D. Replace the String variable with a StringBuilder object.

Question 8

Your application uses a SqlDataReader object to retrieve patient information from a medical records database. When you find a patient who is currently hospitalized, you want to read the names of the patient's caregivers from the same database. You have created a second SqlDataReader object, based on a second SqlCommand object, to retrieve the caregiver information. When you call the ExecuteReader() method of the SqlCommand object, you get an error. What is the most likely cause of this error?

  • A. You are using the same SqlConnection object for both the SqlDataReader objects and the first SqlDataReader is still open when you try to execute the SqlCommand .

  • B. You must use a SqlDataAdapter object to retrieve the caregiver information.

  • C. You must use the OleDbDataReader object instead of the SqlDataReader object to retrieve information.

  • D. You are using the ExecuteReader() method of the SqlCommand object, but you should be using the ExecuteScalar() method instead.

Question 9

Your application retrieves data from the Customers and Orders tables in a database by using a view named vwCustOrders. This view is used as the CommandText for the SelectCommand of a DataAdapter object. The application uses the Fill() method of this DataAdapter to fill a DataSet . The DataSet is bound to a DataGrid control.

Users report that changes they make to data displayed on the DataGrid control are not saved to the database. What could be the problem?

  • A. The DataGrid control does not support editing data from a database.

  • B. You cannot update a DataSet that's based on a view.

  • C. The DataGrid control does not support two-way data binding.

  • D. Your application does not call the Update() method of the DataAdapter object.

Question 10

You use Visual Basic .NET to develop a Windows application that will be used by the customer service department. Your application receives data from the Orders application. Users of your application get calls from the customers to make changes to their orders. You write the code that allows them to make the changes to the data, but now you want to write code that sends the changed records back to the Orders application. Which one of the following methods should you use to accomplish this requirement?

  • A. DataSet.Clone()

  • B. DataSet.Copy()

  • C. DataSet.GetChanges()

  • D. DataSet.Merge()

Question 11

You develop a Windows application that allows users to add new regions in the SQL Server Sales database. You use the following Visual Basic .NET code segment to add regions :

 Dim command As SqlCommand = New SqlCommand(Nothing, sConn) command.CommandText =     "INSERT INTO Region (RegionID, " & _     "RegionDescription) VALUES (@rid, @rdesc)" command.Parameters.Add ( "@rid", rid) command.Parameters.Add ( "@rdesc", rdesc) command.ExecuteNonQuery() 

Each time users use this application, they may add several regions. Which one of the following options will you use to ensure the optimum performance of the application?

  • A. Use the SqlCommand.ExecuteReader() method instead of the SqlCommand.ExecuteNonQuery() method.

  • B. Call the SqlCommand.Prepare() method before each call to the SqlCommand.ExecuteNonQuery() method.

  • C. Call the SqlCommand.Prepare() method before the first call to the SqlCommand.ExecuteNonQuery() method.

  • D. Call the SqlCommand.ResetCommandTimeout() method before each call to the SqlCommand.ExecuteNonQuery() method.

Question 12

You've developed a Windows application named ProcessOrder using Visual Basic .NET. Your application receives orders from customers in an XML file named Orders.xml , which does not include any schema. Which of the following methods should you use to load the data from Orders.xml into a DataSet object? [Select two.]

  • A.

     Dim ds As DataSet = New DataSet("Orders") ds.ReadXml("Orders.xml", XmlReadMode.Auto) 
  • B.

     Dim ds As DataSet = New DataSet("Orders") ds.ReadXml("Orders.xml", XmlReadMode.DiffGram) 
  • C.

     Dim ds As DataSet = New DataSet("Orders") ds.ReadXml("Orders.xml", XmlReadMode.Fragment) 
  • D.

     Dim ds As DataSet = New DataSet("Orders") ds.ReadXml("Orders.xml", XmlReadMode.InferSchema) 
  • E.

     Dim ds As DataSet = New DataSet("Orders") ds.ReadXml("Orders.xml", XmlReadMode.ReadSchema) 
Question 13

You are a Microsoft .NET developer for a large warehousing company. You need to develop an application that helps users manage inventory. Inventory data is stored in a SQL Server 2000 instance named WareHouse2 in a database named Inventory. You use a SqlConnection object and Windows Integrated Authentication to connect with the Inventory database. Which of the following connection strings should you choose in your Visual Basic .NET program?

  • A.

    [View full width]
     
    [View full width]
    "Provider=SQLOLEDB;Data Source=WareHouse2; Initial Catalog=Inventory; Integrated graphics/ccc.gif Security=SSPI;"
  • B.

    [View full width]
     
    [View full width]
    "Provider=SQLOLEDB;Data Source=WareHouse2; Initial Catalog=Inventory; user id=sa; graphics/ccc.gif password=Ti7uGf1;"
  • C.

     "data source=WareHouse2; initial catalog=inventory; Trusted_Connection=True;" 
  • D.

     "data source=WareHouse2;user id=sa; password=Ti7uikGf1; initial catalog=inventory;" 
Question 14

The application you're designing should display employee information on a DataGrid control by using complex data binding. Your database contains a table of departments and a table of employees. The Employees table has a foreign key that points back to the Departments table. The application should communicate with the database via a slow WAN link. The list of departments changes approximately once every two months.

The form should display all the employees from a single department. Although users will only view one department at a time, they will frequently need to view several departments during the course of a session with the application.

You want to write minimum code. How should you design the filtering for this form?

  • A. Build one view on the server for each department. At runtime, have the program use the appropriate view to retrieve the requested department.

  • B. Each time the user requests a department, retrieve all the data into a DataSet object. Then delete all rows from the DataSet object that do not apply to this department.

  • C. Retrieve all the data into a DataSet object. Use a DataView object, with its RowFilter property set at runtime, to retrieve individual departments as needed.

  • D. Build one form for each department. Each form should be based on a view that returns only the employees for that department. At runtime, open the appropriate form. Hide the form when the user is done so that it can be opened more quickly if it's needed a second time.

Question 15

You are working with a complex form that uses Panel controls to organize a large amount of data. The form displays information from six different data sources. Some of the panels contain data from more than one data source.

You have added navigation buttons to scroll through the data in one particular data source. The navigation buttons increment and decrement the Position property of a CurrencyManager object. You test the form, and the buttons do not appear to scroll the data in that data source. What could be the problem? [Choose the best two answers.]

  • A. There are too many controls on the form, so your code is not being executed.

  • B. You retrieved the CurrencyManager object through the form's BindingContext object, but the Panel control has its own BindingContext object.

  • C. This particular CurrencyManager object does not support a Position property.

  • D. The BindingContext object you're using has more than one CurrencyManager object, and you're working with the wrong one.

Question 16

You have to develop a Windows application that will be used by the order-tracking system of your company. The application contains a form that displays a list of orders placed by the customers for the past year. When the employee selects an order from the list box, you need to display the order status and other information of the selected order in a set of text boxes. You have retrieved the order details in a DataSet object named dsOrders, which contains a table named Order that contains the order status and other information. You are required to bind the TextBox controls with the information from the DataSet . Which line of code would you use to bind a TextBox control to a field named OrderStatus in the Order table?

  • A.

     txtStatus.DataBindings.Add("Text", dsOrders, "Order.OrderStatus") 
  • B.

     txtStatus.DataBindings.Add("Text", dsOrders, "") 
  • C.

     txtStatus.DataBindings.Add("Text", dsOrders, "OrderStatus") 
  • D.

     txtStatus.DataBindings.Add("Tag", dsOrders, "Order.OrderStatus") 
  • E.

     txtStatus.DataBindings.Add("Tag", dsOrders, "") 
  • F.

     txtStatus.DataBindings.Add("Tag", dsOrders, "OrderStatus") 
Question 17

You've developed a Windows-based application that displays supplier data in a DataGrid control. The supplier data is stored in a table named Suppliers within the dsSuppliers DataSet object. The primary key for the Suppliers table is the SupplierID column. You need to display the supplier data in the DataGrid control in ascending order of a field named State. Which of the following code segments can you use? [Select two.]

  • A.

     Dim dvSuppliers As DataView =  _    New DataView(dsSuppliers.Tables("Suppliers")) dvSuppliers.Sort = "State ASC" dataGrid1.DataSource = dvSuppliers 
  • B.

     Dim dvSuppliers As DataView =  _    New DataView(dsSuppliers.Tables("Suppliers")) dvSuppliers.Sort = "ASC" dataGrid1.DataSource = dvSuppliers 
  • C.

     Dim dvSuppliers As DataView =  _    New DataView(dsSuppliers.Tables("Suppliers")) dvSuppliers.ApplyDefaultSort = True dataGrid1.DataSource = dvSuppliers 
  • D.

     Dim dvSuppliers As DataView =  _    New DataView(dsSuppliers.Tables("Suppliers")) dvSuppliers.Sort = "State" dataGrid1.DataSource = dvSuppliers 
Question 18

You need to develop a database application that interacts with an Oracle database. You need to write code to return the total number of customers from the database as quickly as possible. Which one of the following actions should you take?

  • A. Write an ad-hoc SQL query to return the total number of customers. Use the OleDbCommand.ExecuteScalar() method to execute the SQL statement.

  • B. Write an ad-hoc SQL query to return the total number of customers. Use the OleDbCommand.ExecuteReader() method to execute the SQL statement.

  • C. Write an ad-hoc SQL query to return the total number of customers. Use the OleDbDataAdapter.Fill() method to execute the SQL statement.

  • D. Create a stored procedure to return the total number of customers. Use the OleDbCommand.ExecuteScalar() method to execute the stored procedure.

  • E. Create a stored procedure to return the total number of customers. Use the OleDbCommand.ExecuteReader() method to execute the stored procedure.

  • F. Create a stored procedure to return the total number of customers. Use the OleDbDataAdapter.Fill() method to execute the stored procedure.

Question 19

You are developing a Windows form using Visual Basic .NET. You name the form form1 and place a TextBox control named textBox1 on it. The KeyPreview property of form1 is set to True . You write the following event handlers in the form's code:

 Private Sub form1_KeyPress(ByVal sender As Object, _  ByVal e As System.Windows.Forms.KeyPressEventArgs) _  Handles MyBase.KeyPress     If e.KeyChar = "a" Then         Debug.WriteLine("Handled by form")         e.Handled = True     End If End Sub Private Sub textBox1_KeyPress(ByVal sender As Object, _  ByVal e As System.Windows.Forms.KeyPressEventArgs) _  Handles textBox1.KeyPress     If e.KeyChar = "a" Then         Debug.WriteLine("Handled by textbox")     End If End Sub Private Sub textBox1_KeyDown(ByVal sender As Object, _  ByVal e As System.Windows.Forms.KeyEventArgs) _  Handles TextBox1.KeyDown     If e.KeyCode = Keys.A Then         Debug.WriteLine("Handled by textbox")     End If End Sub 

When testing this form, a user presses the A key with the focus in textBox1. What is the output generated from the event handlers?

  • A.

     Handled by form 
  • B.

     Handled by textbox Handled by form Handled by textbox 
  • C.

     Handled by textbox Handled by form 
  • D.

     Handled by textbox 
Question 20

Your form requires a control that behaves exactly like a TextBox control, except you want to display the text in red. You want to write minimal code. From which one of the following classes should you derive this control?

  • A. UserControl

  • B. TextBox

  • C. Control

  • D. Component

Question 21

You would like to give end users the ability to customize your application so that it fits in better with their corporate look and feel. In particular, you want to let them specify the text that appears in the title bar while writing the minimum amount of code. How would you add this ability to your application?

  • A. Supply full source code with your application and tell users that they can edit the text and rebuild the application.

  • B. Let the users edit the text in the Registry and use the Microsoft.Win32.Registry class to retrieve the value they save.

  • C. Make the Text property of the form a dynamic property and provide an XML file that the user can edit to set the value of the property.

  • D. Run code in the form's Load event to retrieve the form's title from a text file by using a FileStream object.

Question 22

Your department is responsible for maintaining a variety of accounting applications. You've been assigned the task of creating a standard control to represent credit and debit accounts. The control will be made up of a collection of TextBox and ComboBox controls. You want to write minimum code. On which class should you base this control?

  • A. Control

  • B. UserControl

  • C. Form

  • D. Component

Question 23

Your form allows the user to enter a telephone number into a TextBox control named txtPhone. You use the Validating event of this control to check whether the phone number is in the correct format. If the phone number is not in the correct format, you do not allow the focus to leave the txtPhone TextBox control.

The form also includes a Button control called btnCancel for canceling the data-entry action. The user should be able to click this button at any time, even when there is invalid data in the text box. What would you do to ensure this?

  • A. Set the CausesValidation property of the TextBox control to True.

  • B. Set the CausesValidation property of the Button control to True.

  • C. Set the CausesValidation property of the TextBox control to False.

  • D. Set the CausesValidation property of the Button control to False.

Question 24

Your application includes a CheckBox control with its ThreeState property set to True. Your form displays this control in the indeterminate state. You want to take an action only if the user checks the check box. Which code snippet should you use?

  • A.

     If chkTriState.CheckState = CheckState.Checked Then     ' Take action End If 
  • B.

     If chkTriState.Checked Then     ' Take action End If 
  • C.

     If chkTriState.CheckState = CheckState.Indeterminate_ Then     ' Take action End If 
  • D.

     If Not chkTriState.CheckState = CheckState.Unchhecked_ Then     ' Take action End If 
Question 25

The main menu form of your application uses the System.Drawing objects to draw your company's logo on its background. You wish to redraw the logo whenever the form is resized so that it always fills the entire form. You want a responsive interface but also want to write the minimum amount of code. Which of the following options should you choose?

  • A. Use a Timer control to call the Invalidate() method periodically.

  • B. Call the Invalidate() method within an event handler for the form's Resize event.

  • C. Call the Invalidate() method within an event handler for the form's Paint event.

  • D. Set the form's ResizeRedraw property to True.

Question 26

You are designing a Windows application with a variety of controls on its user interface. Some controls will be infrequently used. For these controls, you do not want the user to be able to tab to them, but the user should still be able to activate these controls by clicking them. Which of the following options should you use?

  • A. Set the TabIndex property of these controls to 0.

  • B. Set the TabIndex property of these controls to -1.

  • C. Set the TabStop property of these controls to False.

  • D. Set the Enabled property of these controls to False.

Question 27

Your form uses Label controls to convey information. When the text in a Label control represents a higher-than-average value, you want to display it in bold; when the text in a Label control represents a value that requires the user's attention, you want to display it in italics. If both conditions are True, you want to display the text in bold italics. How should you set the italic font style for the control when the value requires attention so that italics is added regardless of whether the font is already bold?

  • A.

     lblSampleText.Font.Style And FontStyle.Italic 
  • B.

     lblSampleText.Font.Style Xor FontStyle.Italic 
  • C.

     lblSampleText.Font.Style Or FontStyle.Italic 
  • D.

     lblSampleText.Font.Style Or (FontStyle.Underline And_ FontStyle.Bold) 
Question 28

Your application's main form contains two different Button controls, named btnA and btnB. When the user clicks either of these controls or moves the mouse over either of these controls, you want to run code to display a message on the form. The message is identical in all cases. You want to write the minimum code necessary. How should you structure your code to fulfill this requirement?

  • A. Write four separate event handlers, one each for the Click event of btnA, the MouseMove event of btnA, the Click event of btnB, and the MouseMove event of btnB.

  • B. Write two event handlers. The first will handle both Click events, and the second will handle both MouseMove events.

  • C. Write two event handlers. The first will handle the Click and MouseMove events for btnA, and the second will handle the Click and MouseMove events for btnB.

  • D. Write a single event handler to handle the Click and MouseMove events of both controls.

Question 29

You use Visual Studio .NET to develop an accounting application for your company. You need to develop a set of classes that contains classes and methods for accounting- related business rules. These classes will be used by several applications in the company. Other developers should be able to instantiate these classes, but you do not want those developers to create derived classes based on these classes. Which of the following options should you choose to create such a set of classes? [Select two.]

  • A. Create a Windows Control Library project to package your classes.

  • B. Create a Windows Service project to package your classes.

  • C. Create a Class Library project to package your classes.

  • D. Use the following class-declaration template to define your classes:

     Public MustInherit Class Class1 
  • E. Use the following class-declaration template to define your classes:

     Public NotInheritable Class Class1 
  • F. Use the following class-declaration template to define your classes:

     Private MustInherit Class Class1 
  • G. Use the following class-declaration template to define your classes:

     Private NotInheritable Class Class1 
Question 30

You are developing an accounting application that includes a class named Transaction . This class is inherited by subclasses such as DepositTransaction and PaymentTransaction . The Transaction class includes a method named VerifyChecksum() that should be available to the Transaction class and all classes derived from it, but not to any other classes in the application. Which access modifier should you use in the declaration of the VerifyChecksum() method?

  • A. Protected

  • B. Public

  • C. Private

  • D. Friend

Question 31

You've developed a Windows application that helps manage production schedules for a manufacturing company. This application uses a library named Production.dll . You anticipate that in the future some other applications may use classes from the Production.dll library. You may also need to maintain multiple versions of Production.dll . Which of the following options should you choose to deploy Production.dll ? [Select two.]

  • A. Sign Production.dll with sn.exe .

  • B. Sign Production.dll with signcode.exe .

  • C. Install Production.dll in the Windows system directory.

  • D. Install Production.dll in the Global Assembly Cache.

Question 32

You are designing a custom control for use in industrial automation. This control will monitor a serial port and raise events based on data sent in through the serial port. This control will be hosted on forms, but it does not require any visual representation at runtime. From which class should you derive this control?

  • A. Control

  • B. UserControl

  • C. Form

  • D. Component

Question 33

You are developing a Visual Basic .NET application. Your application has two classes, named Person and Employee . The Employee class is derived from the Person class, as shown in the following code:

 01: Public Class Person 02:       Overridable Public Sub GetInfo() 03:           ' Code to print person information 04:       End Sub 05: End Class 06: Public Class Employee Inherits Person 07:      Overrides Public Sub GetInfo() 08:         ' Calling the base class GetInfo method: 09: 10:      End Sub 11: End Class 

In the Employee class, you need to write code to call the GetInfo() procedure of the Person class and then do some additional processing. To accomplish this, which of the following bits of code should you insert at line 09?

  • A.

     Person.GetInfo() 
  • B.

     Me.GetInfo() 
  • C.

     MyBase.GetInfo() 
  • D.

     Person:GetInfo() 
Question 34

Your colleague is writing Visual Basic .NET code to understand how exception handling works. She has written the following code, which handles the Click event of a Button control that is placed on a Windows form:

 Private Sub Button1_Click( _      ByVal sender As System.Object, _      ByVal e As System.EventArgs) Handles Button1.Click         Dim i, j As Integer         Try             i = 0             j = 5 / i             Debug.WriteLine("Result = " & CStr(j))         Catch aex As ArithmeticException             Debug.WriteLine("Arithmetic Exception")             GoTo EndIt         Catch ex As Exception             Debug.WriteLine("Unknown Exception")             GoTo EndIt         Finally             Debug.WriteLine("Cleaning up")             i = 0             j = 0         End Try EndIt:     End Sub 

What output should she expect when the button is clicked?

  • A.

     Arithmetic Exception Unknown Exception 
  • B.

     Arithmetic Exception 
  • C.

     Result = Arithmetic Exception Cleaning Up 
  • D.

     Arithmetic Exception Cleaning Up 
Question 35

You've developed a Windows-based application that retrieves data from a SQL Server database named Customers. You use the System.Data.SqlClient data provider to connect with the database. You need to log the severity level of the error returned from the SQL Server .NET data provider. Which of the following options should you choose?

  • A. Catch the SqlException thrown by the SQL Server .NET data provider. Examine the Class property of the SqlException object.

  • B. Catch the SqlException thrown by the SQL Server .NET data provider. Examine the Source property of the SqlException object.

  • C. Catch the SqlException thrown by the SQL Server .NET data provider. Examine the Server property of the SqlException object.

  • D. Catch the SqlException thrown by the SQL Server .NET data provider. Examine the State property of the SqlException object.

Question 36

You need to develop a Windows application that accesses the Orders XML Web service provided by your company's business partner. You know the URL of the Web service. How can you generate client-side proxy classes for this Web service? [Select two.]

  • A. Use a proxy tool such as the .NET WebService Studio tool.

  • B. Use the Web Services Description Language tool.

  • C. Use the Web Services Discovery Tool.

  • D. Set a Web Reference to point to the Web service.

Question 37

You are asked to write a program that alerts users about the latest traffic and weather conditions in their area. You use Visual Studio .NET to write such a program. To gather the traffic and weather data, your application calls a few Web services. Users of your application complain that the user interface of the application is unresponsive while the traffic and weather information is being retrieved. Which of the following steps should you take to fix this problem?

  • A. Move the application to a faster computer.

  • B. Install a faster link to the Internet.

  • C. Install more memory in the computer.

  • D. Use asynchronous calls to invoke the Web service.

Question 38

You work as a Visual Basic .NET programmer for a multinational marketing company. You have been given the task to create a localized version of a Windows form for use in countries where the text is read from right to left. You need to make sure that all the controls in the form are aligned properly. You need to make minimal changes in the code. Which of the following options should you choose to accomplish this task?

  • A. Set the RightToLeft property of each control on the Windows form to True.

  • B. Set the RightToLeft property of each control on the Windows form to RightToLeft.Yes .

  • C. Set the RightToLeft property of the Windows form to True.

  • D. Set the RightToLeft property of the Windows form to RightToLeft.Yes .

Question 39

You are responsible for maintaining a COM component that is used by numerous applications throughout your company. You are not yet ready to migrate this COM component to .NET managed code, but you need to make it available to an increasing number of other projects that are being developed under the .NET Framework. What should you do?

  • A. Set a direct reference to the existing COM component from each .NET project.

  • B. Use the Type Library Importer tool to create and sign an assembly that will use the COM component. Place the generated assembly in the Global Assembly Cache.

  • C. Obtain a Primary Interop Assembly for the COM component.

  • D. Set a direct reference from a single .NET project to the COM component. Include this project in each solution that must make use of the component.

Question 40

You use Visual Basic .NET to develop a Windows form that allows users to enter readings from laboratory test results. You want to display help in a pop-up window when the user presses the F1 key. The help should be context sensitive (that is, the help text displayed should correspond to the form element that currently has the focus). You have decided the help text that will be associated with each control on the form. You choose to use the HelpProvider component to display help. Which of the following methods of the HelpProvider component should you invoke to set the associated help text?

  • A. SetHelpKeyWord()

  • B. SetHelpNavigator()

  • C. SetHelpString()

  • D. SetShowHelp()

Question 41

Your corporate guidelines insist that the documents generated by programs should be printed on legal-sized paper. Unfortunately, users sometimes use the Printer Setup dialog box to switch to letter- sized paper for their own convenience. Which event of the PrintDocument class can you use to check and (if necessary) change the paper tray?

  • A. BeginPrint

  • B. EndPrint

  • C. PrintPage

  • D. QueryPageSettings

Question 42

You use Visual Studio .NET to create an application that interacts with a Microsoft SQL Server database. You create a stored procedure to calculate the monthly wireless Internet access charges for customers. You name the stored procedure CalculateAccessCharges . When you run the program, you observe that the results from the stored procedure are not what you expected. You want to debug the CalculateAccessCharges stored procedure to find the error, but you also want to minimize the time and effort involved in debugging. Which of the following actions should you take?

  • A. Use the Tools, Debug Processes menu to attach a debugger to the SQL Server and then step into the CalculateAccessCharges stored procedure.

  • B. Place a breakpoint in the CalculateAccessCharges stored procedure and then use the Debug, Step Into menu to step into the Visual Basic .NET program that calls the stored procedure.

  • C. Use the SQL Server Print command to print the calculated values in the stored procedure.

  • D. Use the Debug.WriteLine() method to print the calculated values in the stored procedure.

Question 43

You've developed a Visual Studio .NET application that helps the shipping department in creating mix-and-match pallets. Users of the application complain that the number of cases in a pallet is not displayed correctly. To find the location of the error, you place a breakpoint on the GetCasesInPallet() method. However, when you execute the program by selecting Debug, Execute, the execution does not break at the breakpoint. Which of the following actions should you take to resolve this problem?

  • A. Select Exceptions from the Debug menu.

  • B. Select Enable All Breakpoints from the Debug menu.

  • C. Select Build, Configuration Manager and set the project's configuration to Debug.

  • D. Select Build, Configuration Manager and set the project's configuration to Release.

Question 44

Your application is failing when a particular variable equals 117. Unfortunately, you cannot predict when this will happen. You want to write minimal code. Which debugging tool should you use to investigate the problem?

  • A. The Locals window

  • B. The Output window

  • C. The Immediate window

  • D. A conditional breakpoint

Question 45

You need to develop an application that performs regression analysis on sales data. You start working on a code sample you borrowed from your colleague. You encounter several compile-time errors when you customize the code sample according to your requirements. You want to easily locate each error and correct it as quickly as possible. Which of the following actions would you take? [Select the best answer.]

  • A. Locate each error using the Task List window and fix them all before recompiling the program.

  • B. Locate each error using the Output window and fix them all before recompiling the program.

  • C. Locate each error using the Find Results window and fix them all before recompiling the program.

  • D. Locate each error using the Immediate window and fix them all before recompiling the program.

Question 46

You use Visual Studio .NET to develop an application that displays information about the user's computer. To find the name of the computer, you make a call to the GetComputerName() API function from a Visual Basic .NET program. You have read that the GetComputerName() API exists in kernel32.dll in both ANSI and Unicode versions. Your declaration is as follows :

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

Your code is failing with a System.EntryPointNotFoundException exception whenever you call this function. Which of the following steps should you take to fix this failure?

  • A. Supply the full path for kernel32.dll .

  • B. Declare the function as GetComputerNameA() instead of GetComputerName() .

  • C. Add the Auto modifier to the declaration.

  • D. Declare the function as GetComputerNameW() instead of GetComputerName() .

Question 47

You use Visual Basic .NET to create an assembly named Tracker.dll that contains classes for tracking a shipment. You need to deploy the assembly on the target computer in such a way that it can be accessed by multiple .NET applications. Which of the following actions should you take? [Select all that apply.]

  • A. Create a strong name for the assembly by using the Strong Name tool ( sn.exe ).

  • B. Register the assembly using the Assembly Registration tool ( regasm.exe ).

  • C. Use XCOPY to deploy the assembly to the Global Assembly Cache.

  • D. Use XCOPY to deploy the assembly to the Windows system directory.

  • E. Use a Setup and Deployment project to deploy the assembly to the Global Assembly Cache.

  • F. Use a Setup and Deployment project to deploy the assembly to the Windows system directory.

Question 48

You have deployed your .NET application to several computers in the PRODUCTION domain that are not used for development. Your own computer is in the DEVELOPMENT domain. A two-way trust relationship has been established between the PRODUCTION domain and the DEVELOPMENT domain. Users report problems with the running application. You want to attach to the remote process for debugging but are unable to do so. What could be the problem?

  • A. The Machine Debug Manager ( mdm.exe ) is not installed on the computers in the PRODUCTION domain.

  • B. Visual Studio .NET does not support cross-domain debugging.

  • C. You cannot attach to a remote process that was compiled in the default Release configuration.

  • D. You must add a switch to the application's configuration file to enable remote debugging.

Question 49

You use Visual Basic .NET to develop an assembly that allows developers in your company to create pie charts in their applications. You name the assembly PieChart.dll and package it as version 1.0.0, which is deployed into the Global Assembly Cache (GAC). After two months, you discover a bug in the assembly. You fix the bug by releasing a new version (1.0.1) of the assembly. You place the newly created assembly in the GAC. What will happen to the applications written by other developers that use PieChart.dll ?

  • A. The applications using the PieChart.dll assembly will break because the applications will notice two versions of the assembly in the GAC and won't know which one to execute.

  • B. The applications using the PieChart.dll assembly will notice a new version of the assembly and will load the new version of the assembly with no problem.

  • C. The applications using the PieChart.dll assembly will ignore the new version of the assembly in the GAC and will continue to use the older, buggy version of the assembly.

  • D. The applications using the PieChart.dll assembly will be asked to select the desired assembly version to run.

Question 50

You use Visual Basic .NET to develop a component that allows developers to create bar graphs in their applications. You name the component BarGraph. The developers need to deploy the BarGraph component with each application that uses it. How should you package the BarGraph component for deployment?

  • A. Use a Cab project to package the BarGraph component.

  • B. Use a Setup project to package the BarGraph component.

  • C. Use a Web Setup project to package the BarGraph component.

  • D. Use a Merge Module project to package the BarGraph component.

Question 51

Your company uses Visual Studio .NET to create a Windows-based application that helps students learn geography. The application uses several graphics and media files to make the presentation interesting and informative for the students. You have been assigned the task of creating a setup program for this application. Your installation program needs to target Windows XP computers with a full installation of Windows XP Service Pack 1. For ease in distribution and use, you need to package the setup program on a single CD-ROM. When you create the setup program, you note that the size of the resulting package is more than what you can fit on a CD-ROM. Which of the following steps should you take to accommodate the setup program on a single CD-ROM? [Select all that apply.]

  • A. Select the Detected Dependencies folder of the Installer project. In the Properties window, select the Exclude property for the .NET Framework dependency and set it to True.

  • B Select the Detected Dependencies folder of the Installer project. In the Properties window, select the Exclude property for the .NET Framework dependency and set it to False.

  • C. In the Deployment Project Properties dialog box, set the Package files property to In Cabinet File(s).

  • D. In the Deployment Project Properties dialog box, set the Compression property to Optimized for Size.

Question 52

You've developed a Windows-based application using Visual Studio .NET. The application needs to be distributed to users via the Internet. You use Visual Studio .NET Setup and Deployment projects to package the application. When you test the software on a Windows XP machine, you observe that your name is being shown as software publisher in the program-support information in the Add and Remove Programs section of the Windows Controls Panel. You need to change the name so that your company's name is displayed in the support information instead of yours. Which of the following procedures of the deployment project should you change?

  • A. Author

  • B. Description

  • C. SupportPhone

  • D. SupportUrl

Question 53

You have created a database-driven Windows application. Using Microsoft SQL Server, you have also generated an installation script for your database. This script is stored in a file named InstData.sql . You create a Setup project using Visual Studio .NET to deploy this application on your client's computer. Which of the following actions should you take to create the database when deploying your application on the client's machine?

  • A. Create a component that derives from the Installer class. Override its Install() method to create the database. Add the component to the Install node of the Custom Actions Editor in the Setup project.

  • B. Create a component that derives from the Installer class. Override its Install() method to create the database. Add the component to the Commit node of the Custom Actions Editor in the Setup project.

  • C. Copy the InstData.sql file to the Application Folder on the File System on Target Machine using the File System Editor. Add InstData.sql to the Install node of the Custom Actions Editor in the Setup project.

  • D. Create a component that derives from the Installer class. Override its Install() method to create the database. Add the component to the Launch Conditions Editor in the Setup project.

Question 54

You work as a Visual Studio .NET developer for a big finance company on Wall Street. The Chief Information Officer of the company has decided to take steps to increase the security in the organization so that malicious code cannot be executed. You have been asked to implement a security policy that allows users to execute applications locally and from the company's intranet but prevents them from executing code originating from the Internet. You want to complete this task with minimal effort. Which of the following actions should you take?

  • A. Modify the enterprise security policy.

  • B. Modify the machine security policy.

  • C. Modify the user security policy.

  • D. Modify the application domain security policy.

Question 55

You develop a Windows-based application using Visual Basic .NET. The name of the main executable file of your application is OrderHistory.exe . You use an XML-based application-configuration file to configure the behavior of OrderHistory.exe . What should you name the application-configuration file and where should you deploy it for the application to function correctly?

  • A. Name the application-configuration file OrderHistory.xml and deploy it in the Windows\System32 directory.

  • B. Name the application-configuration file OrderHistory.xml and deploy it in the same directory as OrderHistory.exe .

  • C. Name the application-configuration file OrderHistory.exe.config and deploy it in the Windows\System32 directory.

  • D. Name the application-configuration file OrderHistory.exe.config and deploy it in the same directory as OrderHistory.exe .

Question 56

You've developed a Windows-based application using Visual Basic .NET. Your code would like File I/O permission but can run without this permission. You plan to request the permission and trap the error if it is not granted. Which SecurityAction action should you use with the FileIOPermission object?

  • A. SecurityAction.RequestMinimum

  • B. SecurityAction.RequestOptional

  • C. SecurityAction.Demand

  • D. SecurityAction.RequestRefuse

Question 57

You have used Visual Basic .NET to develop a process-monitoring application. Your application can identify any process on the system that has a user interface and allows you to collect information about the process. Now you want to add code that can shut down the identified process as well. Which method should you use to shut down processes?

  • A. Process.Kill()

  • B. Process.WaitForExit()

  • C. Process.CloseMainWindow()

  • D. Process.WaitForInputIdle()

Question 58

The configuration file of a Windows application has the following contents:

 <system.diagnostics>    <switches>       <add name="BooleanSwitch" value="-1" />       <add name="TraceLevelSwitch" value="33" />    </switches> </system.diagnostics> 

You are using the following statements to create switch objects in your code:

 Dim booleanSwitch As BooleanSwitch = _     New BooleanSwitch("BooleanSwitch", "Boolean Switch") Dim traceSwitch As TraceSwitch = _     New TraceSwitch("TraceLevelSwitch", "Trace Switch") 

Which of the following options is correct regarding the values of these switch objects?

  • A. The booleanSwitch.Enabled property is set to False , and traceSwitch.Level is set to TraceLevel.Verbose .

  • B. The booleanSwitch.Enabled property is set to True , and traceSwitch.Level is set to TraceLevel.Verbose .

  • C. The booleanSwitch.Enabled property is set to False , and traceSwitch.Level is set to TraceLevel.Error .

  • D. The booleanSwitch.Enabled property is set to False , and traceSwitch.Level is set to TraceLevel. Info .

Question 59

You have added the following statement to the Load event handler of a single-form Windows application:

 Trace.Listeners.Add(New _       TextWriterTraceListener("TraceLog.txt")) 

Which of the following statements are true with respect to program execution? [Select all that apply.]

  • A. TextWriterTraceListener will listen to all messages generated by the methods of the Debug and Trace classes.

  • B. TextWriterTraceListener will listen only to the messages generated by the methods of the Trace class.

  • C. All the trace messages will be stored in a file named TraceLog.txt .

  • D. The trace messages will be displayed in the output window while the program is run in either the Debug or the Release configuration.

Question 60

You want to control the tracing and debugging output of a Windows-based application without recompiling your code. Which of the following classes will enable you to do this?

  • A. TraceListener

  • B. TraceSwitch

  • C. Trace

  • D. Debug



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

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