Which line of code should you use to replace the code on line 06?
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?
Which technology should you choose?
You are an enterprise application developer. You are creating an application for the sales department. Users in the sales department are occasionally connected to the network. Users enter orders through a smart client interface. The orders are sent to a business component that is installed on an application server. The business component updates the orders. You need to ensure that the orders are reliably delivered to the server. Which technology should you choose?
Which three actions should you perform?
You are creating a class that uses unmanaged resources. This class maintains references to managed resources on other objects. You need to ensure that users of this class can explicitly release resources when the class instance ceases to be needed. Which three actions should you perform? (Each correct answer presents part of the solution. Choose three.)
Which two components should you include?
You create Microsoft Windows-based applications. You are designing integration tests for an application that your team is developing. Your team uses an application framework that is developed in-house.
The application consumes the following elements:
Third-party Web services
A third-party API for sending text messages to mobile phones Components from the application framework to access SQL Server databases and e-mail messages Managed code to access flat files in the file system
You need to create a report that lists the components that must be considered for integration testing.
Which two components should you include? (Each correct answer presents part of the solution. Choose two.)
What should you recommend?
You are an enterprise application developer. Your company operates a Microsoft Windows-based
client application. The application is deployed to 50 client computers on the network. The application uses a separate class library as a data access layer. The data access layer is currently deployed to the application folder of the client application. It is time consuming to deploy
new versions of the data access layer. You need to evaluate the current physical design of the application and recommend changes to speed up deployment of new versions of the data access layer. What should you recommend?
Which code segment should you use?
You are developing an application that stores data about your company’s sales and technical support teams. You need to ensure that the name and contact information for each person is available as a single collection when a user queries details about a specific team. You also need to ensure that the data collection guarantees type safety. Which code segment should you use?
Which two actions should you recommend?
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.)
What should you conclude?
You are an enterprise application developer. Your company has a Web-based application that runs on a single Web server. Session information is currently being stored by using the default session mode. You are redesigning the application to run in a Web farm. You must ensure that the failure of any single server does not make session information unavailable. A developer in your team recommends using the default session mode on each server in the Web farm. You need to evaluate this recommendation. What should you conclude?
Which code segment should you use?
You are writing a method to compress an array of bytes. The array is passed to the method in a parameter named document. You need to compress the incoming array of bytes and return the result as an array of bytes. Which code segment should you use?
Which code segment should you use?
You are creating a Windows Forms application that includes the database
helper methods UpdateOrder and UpdateAccount. Each method wraps code that connects to a Microsoft SQL Server 2005 database, executes a Transact-SQL statement, and then disconnects from the database. You must ensure that changes to the database that result from the UpdateAccount method are committed only if the UpdateOrder method succeeds. You need to execute the UpdateAccount method and the UpdateOrder method.
Which code segment should you use?