70-548 - PRO: Designing and Developing Windows-Based Applications by Using the Microsoft .NET Framework

Go back to Microsoft

Example Questions

You create Microsoft Windows-based client applications. You are designing a smart client application for warehouse packaging clerks. The application must permit the clerks to add and delete items in the packaging invoices they create at their workstations. Each workstation has only a keyboard and a hand-held barcode scanner for input. You need to design the user interface for the application such that the clerks can add and delete items with minimum effort. What should you do? You create Microsoft Windows-based applications. You are designing a unit test class to test the functionality of a component named Calculator. The Calculator must function as a standard nonscientific calculator. A developer on your team writes the following lines of code for the test class. (Line numbers are included for reference only.) 01 [TestClass()] 02 public class CalculatorTest { 03 private TestContext testContextInstance; 04 public TestContext TestContext { 05 get{return testContextInstance;} 06 set{testContextInstance = value;} 07 } 08 [TestMethod()] 09 public void AddTest() { 10 Calculator target = new Calculator(); 11 Assert.AreEqual(target.Add(1,1),2); 12 target.Dispose(); 13 } 14 [TestMethod()] 15 public void SubtractTest() { 16 Calculator target = new Calculator(); 17 Assert.AreEqual(target.Subtract(10,2),8); 18 target.Dispose(); 19 } 20 } You need to ensure that appropriate assertions are tested. Which additional assertion should you test? You create Microsoft Windows-based applications. Your company network runs a Web-based application that permits managers to edit data in the employee database by using a Web form. You need to redesign the Web-based application as a rich-client application. The redesigned user interface must meet the following criteria: The data entry form dynamically creates the input controls with the corresponding labels. The data entry fields accept inputs of different lengths and the input controls acquire size accordingly. The user experience is similar to that of the previous Web-based application. Dynamically created input controls and labels must always align properly, even if the form is resized. You need to identify the control that can be used to minimize the user interface code complexity. Which control should you choose? You create Microsoft Windows-based applications. You are designing a unit test for a form in an application. You write the following code segment. (Line numbers are included for reference only.) 01 public partial class frmCalculation : Form { 02 public frmCalculation() { 03 InitializeComponent(); 04 } 05 private void cmdFib_Click(object sender, EventArgs e) { 06 lblResult.Text = Fibonacci(int.Parse(txtNumber.Text)).ToString(); 07 } 08 private void cmdFac_Click(object sender, EventArgs e) { 09 lblResult.Text = Factorial(int.Parse(txtNumber.Text)).ToString(); 10 } 11 private int Fibonacci(int number) { 12 if (number < 3) 13 return 1; 14 else 15 return Fibonacci(number - 1) + Fibonacci(number - 2); 16 } 17 private int Factorial(int number) { 18 int total = 1; 19 for (int x = number; x > 1; x--) 20 total *= x; 21 return total; 22 } 23 } You need to identify the methods that must be included for unit testing. Which methods should you choose? You create Microsoft Windows-based applications. You are enhancing an application for a medical transcription service. Users need to view a long list of medical codes and descriptions. The users displays are set at 800 x 600 resolution. The existing application requires the user to regularly obtain printouts that contain pages of medical codes. These medical codes frequently change. The application must be updated to assist users in entering medical codes into a database. The application must enable the user to view and enter medical codes and descriptions on screen at the same time. You need to evaluate the user environment and recommend a design that best meets the requirements of the users. What should you recommend? You create Microsoft Windows-based applications. You are creating a sales management application that accesses data from a Microsoft SQL Server 2005 database. The application uses Microsoft Windows Authentication Mode to access SQL Server 2005. After testing, the design team moves the database from the test server to the production server. The design team modifies the connection string on the application. You test the new configuration on your computer and the application runs successfully. You deploy the application to five client computers. The five client computers use other applications on the network that access different databases on the production server by using Windows Authentication Mode. You evaluate the application design and the production configuration. You conclude that the application will not connect to the database. What is the most likely cause of the problem? You create Microsoft Windows-based applications. You are designing a class to be used by multiple client applications. This class will be used to generate unique account numbers. Your company guidelines state that unique number generating components must comply with the following design pattern: Classes must be designed so that they cannot be instantiated directly by client applications. Only a single instance of the class must be used by all the client applications. Instance methods and properties for these classes must be accessible to client applications. You need to define how this class will implement the design pattern. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) You create Microsoft Windows-based applications. You create a component that calls an existing function. The design for the function specifies that it might throw an application-specific exception named InvalidChecksumException, which inherits from System.ApplicationException. The InvalidChecksumException exception is an error that can be handled. But the component cannot handle any other type of error. The component does not have any additional information that can be added to other types of errors. You need to design the component to correctly handle exceptions. You also need to ensure that the exception-handling strategy does not affect performance. What should you do? You create Microsoft Windows-based applications. You are designing a reusable composite control for a customer service application. The composite control contains three TextBox controls. The first TextBox control is used for the customers account number. The second TextBox control is used for the customers phone number. The third TextBox control is used to hold the last four digits of the customers social security number. The composite control is used to retrieve a customers insurance data. You need to ensure that data is entered in the valid format for all the three TextBox controls. Which action should you perform to achieve this goal? You create Microsoft Windows-based applications. You are creating a method. Your applications will call the method multiple times. You write the following lines of code for the method. public string BuildSQL(string strFields, string strTable, string strFilterId) { string sqlInstruction = "SELECT "; sqlInstruction += strFields; sqlInstruction += " FROM "; sqlInstruction += strTable; sqlInstruction += " WHERE id ="; sqlInstruction += strFilterid; return sqlInstruction; } The method generates performance issues. You need to minimize the performance issues that the multiple string concatenations generate. What should you do? You create Microsoft Windows-based applications. You need to evaluate the design concept of an application. The application must meet the following requirements: The application relies on the operating system for authentication. The application minimizes the amount of data sent over the network when connecting to the database. The application exposes data access code so that the future Web-based and mobile applications can reuse them. The application permits users to view and edit data contained in tables from a Microsoft SQL Server 2005 database. The application controls access to the SQL Server 2005 database at the table level. The design contains the following elements: The SQL Server 2005 database uses the Windows Authentication mode. A database schema that grants rights to the users at the table level. A stored procedure in Transact-SQL that accesses the necessary data required by the application. A Web service that uses a pre-defined credential to access the database and run the stored procedures. A Microsoft Windows-based application that impersonates the logged-on user and calls the Web service to retrieve and update the data. You need to evaluate the design and recommend appropriately. What should you recommend? You create Microsoft Windows-based applications. You are reviewing code for an application that is created for a bank. You find that a Microsoft Windows Form includes the following code segment. public partial class ATMDeposit : Form { private BankAccount account; public ATMDeposit() { InitializeComponent(); } private void ATMDeposit_Load(object sender, EventArgs e) { account = new BankAccount(); } private void cmdDeposit_Click(object sender, EventArgs e) { account.Deposit(decimal.Parse(txtAmount.Text)); } } You analyze the code segment and find that the form handles no other events. You need to suggest changes to improve reliability. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) You create Microsoft Windows-based applications. You create a purchase order application. Sales personnel use the application to place orders for customers. Sales personnel need to connect to the network to use the application. The application saves data to a database server on the network. Multiple sales personnel use the application simultaneously. The purchase order application requires a logging mechanism to permit auditing of sales. The logging mechanism must meet the following requirements: Log entry is created for every sales order created, saved, or deleted. Log data is available only to administrators. Log entries for all sales are stored together. Current log data can be read while the application is running. You need to decide on a storage mechanism for the logged data. Which storage mechanism should you choose? You create Microsoft Windows-based applications. You are creating a component that will be used by several client applications. The component contains the following code segment. (Line numbers are included for reference only.) 01 namespace MyComponent { 02 public class Account { 03 private string mAccountNo; 04 private decimal mBalance; 05 public Account(string AcctNo) { 06 ... 07 } 08 public void Withdraw(decimal Amount) { 09 ... 10 } 11 public void Deposit(decimal Amount) { 12 ... 13 } 14 } 15 public class SavingsAccount:Account { 16 public SavingsAccount(string AcctNo):base(AcctNo) { 17 ... 18 } 19 public void ApplyInterestRate(decimal Amount) { 20 ... 21 } 22 } 23 } You need to redesign the Account class and the SavingsAccount class to meet the following requirements: Developers must not be able to instantiate the Account class from client applications. Developers must not be able to extend the functionality of the SavingsAccount class. Developers must be able to instantiate the SavingsAccount class from client applications. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two). You create Microsoft Windows-based applications. You are developing an application that will be used by stock traders. The project scope contains the following requirements: The application must permit users to set thresholds for minimum and maximum values for different stocks. The application must alert the user when stock prices reach the pre-defined thresholds. The application must permit the user to either buy or sell stock and specify the quantity of stock to trade. The application must permit multiple alerts to be displayed simultaneously. You need to decide how to implement the alert mechanism. What should you do? You create Microsoft Windows-based applications. You are creating an application that consumes both an internally developed Web service and an externally developed Web service. The application uses only some of the methods that both the Web services expose. You need to design an integration testing strategy for the application. You want to achieve this goal by using the minimum amount of programming effort. What should you test? You create Microsoft Windows-based applications. You are designing the integration test for an application. You write the following lines of code. (Line numbers are included for reference only.) 01 private void cmdCompare_Click(object sender, EventArgs e) { 02 decimal flightFare, carRental, hotelPrice, travelCost; 03 flightFare = wsFlyHigh.GetBestFare(txtOrigin.Text, txtDest.Text, datDateOut, datDateBack); 04 cmdGetRentalPrice.Parameters.Add("@DAYS",SqlDbType.Int); 05 cmdGetRentalPrice.Parameters[0].Value=int.Parse(txtDays.Text); 06 carRental = cmdGetRentalPrice.ExecuteScalar(); 07 hotelPrice = bigDeal.GetHotelPrice(int.Parse(txtDays.Text)); 08 travelCost = flightFare + carRental + hotelPrice; 09 txtTravelCost.Text = travelCost.ToString("C"); 10 } You analyze the code and discover the following features: wsFlyHigh is a Web service that is hosted on a partners extranet. cmdGetRentalPrice runs a stored procedure on a corporate database server. bigDeal is a COM component. You need to create a report that lists the parts of the code to be considered during integration testing. Which lines of code should you add to your report? You create Microsoft Windows-based applications. You create an application that requires users to be authenticated by a domain controller. The application contains a series of processor-intensive method calls that require different database connections. A bug is reported during testing. The bug description states that the application hangs during one of the processor-intensive calls more than 50 percent of the times when the method is executed. Your unit test for the same method was successful. You need to reproduce the bug. Which two factors should you ascertain from the tester? (Each correct answer presents part of the solution. Choose two.) You create Microsoft Windows-based applications. You are creating a stock trading application. The application keeps track of stock prices and raises events when the stock prices increase or decrease. The events are raised based on specific thresholds. When the events are raised, users specify whether to buy, sell, or hold the stocks. The stock trading application currently uses the Trace class to log the events raised by the application and the user responses. The raised events and the user responses are then logged to a Windows application log. You change the application logging mechanism to meet the following requirements: Log entries are saved in a central database. Log entries are also saved to the local application log. Other applications are able to use the same logging mechanism. The application code is changed as little as possible. You create a central database to store log entries for multiple databases. You need to choose a system-wide logging mechanism that is reused by the application and is a part of the application design structure. What should you do? You create Microsoft Windows-based applications. You are creating a component that will encapsulate a data source. Dozens of applications will use the component. The component must meet the following design requirements: 1.The component must be able to be modified within a Rapid Application Development environment. 2.The component must be without a user interface. You propose to derive the component from the System.Windows.Forms.Control class and to implement the IComponent interface. You need to decide whether the component will meet the requirements. What should you conclude? You create Microsoft Windows-based applications. You design a Windows Forms application that routes incidents to the most appropriate technical support representative. The application displays information in a Multiple Document Interface (MDI). A standard menu exists at the top of the MDI parent form. Toolbar containers provide functionality to the child forms. Users of the application are connected to the network locally and remotely. Five of the remote users have either visual or auditory impairments. Currently, a default beep alerts the users when a new support incident is assigned to them. You review the design and discover that the application fails to provide adequate accessibility functionality. You need to provide an application status feedback technique that is appropriate for all users. What should you do? You create Microsoft Windows-based applications. You are creating an application that will monitor sales data. The application must meet the following requirements: Users must be able to customize display settings and the amount of data to monitor. Users must be able to log on to any computer on the network to use the application. User settings must be retrieved based on the logged-on user from any computer on the network. You need to decide where to store the user settings. What should you do? You create Microsoft Windows-based applications. You receive the following code segment to review. (Line numbers are included for reference only.) 01 public partial class frmReceivables : Form 02 { 03 private DataSet ds; 04 public frmReceivables() 05 { 06 InitializeComponent(); 07 } 08 private void frmReceivables(object sender, EventArgs e) 09 { 10 SqlConnection cn = new SqlConnection(strConnectionString); 11 SqlDataAdapter daInvoices = new SqlDataAdapter("SELECT * FROM Invoices", cn); 12 SqlDataAdapter daCustomers = new SqlDataAdapter("SELECT * FROM Customers", cn); 13 ds = new DataSet("Receivables"); 14 daInvoices.Fill(ds); 15 daCustomers.Fill(ds); 16 } 17 } The strConnectionString variable is pre-populated from the application configuration file. Query statements will remain unchanged throughout the life cycle of the application. Connection pooling is not being used. This code segment accesses a Microsoft SQL Server 2000 database. The ds dataset is bound to a data grid view so that users can view and update data in the database. The code currently compiles correctly and works as intended. You need to enhance performance and reliability for this code. Which two actions should you recommend? (Each correct answer presents part of the solution. Choose two.) You create Microsoft Windows-based applications. Two of your Windows-based applications require the use of graphical progress indicators. These indicators are based on bitmap files. Such a component is not available in the .NET Framework. To facilitate the search for a component, you identify the following requirements: The component exposes methods to increment and decrement the progress bar, along with a method or a property to manually change the value of the progress bar. The component permits the use of different types of progress indicators, such as a regular progress bar or a circular progress bar. The component represents multiple progress indicators, permitting the developers to dynamically change the number of indicators. You research three third party components and find a component that matches the first two criteria. The component you find represents a single progress indicator. The component also exposes extra methods and properties that the developers must not use. You need to implement a strategy to use the third party component. You want to achieve this goal by using the minimum amount of programming effort. What should you do? You create Microsoft Windows-based applications. You are developing an application for the sales department. The application displays information under the following sections: Customer Name Shipping Address Billing Address Contact Numbers E-mail Addresses You need to design a user interface that permits the user to display one section at a time. You want to achieve this goal by using the minimal amount of code. Which user interface layout control should you select? You create Microsoft Windows-based applications. You review code for an application that is developed for a bank. You need to test a method named Deposit in one of the application components. The following code segment represents the Deposit method. (Line numbers are included for reference only.) 01 public void Deposit(decimal amount) { 03 if (!(amount > 0)) { 04 throw new Exception("Invalid deposit amount!"); 05 } else { 06 this.balance += amount; 07 } 08 } You use the Microsoft Visual Studio 2005 test feature to automatically generate the following unit test. (Line numbers are included for reference only.) 01 [TestMethod()] 02 public void DepositTest() { 03 BankAccount target = new BankAccount(); //balance will be ZERO 04 decimal amount = 100; 05 target.Deposit(amount); 06 Assert.Inconclusive ("A method that does not return a value cannot be verified."); 07 } You need to change the test method to return a conclusive result. Which line of code should you use to replace the code on line 06? You create Microsoft Windows-based applications. You are designing an application that permits insurance agents to provide insurance quotes to prospective customers. The application permits insurance agents to survey the customer and enter the customers responses into the application. Each customer response adjusts the computed level of risk for the customer depending on how the customer answers the question. The application must meet the following requirements: The application must continuously display a thermometer indicating the level of risk. The prospective customers risk must be updated after each question. The application must ensure that the user interacts with the thermometer component as little as possible. You need to evaluate a user interface design for the thermometer component of the application. What should you do? You create Microsoft Windows-based applications. You are designing an application that streams multimedia data. The application must have minimal impact on the network. The application will be used by Microsoft Windows XP Professional client computers and Microsoft Windows Server 2003 client computers. The media you need to use is stored on a file server in a nonproprietary raw video format and the files are unedited. You need to choose an appropriate design modification that requires the least amount of programming effort. What should you do? You create Microsoft Windows-based applications. You are designing an application that will be deployed to employees in your company. The company requires that all internal applications are branded with the corporate logo and a copyright notice. You need to ensure that all forms in the application contain the appropriate branding and copyright notice. Your solution must be extensible, maintainable, and require minimum effort to lay out. Which solution should you use? You create Microsoft Windows-based applications. You create an application that loads bulk weather data into a data warehouse for analysis. The application is used by data-entry technicians. One data-entry technician is visually impaired. The data-entry technicians provide a large flat file as the source of the data, and they typically minimize the application so that they can use other programs while the data is being loaded. The data entry technicians must load as many data files as possible during the course of their work day. The user interface contains a progress bar control that has a text label. The text label indicates the current percentage of progress. You need to provide appropriate status feedback to the user by indicating that the process is complete. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) You create Microsoft Windows-based applications. You participate in the planning phase of an incident tracking tool for technical support analysts. The incident tracking tool must meet the following requirements: Technical support analysts must open multiple incidents simultaneously. The application can run only one instance at a time. Users must be able to adjust the order and layout of the incident screens. You need to design an application user interface that meets these requirements with the minimum amount of code. Which action should you perform? You create Microsoft Windows-based applications. You are creating an application to be used by the employees of a multinational company. The application must meet the following requirements: Employees from any location can retrieve the latest price quotes from the companys Microsoft SQL Server database. Employees can submit orders online. The companys business partners can submit orders by using the software that they design themselves. The company cannot restrict the business partners choice of platform. You need to ensure that the application and the server communicate as effectively as possible. Which technology should you use? You create Microsoft Windows-based applications. You create a component to process daily reports. These daily reports are data-driven. Eight database tables dictate the following properties: the data that is printed the format of the data the order of output The component loads the configuration data into a specific internal structure. Subsequently, the component retrieves and outputs the report data based on the configuration settings that are stored in the internal structure. The database is not updated. You need to develop the data handling capabilities of the component to manage the configuration data and the report data. You also need to ensure that the reports are generated as quickly as possible. Which two data handling mechanisms should you choose? (Each correct answer presents part of the solution. Choose two.) You create Microsoft Windows-based applications. You create a banking application that will be used by the account managers of the bank. You identify a method to simulate the deposit functionality of a savings account. The method will calculate the final balance when monthly deposit, number of months, and quarterly rate are given. The application requirements state that the following criteria must be used to calculate the balance amount: Apply the quarterly interest rate to the balance amount of the account every three months. Apply the quarterly interest rate before the monthly deposit is calculated for the third month. You translate the outlined specification into pseudo code. You write the following lines of code. (Line numbers are included for reference only.) Method public static decimal SimulateSavings Input parameters int months decimal monthlyPayment decimal quarterlyRate Pseudo code 01 Declare balance variable, initialize it to zero 03 Return balance You need to insert the appropriate code in line 02. Which code segment should you insert? You create Microsoft Windows-based applications. You are creating an application that uses Windows Authentication. After authentication, the application retrieves a list of databases that are available to the logged-on user. The application also permits the user to select the following features: A model database to work on A type of chart to create Display settings for the chart The application must store default values as application settings to be retrieved the next time the user logs on. The settings will be stored in the registry under the HKEY_CURRENT_USER hive. You need to decide on the settings you must store. Which three settings should you store? (Each correct answer presents part of the solution. Choose three.) You create Microsoft Windows-based applications. You are creating a sales management application. This application will permit sales personnel to search for customer information in a Microsoft SQL Server 2005 database. All communication with the database server is done by using an SSL channel. When a user needs to search for customer information based on a name, the following sequence of actions occurs: 1.The user types a name into a text box. 2.The user clicks a button to initiate the search. 3.The component validates that the value the user types is less than 200 characters. 4.The value that is typed is passed as a string to a component. 5.The component concatenates the typed value to a Select statement in the Where clause of the component. 6.The statement is executed to generate a DataTable object. 7.The DataTable object is used to display the results to the user. You need to identify the risk factor in this application design. What should you conclude? You create Microsoft Windows-based applications. You create a Microsoft Windows-based application that stores information in a Microsoft SQL Server 2005 database. Your company requires that all database access is done by using stored procedures. The stored procedures must meet the following requirements: The procedures return data that can be used in any data-bound control in the application. The procedures return data in the most compact format available. No complex logic is needed in the procedures. You need to implement the most appropriate technology to write stored procedures that meet these requirements. You also need to ensure that the stored procedures can be easily updated as application requirements change. What should you do? You create Microsoft Windows-based applications. The sales department uses an application that accesses data from a local Microsoft Office Access database. To enable sales representatives to access the application when they are not in the office, you plan to install the application on a terminal server. The application will be accessed by 200 users simultaneously through a terminal services connection. You need to design an appropriate test strategy for the change. Which two tests should you choose? (Each correct answer presents part of the solution. Choose two.) You create Microsoft Windows-based applications. You are creating a sales management application for your company. The application will be used by 250 users on the companys network. In the future, the company will be expanding the user base to include at least 1,000 more users. The application will be stored locally on every computer. The application uses a set of assemblies that are installed in the global assembly cache for business rules. The application retrieves data from a Microsoft SQL Server 2005 database by using a set of methods from a Web service. The SQL Server 2005 database is hosted on a local server. The Web service is maintained at a local IIS 6.0 Server. You need to evaluate which aspects of the physical design can be modified to accommodate more users. Which two aspects should you consider modifying? (Each answer presents part of the solution. Choose two.) You create Microsoft Windows-based applications. You are creating an application to manage projects. Your current customers use Microsoft Windows 2000, Windows XP Professional, and Windows Server 2003, in workgroup and domain settings. The application must meet the following requirements: Identify the user for workflow functionality. Store data in a central location on your companys network. Permit data to be stored locally for offline access. Your application relies on Windows domainCbased authentication to identify the user without logging on to the application itself. You decide to use Microsoft SQL Server 2005 as the database engine and save the data locally in XML format for offline access. You need to identify the risks that are related to your design. Which risk should you identify? You create Microsoft Windows-based applications. You are creating an internal application. The application requirements are that you can audit the application to discover when users logged on and when they logged off from the application. Logon and logoff events must be stored in a centralized location. The application is designed to use the security credentials of the logged on Windows user. The auditing logon and logoff events policy is enabled for all computers on the network. Because of these settings, the application does not log any data that is related to logon and logoff events. You need to evaluate the design to find if the application meets the auditing requirements. What should you conclude? You create Microsoft Windows-based applications. You are upgrading an application that contains custom data-centric user controls. Each of these controls implements its own custom data-binding logic. Much of the data-binding code is similar from control to control. You create a new component that combines the common data-binding logic. You change the existing controls so they use this new component. You need to decide which tier of the application architecture this component will belong to. Where should you place the component? You create Microsoft Windows-based applications. You are developing a component that will be used by multiple Windows-based applications in a bank. Your specification states the following requirements for the BankAccount class: Store the balance value. Implement a public property to contain the value of balance. Implement a Deposit method that receives the amount to be deposited. This method does not return anything. Implement a Withdraw method that receives the amount to be withdrawn. This method does not return anything. The withdraw and deposit methods must throw exceptions in the following cases: o Negative values are used as amounts for withdrawal or deposit. o Amounts larger than the current balance are used for withdrawal. You need to create a unit test for the component. What should you do? You create Microsoft Windows-based applications. You are designing a user interface for a multi-page questionnaire. You need to ensure that the user interface meets the following business requirements: The user interface is reusable. The user interface requires the user to select three out of five choices for each question. The user interface permits the user to check a box to select the correct answer or answers. What should you do? You create Microsoft Windows-based applications. You are responsible for maintaining your companys application framework. You analyze the requirements for some of the applications that your company develops. You identify a common functionality. The functionality includes user interface elements as well as data-binding logic and display logic. You need to implement the functionality in such a way that other applications can reuse it. Which type of component should you implement? You create Microsoft Windows-based applications. You are changing an application to manage the daily activities of doctors and nurses in a hospital. The application will run on a single machine at the hospital front desk. The application will run 24 hours a day, seven days a week. Initial testing shows that the application consumes a lot of resources and that it runs out of memory intermittently. You want to change the application so that an alert is sent when memory usage is nearing the point of failure. An external application will be used for sending the alert. You need to decide what monitoring mechanism to use. You also need to ensure that the least amount of changes is introduced in the application. What should you do? You create Microsoft Windows-based applications. You create an application that accesses data on a Microsoft SQL Server 2005 database. You write the following code segment. (Line numbers are included for reference only.) 01 private void LoadData() 02 { 04 cn.Open(); 05 daProducts.Fill(ds); 06 daCategories.Fill(ds); 07 cn.Close(); 09 } The cn variable points to a SqlConnection object. The SqlConnection object will be opened almost every time this code segment executes. You need to complete this code segment to ensure that the application continues to run even if the SqlConnection object is open. You also need to ensure that the performance remains unaffected. What should you do? You create Microsoft Windows-based applications. You are responsible for evaluating the deployment of a product-pricing application. This application will be deployed on portable computers that are used by a team of sales personnel. The application must meet the following requirements: The application must run successfully on a dial-up connection. Users need to run the application locally. New features are added to the application on a monthly basis. You need to provide a deployment solution that will ensure your users always have the latest version of the application when they connect to the corporate network. What should you recommend? You create Microsoft Windows-based applications. You are testing a component named BankAccount. You write the following code segment for the BankAccount component. (Line numbers are included for reference only.) 01 public class BankAccount { 02 private decimal balance; 03 public decimal Balance { 04 get{return this.balance;} 05 set{this.balance = value;} 06 } 07 public void Withdraw(decimal amount) { 08 if(!(amount > 0)) { 09 throw new Exception("Invalid withdraw amount!"); 10 } else if (amount>this.balance) { 11 throw new Exception("Insufficient balance"); 12 } else { 13 this.balance -= amount; 14 } 15 } 16 public void Deposit(decimal amount) { 17 if(!(amount > 0)) { 18 throw new Exception("Invalid deposit amount!"); 19 } else { 20 this.balance += amount; 21 } 22 } 23 } The test project executes a valid withdraw operation and a valid deposit operation. It also verifies the account balance. Your companys check-in policy requires that the primary code path is tested before check in. Full testing will be completed later. You need to establish the lowest acceptable code coverage metric. What should you test? You create Microsoft Windows-based applications. Two of your Windows-based applications require the use of graphical progress indicators. These indicators are based on bitmap files. Such a component is not available in the .NET Framework. To facilitate the search for a component, you identify the following requirements: Component exposes a property to set a bitmap file that is used for the progress bar. Component permits the use of at least two types of progress bars. These progress bars are named percent progress and numeric progress. Component exposes a method to increment the progress bar. You find a component that fulfills all the requirements. You create a new component that extends the original component and overrides the Increment method. The Windows-based applications might use either the original component or the extended component. You write a test project to test the component. You need to ensure that all the requirements are met. You want to achieve this goal by using the minimum amount of programming effort. Which component members should you test?

Study Guides