Q1. - (Topic 1)
You are developing an assembly that will be used by multiple applications.
You need to install the assembly in the Global Assembly Cache (GAC).
Which two actions can you perform to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
A. Use the Assembly Registration tool (regasm.exe) to register the assembly and to copy the assembly to the GAC.
B. Use the Strong Name tool (sn.exe) to copy the assembly into the GAC.
C. Use Microsoft Register Server (regsvr32.exe) to add the assembly to the GAC.
D. Use the Global Assembly Cache tool (gacutil.exe) to add the assembly to the GAC.
E. Use Windows Installer 2.0 to add the assembly to the GAC.
Answer: D,E
Explanation:
There are two ways to deploy an assembly into the global assembly cache:
Use an installer designed to work with the global assembly cache. This is the preferred option for installing assemblies into the global assembly cache.
Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the
Windows
Software Development Kit (SDK).
Note:
In deployment scenarios, use Windows Installer 2.0 to install assemblies into the global assembly cache. Use the Global Assembly Cache tool only in development scenarios, because it does not provide assembly reference counting and other features provided when using the Windows Installer.
http://msdn.microsoft.com/en-us/library/yf1d93sz%28v=vs.110%29.aspx
Q2. - (Topic 2)
You are developing a method named GenerateHash that will create the hash value for a file. The method includes the following code. (Line numbers are included for reference only.)
You need to return the cryptographic hash of the bytes contained in the fileBuffer variable. Which code segment should you insert at line 05?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: D
Q3. DRAG DROP - (Topic 1)
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.
You have the following requirements:
. The CalculateInterest() method must run for all build configurations.
. The LogLine() method must be called only for debug builds.
You need to ensure that the methods run correctly.
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.)
Answer:
Q4. HOTSPOT - (Topic 1)
You are developing an application that includes a Windows Communication Foundation (WCF) service. The service includes a custom TraceSource object named ts and a method named DoWork. The application must meet the following requirements:
. Collect trace information when the DoWork() method executes. . Group all traces for a single execution of the DoWork() method as an activity that can be viewed in the WCF Service Trace Viewer Tool.
You need to ensure that the application meets the requirements.
How should you complete the relevant code? (To answer, select the correct code segment from each drop-down list in the answer area.)
Answer:
Q5. - (Topic 1)
You are creating a class named Employee. The class exposes a string property named EmployeeType. The following code segment defines the Employee class. (Line numbers are included for reference only.)
The EmployeeType property value must be accessed and modified only by code within the Employee class or within a class derived from the Employee class.
You need to ensure that the implementation of the EmployeeType property meets the requirements.
Which two actions should you perform? (Each correct answer represents part of the complete solution. Choose two.)
A. Replace line 05 with the following code segment: protected get;
B. Replace line 06 with the following code segment: private set;
C. Replace line 03 with the following code segment: public string EmployeeType
D. Replace line 05 with the following code segment: private get;
E. Replace line 03 with the following code segment: protected string EmployeeType
F. Replace line 06 with the following code segment: protected set;
Answer: B,E
Q6. - (Topic 1)
You are developing an application that accepts the input of dates from the user.
Users enter the date in their local format. The date entered by the user is stored in a string variable named inputDate. The valid date value must be placed in a DateTime variable named validatedDate.
You need to validate the entered date and convert it to Coordinated Universal Time (UTC). The code must not cause an exception to be thrown.
Which code segment should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: A
Explanation:
AdjustToUniversal parses s and, if necessary, converts it to UTC. Note: The DateTime.TryParse method converts the specified string representation of a date and time to its DateTime equivalent using the specified culture-specific format information and formatting style, and returns a value that indicates whether the conversion succeeded.
Q7. - (Topic 1)
You are developing an application that includes a class named BookTracker for tracking library books. The application includes the following code segment. (Line numbers are included for reference only.)
You need to add a user to the BookTracker instance. What should you do? A. Option A
B. Option B
C. Option C
D. Option D
Answer: B
Q8. 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:
Q9. - (Topic 2)
You are troubleshooting an application that uses a class named FullName. The class is decorated with the DataContractAttribute attribute. The application includes the following code. (Line numbers are included for reference only.)
You need to ensure that the entire FullName object is serialized to the memory stream object.
Which code segment should you insert at line 09?
A. binary.WriteEndDocument();
B. binary.WriteEndDocumentAsync();
C. binary.WriteEndElementAsync();
D. binary.Flush();
Answer: A
Explanation: * DataContractSerializer.WriteEndObject Method (XmlDictionaryWriter) Writes the closing XML element using an XmlDictionaryWriter.
* Note on line 07: DataContractSerializer.WriteObject Method Writes all the object data (starting XML element, content, and closing element) to an XML document or stream.
XmlDictionaryWriter
Q10. - (Topic 2)
You are creating an application that processes a list of numbers.
The application must define a method that queries the list and displays a subset of the
numbers to the user. The method must not update the list.
You need to create an extendable query by using LINQ.
What should you do?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: C