Q1. - (Topic 2)
You have the following code:
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
Answer: A
Q2. - (Topic 2)
You are developing an application.
The application contains the following code segment (line numbers are included for reference only):
When you run the code, you receive the following error message: "Cannot implicitly convert type 'object'' to 'int'. An explicit conversion exists (are you missing a cast?)."
You need to ensure that the code can be compiled.
Which code should you use to replace line 05?
A. var2 = arrayl[0] is int;
B. var2 = ((List<int>)arrayl) [0];
C. var2 = arrayl[0].Equals(typeof(int));
D. var2 = (int) arrayl [0];
Answer: D
Q3. - (Topic 1)
You are developing a C# application that has a requirement to validate some string input data by using the Regex class.
The application includes a method named ContainsHyperlink. The ContainsHyperlink() method will verify the presence of a URI and surrounding markup.
The following code segment defines the ContainsHyperlink() method. (Line numbers are included for reference only.)
The expression patterns used for each validation function are constant.
You need to ensure that the expression syntax is evaluated only once when the Regex
object is initially instantiated.
Which code segment should you insert at line 04?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: D
Explanation:
RegexOptions.Compiled - Specifies that the regular expression is compiled to an assembly.This yields faster execution but increases startup time.This value should not be assigned to the Options property when calling the CompileToAssembly method. http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regexoptions.aspx Additional info http://stackoverflow.com/questions/513412/how-does-regexoptions-compiled-work
Q4. - (Topic 2)
You have the following code: 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
Answer: A
Q5. - (Topic 2)
You are developing an application that produces an executable named MyApp.exe and an assembly named MyApp.dll.
The application will be sold to several customers.
You need to ensure that enough debugging information is available for MyApp.exe, so that if the application throws an error in a customer's environment, you can debug the error in your own development environment.
What should you do?
A. Digitally sign MyApp.dll.
B. Produce program database (PDB) information when you compile the code.
C. Compile MyApp.exe by using the /unsafe compiler option.
D. Initializes a new instance of the AssemblyDelaySignAttribute class in the MyApp.dll constructor.
Answer: B
Q6. - (Topic 1)
You are developing an application that will transmit large amounts of data between a client computer and a server. You need to ensure the validity of the data by using a cryptographic hashing algorithm. Which algorithm should you use?
A. ECDsa
B. RNGCryptoServiceProvider
C. Rfc2898DeriveBytes
D. HMACSHA512
Answer: D
Q7. - (Topic 2)
You are developing an application that uses several objects. The application includes the following code segment. (Line numbers are included for reference only.)
You need to evaluate whether an object is null. Which code segment should you insert at line 03?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: B
Explanation: Use the == operator to compare values and in this case also use the null literal.
Q8. - (Topic 1)
You are developing an application that uses a .config file.
The relevant portion of the .config file is shown as follows:
You need to ensure that diagnostic data for the application writes to the event tog by using the configuration specified in the .config file.
What should you include in the application code?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: D
Q9. DRAG DROP - (Topic 1)
You are developing a class named Temperature.
You need to ensure that collections of Temperature objects are sortable.
How should you complete the relevant code segment? (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.)
Answer:
Q10. - (Topic 1)
An application will upload data by using HTML form-based encoding. The application uses a method named SendMessage.
The SendMessage() method includes the following code. (Line numbers are included for reference only.)
The receiving URL accepts parameters as form-encoded values.
You need to send the values intA and intB as form-encoded values named a and b,
respectively.
Which code segment should you insert at line 04?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: D
Explanation:
WebClient.UploadValuesTaskAsync - Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object. These methods do not block the calling thread. http://msdn.microsoft.com/en-us/library/system.net.webclient.uploadvaluestaskasync.aspx
Q11. - (Topic 1)
You are developing an application. The application calls a method that returns an array of integers named employeeIds. You define an integer variable named employeeIdToRemove and assign a value to it. You declare an array named filteredEmployeeIds.
You have the following requirements:
Remove duplicate integers from the employeeIds array.
Sort the array in order from the highest value to the lowest value.
Remove the integer value stored in the employeeIdToRemove variable from the
employeeIds array.
You need to create a LINQ query to meet the requirements.
Which code segment should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: C
Q12. - (Topic 2)
You are creating an application that reads from a database.
You need to use different databases during the development phase and the testing phase by using conditional compilation techniques.
What should you do?
A. Configure the Define TRACE constant setting in Microsoft Visual Studio.
B. Specify the /define compiler option.
C. Run the Assembly Linker tool from the Windows Software Development Kit (Windows SDK).
D. Decorate the code by using the [assembly:AssemblyDelaySignAttribute(true)] attribute.
Answer: B
Explanation: You can specify the compiler settings for your application in several ways:
* The property pages
* The command line
* #CONST (for Visual Basic) and #define (for C#)
Note: You can have either the Trace or Debug conditional attribute turned on for a build, or both, or neither. Thus, there are four types of build: Debug, Trace, both, or neither. Some release builds for production deployment might contain neither; most debugging builds contain both.
Reference: How to: Compile Conditionally with Trace and Debug
https://msdn.microsoft.com/en-us/library/64yxa344(v=vs.110).aspx
Q13. DRAG DROP - (Topic 2)
You are developing an application that will write string values to a file. The application includes the following code segment. (Line numbers are included for reference only.)
01 protected void ProcessFile(string fileName, string value) 02 {
04 }
You need to ensure that the ProcessFile() method will write string values to a file.
Which four code segments should you insert in sequence at line 03? (To answer, move the appropriate code segments from the list of code segments to the answer area and arrange them in the correct order.)
Answer:
Q14. HOTSPOT - (Topic 1)
You have the following code: To answer, complete each statement according to the information presented in the code.
Answer:
Q15. HOTSPOT - (Topic 2)
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.)
Answer: