You need to retrieve all of the numbers from the items variable that are greater than 80.

Which code should you use?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Correct Answer: A

QUESTION 104

DRAG DROP

You are creating a method that will split a single input file into two smaller output files.

The method must perform the following actions:

Create a file named header.dat that contains the first 20 bytes of the input file.

Create a file named body.dat that contains the remainder of the input file.

You need to create the method.

How should you complete the relevant code? (To answer, drag the appropriate code segments to the correct locations in the answer area. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)

Correct Answer:

QUESTION 105

DRAG DROP

You are adding a function to a membership tracking application- The function uses an integer named memberCode as an input parameter and returns the membership type as a string.

The function must meet the following requirements:

Return “Non-Member” if the memberCode is 0.

Return “Member” if the memberCode is 1.

Return “Invalid” if the memberCode is any value other than 0 or 1.

You need to implement the function to meet the requirements.

How should you complete the relevant code? (To answer, drag the appropriate statements to the correct locations in the answer area. Each statement may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)

Correct Answer:

QUESTION 106

HOTSPOT

You are developing the following classes named:

Class1

Class2

Class3

All of the classes will be part of a single assembly named Assembly.dll. Assembly.dll will be used by multiple applications.

All of the classes will implement the following interface, which is also part ofAssembly.dll:

public interface Interface1

{

void Method1(decimal amount);

void Method2(decimal amount);

}

You need to ensure that the Method2 method for the Class3 class can be executed only when instances of the class are accessed through the Interface1 interface. The solution must ensure that calls to the Method1 method can be made either through the interface or through an instance of the class.

Which signature should you use for each method? (To answer, select the appropriate signature for each method in the answer area.)

Correct Answer:

QUESTION 107

You are implementing a method named ProcessReports that performs a long-running task. The ProcessReports() method has the following method signature:

If the calling code requests cancellation, the method must perform the following actions:

Cancel the long-running task.

Set the task status to TaskStatus.Canceled.

You need to ensure that the ProcessReports() method performs the required actions. Which code segment should you use in the method body?

A.

if (ct.IsCancellationRequested)

return;

B.

ct.ThrowIfCancellationRequested() ;

C.

cts.Cancel();

D.

throw new AggregateException();

Correct Answer: B

QUESTION 108

You are developing an application that will be deployed to multiple computers. You set the assembly name. You need to create a unique identity for the application assembly. Which two assembly identity attributes should you include in the source code? (Each correct answer presents part of the solution. Choose two.)

A.

AssemblyTitleAttribute

B.

AssemblyCultureAttribute

C.

AssemblyVersionAttribute

D.

AssemblyKeyNameAttribute

E.

AssemblyFileVersion

Correct Answer: BC

Explanation:

The AssemblyName object contains information about an assembly, which you can use to bind to that assembly. An assembly’s identity consists of the following:

Simple name.

Version number.

Cryptographic key pair.

Supported culture.

B: AssemblyCultureAttribute

Specifies which culture the assembly supports.

The attribute is used by compilers to distinguish between a main assembly and a satellite assembly. A main assembly contains code and the neutral culture’s resources. A satellite assembly contains only resources for a particular culture, as in [assembly:AssemblyCultureAttribute(“de”)]

C: AssemblyVersionAttribute

Specifies the version of the assembly being attributed. The assembly version number is part of an assembly’s identity and plays a key part in binding to the assembly and in version policy.

QUESTION 109

You are developing an application. You need to declare a delegate for a method that accepts an integer as a parameter, and then returns an integer. Which type of delegate should you use?

A.

Action<int>

B.

Action<int,int>

C.

Func<int, int>

D.

Func<int>

Correct Answer: C

QUESTION 110

You are writing the following method (line numbers are included for reference only):