1.
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?
2.
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?
3.
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?
4.
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?
5.
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?
6.
You create Microsoft Windows-based applications. You are creating an application that will connect to a Microsoft SQL Server 2005 database. You write the following code segment for a method contained in the application. (Line numbers are included for reference only.)
01 private SqlConnection cn;
02 public frmMain() {
03 InitializeComponent();
04 cn = new SqlConnection("data source = localhost;initial Catalog = Accounting;integrated security = true");
05 }
In the production environment, the database will be stored by a server on the network. You need to eliminate the requirement to recompile the application when you deploy it to the production environment. You want to achieve this by using minimum amount of programming effort. What should you do?
7.
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?
8.
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?
9.
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.)
10.
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?