Question 246
Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You have the following C# code. (Line numbers are included for reference only.)
You need the foreach loop to display a running total of the array elements, as shown in the following output.
1
3
6
10
15
Solution: You insert the following code at line 02:
Does this meet the goal?
Question 247
You are developing an application by using C#. The application includes a method named SendMessage. The SendMessage() method requires a string input.
You need to replace "Hello" with "Goodbye" in the parameter that is passed to the SendMessage() method.
Which two code segments can you use to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
Question 248
You are developing a class named EmployeeRoster. The following code implements the EmployeeRoster class. (Line numbers are included for reference only.)
You create the following unit test method to test the EmployeeRoster class implementation:
You need to ensure that the unit test will pass.
What should you do?
Question 249
You are developing an application by using C#. The application includes a method named SendMessage. The SendMessage() method requires a string input.
You need to replace "Hello" with "Goodbye" in the parameter that is passed to the SendMessage() method.
Which two code segments can you use to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
Question 250
You are testing an application. The application includes methods named CalculateInterest and LogLine.
The CalculateInterest()method calculates loan interest. The LogLine()method sends diagnostic messages to a console window.
The following code implements the methods. (Line numbers are included for reference only.)
You have the following requirements:
The Calculatelnterest()method must run for all build configurations.
The LogLine()method must run only for debug builds.
You need to ensure that the methods run correctly.
What are two possible ways to achieve this goal? (Each correct answer presents a complete solution.
Choose two.)
