|
Question |
Rating |
View Answer |
|
You use Visual Studio .NET to create a component named Request. This component includes a method named AcceptEXRequest, which tries to process new user requests for services. AcceptEXRequest 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. What should you do? A. Use the following code segment in AcceptESRequest: this.Validate(); B. Use the following code segment in AcceptESRequest: try { this.Validate(); } catch(Exception ex) { throw ex;} C. Use the following code segment in AcceptESRequest: try { this.Validate();} catch(Exception ex) {throw new Exception(“Exception in AcceptESRequest”, ex); } D. Create a custom Exception class named RequestException by using the following code segment: public class RequestException:ApplicationException { public RequestException():base() {} public RequestException (string message):base(message) { } public RequestException(string message, Exception inner):base(message, inner) { } } In addition, use the following code segment in AcceptESRequest: try {.this.Validate(); } catch(Exception ex) { throw new RequestException(“Exception in AcceptESRequest”, ex); }
|
|
View Answer |
|
You work as software developer at XYZ inc. You need to 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. What should you do? A. SetShowHelp B. SetHelpString C. SetHelpKeyword D. ToString
|
|
View Answer |
|
You develop a Windows-based application that enables to enter product sales. You add a subroutine named XYZ. You discover that XYZ sometimes raises an IOException during execution. To address this problem you create two additional subroutines named LogError and CleanUp. These subroutines are governed by the following rules: • LogError must be called only when XYZ raises an exception. • CleanUp must be called whenever XYZ is complete. You must ensure that your application adheres to these rules. Which code segment should you use? A. try { XYZ(); LogError(); } catch (Exception e) { CleanUp(e); } B. try { XYZ(); } catch (Exception e) { LogError(e); CleanUp(); } C. try { XYZ(); } catch (Exception e) { LogError(e); } finally { CleanUp(); } D. try { XYZ(); } catch (Exception e) { CleanUp(e); } finally { LogError(); }
|
|
View Answer |
|
You use Visual Studio .NET to create a Windows-based application. The application includes a form named XYZForm, which displays statistical date in graph format. You use a custom graphing control that does not support resizing. You must ensure that users cannot resize, minimize, or maximize XYZForm. Which three actions should you take? (Each answer presents part of the solution. Choose three) A. Set XYZForm.MinimizeBox to False. B. Set XYZForm.MaximizeBox to False. C. Set XYZForm.ControlBox to False. D. Set XYZForm.ImeMode to Disabled. E. Set XYZForm.WindowState to Maximized. F. Set XYZForm.FormBorderStyle to one of the Fixed Styles. G. Set XYZForm.GridSize to the appropriate size.
|
|
View Answer |
|
You develop an application that includes a Contact Class. The contact class is defined by the following code: public class Contact{ private string name; public event EventHandler ContactSaved; public string Name { get {return name;} set {name = value;} } public void Save () { // Insert Save code. // Now raise the event. OnSave(); } public virtual void OnSave() { // Raise the event: if (ContactSaved != null) { ContactSaved(this, null); } } } You create a form named XYZForm. This form must include code to handle the ContactSaved event raised by the Contact object. The Contact object will be initialized by a procedure named CreateContact. Which code segment should you use? A. private void HandleContactSaved() { // Insert event handling code. } private void CreateContact() { Contact oContact = new Contact(); oContact.ContactSaved += new EventHandler(HandleContactSaved); oContact.Name = “XYZ”; oContact.Save(); } B. private void HandleContactSaved( object sender, EventArgs e) { // Insert event handling code. }. private void CreateContact() { Contact oContact = new Contact(); oContact.Name = “XYZ”; oContact.Save(); } C. private void HandleContactSaved( object sender, EventArgs e) { // Insert event handling code. } private void CreateContact() { Contact oContact = new Contact(); oContact.ContactSaved += new EventHandler (HandleContactSaved); oContact.Name = “XYZ”; oContact.Save(); } D. private void HandleContactSaved(Object sender, EventArgs e) { // Insert event-handling code. } private void CreateContact() { Contact oContact = new Contact(); new EventHandler(HandleContactSaved); oContact.Name = “XYZ”; oContact.Save(); }
|
|
View Answer |
|
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: • SqlConnection object named XYZConnection. • SqlDataAdapter object named XYZDataAdapter. • DataSet object named XYZDataSet. • Five TextBox controls to hold the values exposed by XYZDataSet. At design time, you set the DataBindings properties of each TextBox control to the appropriate column in the DataTable object of XYZDataSet. When you test the application, you can successfully connect to the database. 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? A. Execute the Add method of the TextBoxes DataBindings collection and pass in XYZDataSet. B. Execute the BeginInit method of XYZDataSet. C. Execute the Open method of XYZConnection. D. Execute the FillSchema method of XYZDataAdapter and pass in XYZDataSet. E. Execute the Fill method of XYZDataAdapter and pass in XYZDataSet. |
|
View Answer |
|
You use Visual Studio .NET to create a Windows-based application. The application includes a form named XYZForm. XYZForm contains 15 controls that enable users to set basic configuration options for the application. You design these controls to dynamically adjust when users resize XYZForm. The controls automatically update their size and position on the form as the form is resized. The initial size of the form should be 659 x 700 pixels.. If ConfigurationForm is resized to be smaller than 500 x 600 pixels, the controls will not be displayed correctly. You must ensure that users cannot resize ConfigurationForm to be smaller than 500 x 600 pixels. Which two actions should you take to configure XYZForm? (Each correct answer presents part of the solution. Choose two) A. Set the MinimumSize property to “500,600”. B. Set the MinimumSize property to “650,700”. C. Set the MinimizeBox property to True. D. Set the MaximumSize property to “500,600”. E. Set the MaximumSize property to “650,700”. F. Set the MaximumBox property to True. G. Set the Size property to “500,600”. H. Set the Size property to “650,700”.
|
|
View Answer |
|
You responsible for maintaining an application that was written by a former colleague at XYZ. The application reads from and writes to log files located on the local network. The original author included the following debugging code to facilitate maintenance: try { Debug.WriteLine(“Inside Try”); throw(new IOException());} catch (IOException e) { Debug.WriteLine (“IOException Caught”);} catch (Exception e) { Debug.WriteLine(“Exception Caught”);}. finally { Debug.WriteLine (“Inside Finally”);} Debug.WriteLine (“After End Try”); Which output is produced by thus code? A. Inside Try Exception Caught IOException Caught Inside Finally After End Try B. Inside Try Exception Caught Inside Finally After End Try C. Inside Try IOException Caught Inside Finally After End Try D. Inside Try IOException Caught Inside Finally
|
|
View Answer |
|
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, Group1 and Group2. You create a top-level menu item whose caption is Groups. Under this menu, you create two submenus. One is named group1Submenu, and its caption is Group 1. The other is named group2Submenu, and its caption is Group 2. When the user select 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 clicSheets 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. Which four actions should you take? (Each correct answer presents part of the solution. Choose four) A. Set group1Submenu.Text to “Group &1”. Set group2Submenu.Text to “Group &2”. B. Set Group1.ShortCut to “ALT1”. Set Group2.ShortCut to “ALT2”. C. In the group1Submenu.Click event, place the following code segment: group1Submenu.DefaultItem = true; In the group2Submenu.Click event, place the following code segment: group2Submenu.DefaultItem = true; D. In the group1Submenu.Click event, place the following code segment: group2Submenu.DefaultItem = false; In the group2Submenu.Click event, place the following code segment: group1Submenu.DefaultItem = false; E. In the group1Submenu.Click event, place the following code segment: group1Submenu.Checked = true; In the group2Submenu.Click event, place the following code segment: group2Submenu.Checked = true; F. In the group1Submenu.Click event, place the following code segment: group2Submenu.Checked = false; In the group2Submenu.Click event, place the following code segment: group1Submenu.Checked = false; G. Set group1Submenu.RadioCheck to True. Set group2Submenu.RadioCheck to True. H. Set group1Submenu.RadioCheck to False. Set group2Submenu.RadioCheck to False.
|
|
View Answer |
|
You use Visual Studio .NET to create a control that will be used on several forms in your application. It is a custom label control that retrieves and displays your company’s current stock price. The control will be displayed on many forms that have different backgrounds. You want the control to show as much of the underlying form as possible. You want to ensure that only the stock price is visible. The rectangular control itself should not be visible. You need to add code to the Load event of the control to fulfill these requirements. Which two code segments should you use? (Each correct answer presents part of the solution. Choose two) A. this.BackColor = Color.Transparent; B. this.ForeColor = Color.Transparent; C. this.BackImage = null; D. this.SetStyle(ControlStyles.UserPaint, false); E. this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
|
View Answer |
|
You create a Windows Form named XYZForm. The form enables users to maintain database records in a table named XYZ. You need to add several pairs of controls to XYZForm. You must fulfill the following requirements:. • Each pair of controls must represent one column in the XYZ table. • Each pair must consist of a TextBox control and a Label control. • The LostFocus event of each TextBox control must call a procedure named UpdateDatabase. • Additional forms similar to XYZForm must be created for other tables in the database. • Application performance must be optimized. • The amount of necessary code must be minimized. What should you do? 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 XYZForm until every column in the XYZ table has a pair of controls. Repeat this process for the other forms. B. Add a TextBox control and a Label controls to XYZForm. Write the appropriate code in the LostFocus event of the TextBox control. Create a control array form the TextBox control and the Label control. At run time, add additional pairs of controls to the control array until every column in the XYZ table has a pair of controls. Repeat this process for the other forms. 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 the XYZ table, add one instance of the user control to the XYZForm. Repeat this process for the other forms. D. Create a new ActiveX control that includes a TextBox control and a Label control. For each column in the XYZ table, add one instance of the ActiveX control to XYZForm. Repeat this process for the other forms.
|
|
View Answer |
|
You are a developer for a XYZ Inc that provides free software over the Internet. You are developing en 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 versions of the application for only four different cultures. You must ensure that your application will also be usable by people of other cultures. How should you prepare the application for deployment? A. Package a different assembly for each culture. B. Package a different executable file for each culture. C. Package a main assembly for source code and the default culture. Package satellite assemblies for the other cultures. D. Package a main assembly for source code. Package satellite assemblies for each culture.
|
|
View Answer |
|
You use Visual Studio .NET to develop an application that contains 50 forms. You create a procedure named PerformCalculations, which writes the results of several internal calculations to the Debug window. These calculations take more than one minute to execute. You want to be able to compile two versions of the application, one for debugging and the other for release. The debugging version should execute the calculations. The release version should not include or compile the calculations. You want to accomplish this goal by using the minimum amount of code. Which two actions should you take? (Each correct answer presents part of the solution. Choose two) A. Use the following code segment: #if DEBUG // Insert code to perform calculations. #endif B. Use the following code segment: if (DEBUG) { // Insert code to perform calculations. } C. Use the following code segment at the top of the module: #define DEBUG D. Add DEBUG = true to the Command Line Arguments box on the Debugging pane of the Project Properties dialog box. E. Ensure that the Conditional Compilation Constants option in the Build pane of the Project Properties dialog box contains the value DEBUG. F. Ensure that the Conditional Compilation Constants options in the Build pane of the Project Properties dialog box includes the value TRACE.
|
|
View Answer |
|
You use Visual Studio .NET to create a Windows-based application that will track camera sales. The application's main object is named Camera. The Camera class is created by the following definition: public class Camera { } You write code that sets properties for the Camera class. This code must be executed as soon as an instance of the Camera class is created. Now you need to create a procedure in which you can place your code. Which code segment should you use? A. public Camera() B. public void Camera() C. public bool Camera() D. public New() E. public Camera New() F. public Camera Camera()
|
|
View Answer |
|
You develop a Windows-based application by using Visual Studio .NET. The application includes a form named XYZForm and a class named Contact. XYZForm includes a button named cmdCreateContact. You must ensure that your application creates an instance of Contact when a user clicks this button. You want to write the most efficient code possible. Which code segment should you use? A. Contact contact = new Object(); B. Contact contact = new Contact; C. Object contact = new Contact; D. Contact contact = new Object;
|
|
View Answer |
|
As a developer at XYZ inc. you develop a Windows-based application by using Visual Studio .NET. The application tracks information about customers, orders, and shipping. Ten users will use this application on the client computers running Windows 2000 Professional. You deploy the application by copying the contents of the project’s in 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 executed: “The dynamic link library mscoree.dll could not be found in the specified path CProgram FilesOrders App;.;C:WINNTSystem32;C:WINNTSystem;C:WINNTSystem32;C:WINNT;C:WINNTSystem 32Wbem.” You need to correct this problem on the client computer. What should you do? A. Install MDAC 2.7. B. Install Internet Explorer 6. C. Install the redistribute package for the .NET Framework. D. Recopy the contents of the in folder.
|
|
View Answer |
|
You develop a Windows-based application by using Visual Studio .NET. The application includes numerous method calls at startup. After optimizing your application code, you test the application on a variety of client computers. However, the startup time is too slow. You must ensure that your application starts as quickly as possible the first time it runs. What should you do? A. Precompile your application by using the Native Image Generator (Ngen.exe): Install the precompiled application on the client computers. B. Install your application on the client computers. Precompile your application by using the Native Image Generator (Ngen.exe). C. Precompile your application by using the JIT compiler. Install the precompiled application on the client computers. D. Install your application on the client computers. Precompile your application by using the JIT compiler.
|
|
View Answer |
|
You use Visual Studio .NET to create an accounting application. Within this application, you are debugging a function named XYZValidate. This function contains several dozen variables and objects. One of the variables is named bValidationStatus. You create a breakpoint at the top of XYZValidate and run the application within the Visual Studio .NET IDE. As you steep through the code in XYZValidate, you need to view the contents of the bValidationStatus variable. However, you want to avoid seeing the contents of the other variables and objects in the function. You also need to complete the debugging process as quickly as possible. What should you do? A. Open the Locals window. B. From the Command window, print the contents of bValidationStatus by using ? bValidationStatus . C. Open the QuickWatch dialog box for bValidationStatus. D. Add a watch expression for bValidationStatus.
|
|
View Answer |
|
You develop an application that invokes a procedure named ProcessRecords. You implement the Trace class to log any errors thrown by ProcessRecords. You direct the Trace output to a local log file named ErrorLog.txt by using the following code segment: StreamWriter oWriter = new StreamWriter( File.Open(logfilePath, FileMode.Append)); TextWriterTraceListener oListener = new TextWriterTraceListener(oWriter); Trace.Listeners.Add(oListener); try { ProcessRecords(); }. catch (Exception oEx) { Trace.WriteLine(“Error: “ + oEx.Message; } finally { } Now you need to add code to your finally construct to write all output in the ErrorLog.txt file and then close the file. You want to write the minimum amount of code to achieve this goal. Which code segment should you use? A. oWriter.Close(); B. Trace.Flush(); oWriter.Close(); C. Trace.AutoFlush = true; oWriter.Close(); D. oWriter.AutoFlush = true; oWriter.Close();
|
|
View Answer |
|
You develop a Visual Studio .NET application that contains a function named XYZUpdate. For debugging purposes, you need to add an entry to a log file whenever XYZUpdate is executed. The log file is named DebugLog.txt. For maximum readability, you must ensure that each entry in DebugLog.txt appears on a separate line. Which code segment should you use? A. StreamWriter oWriter =. new StreamWriter(File.Open( @”C:DebugLog.txt”, FileMode.Append)); TextWriterTraceListener oListener = new TextWriterTraceListener(oWriter); Debug.Listeners.Add(oListener); Debug.WriteLine(“XYZUpdate “ + DateTime.Now.ToString); B. StreamWriter oWriter = new StreamWriter(File.Open( “C:\DebugLog.txt”, FileMode.Append)); TextWriterTraceListener oListener = new TextWriterTraceListener(oWriter); Debug.Listeners.Add(oListener); Debug.Write(“XYZUpdate “ + DateTime.Now.ToString); C. TextWriterTraceListener oListener = new TextWriterTraceListener(); oListener.Name = “C:\DebugLog.txt”; Debug.Listeners.Add(oListener); Debug.WriteLine(“XYZUpdate “ + DateTime.Now.ToString); D. TextWriterTraceListener oListener = new TextWriterTraceListener(); oListener.Name = “C:\DebugLog.txt”; Debug.Listeners.Add(oListener); Debug.Write(“XYZ“ + DateTime.Now.ToString);
|
|
View Answer |