Programming in C#

QUESTION NO: 1

You are developing an application that includes a class named Order. The application will store a collection of Order objects.

The collection must meet the following requirements:

  • Use strongly typed members.

  • Process Order objects in first-in-first-out order.

  • Store values for each Order object.

  • Use zero-based indices.

You need to use a collection type that meets the requirements.

Which collection type should you use?

A. Queue<T>

B. SortedList

C. LinkedList<T>

D. HashTable

E. Array<T>

Answer: A

QUESTION NO: 2

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

QUESTION NO: 3

You are developing an application that includes the following code segment. (Line numbers are included for reference only.)

The GetAnimals() method must meet the following requirements:

  • Connect to a Microsoft SQL Server database.

  • Create Animal objects and populate them with data from the database.

  • Return a sequence of populated Animal objects.

You need to meet the requirements.

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Insert the following code segment at line 16:

while (sqlDataReader.NextResult())

B. Insert the following code segment at line 13:

sqlConnection.BeginTransaction();

C. Insert the following code segment at line 13:

sqlConnection.Open();

D. Insert the following code segment at line 16:

while (sqlDataReader.Read())

E. insert the following code segment at line 16:

while (sqlDataReader.GetValues())

Answer: C, D

QUESTION NO: 4 DRAG DROP

You are developing a custom collection named LoanCollection for a class named Loan class.

You need to ensure that you can process each Loan object in the LoanCollection collection by using a foreach loop.

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: <map><m x1="5" x2="509" y1="53" y2="80" ss="0" a="0" /><m x1="6" x2="510" y1="88" y2="111" ss="0" a="0" /><m x1="0" x2="511" y1="121" y2="147" ss="0" a="0" /><m x1="6" x2="510" y1="159" y2="182" ss="0" a="0" /><m x1="3" x2="511" y1="194" y2="213" ss="0" a="0" /><m x1="3" x2="511" y1="225" y2="249" ss="0" a="0" /><m x1="4" x2="511" y1="261" y2="280" ss="0" a="0" /><m x1="3" x2="513" y1="295" y2="316" ss="0" a="0" /><m x1="4" x2="512" y1="328" y2="350" ss="0" a="0" /><m x1="321" x2="829" y1="455" y2="480" ss="1" a="0" /><m x1="88" x2="598" y1="723" y2="752" ss="1" a="0" /><m x1="109" x2="621" y1="773" y2="803" ss="1" a="0" /><c start="1" stop="0" /><c start="3" stop="1" /><c start="8" stop="2" /></map>

QUESTION NO: 5

You are developing an application that uses the Microsoft ADO.NET Entity Framework to retrieve order information from a Microsoft SQL Server database. The application includes the following code. (Line numbers are included for reference only.)

The application must meet the following requirements:

  • Return only orders that have an OrderDate value other than null.

  • Return only orders that were placed in the year specified in the OrderDate property or in a later year.

You need to ensure that the application meets the requirements.

Which code segment should you insert at line 08?

A. Where order.OrderDate.Value != null && order.OrderDate.Value.Year > = year

B. Where order.OrderDate.Value = = null && order.OrderDate.Value.Year = = year

C. Where order.OrderDate.HasValue && order.OrderDate.Value.Year = = year

D. Where order.OrderDate.Value.Year = = year

Answer: A

*For the requirement to use an OrderDate value other than null use:

OrderDate.Value != null

*For the requirement to use an OrderDate value for this year or a later year use:

OrderDate.Value>= year

QUESTION NO: 6 DRAG DROP

You are developing an application by using C#. The application includes an array of decimal values named loanAmounts. You are developing a LINQ query to return the values from the array.

The query must return decimal values that are evenly divisible by two. The values must be sorted from the lowest value to the highest value.

You need to ensure that the query correctly returns the decimal values.

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: <map><m x1="2" x2="124" y1="57" y2="79" ss="0" a="0" /><m x1="2" x2="121" y1="90" y2="114" ss="0" a="0" /><m x1="3" x2="123" y1="126" y2="150" ss="0" a="0" /><m x1="3" x2="119" y1="159" y2="179" ss="0" a="0" /><m x1="4" x2="119" y1="191" y2="215" ss="0" a="0" /><m x1="4" x2="119" y1="225" y2="248" ss="0" a="0" /><m x1="4" x2="121" y1="261" y2="281" ss="0" a="0" /><m x1="0" x2="121" y1="296" y2="316" ss="0" a="0" /><m x1="153" x2="275" y1="135" y2="159" ss="1" a="0" /><m x1="154" x2="272" y1="170" y2="195" ss="1" a="0" /><m x1="359" x2="477" y1="198" y2="227" ss="1" a="0" /><m x1="156" x2="275" y1="201" y2="227" ss="1" a="0" /><m x1="153" x2="273" y1="234" y2="261" ss="1" a="0" /><c start="1" stop="0" /><c start="5" stop="1" /><c start="6" stop="3" /><c start="3" stop="2" /><c start="7" stop="4" /></map>

Box 1: from

Box 2: where

Box 3: orderby Box 4: ascending

Box 5: select

Note: In a query expression, the orderby clause causes the returned sequence or subsequence (group) to be sorted in either ascending or descending order.

Examples:

// Query for ascending sort.

IEnumerable< string > sortAscendingQuery =

from fruit in fruits

orderby fruit //"ascending" is default

select fruit;

// Query for descending sort.

IEnumerable< string > sortDescendingQuery =

from w in fruits

orderby w descending

select w;

QUESTION NO: 7

You are developing an application. The application includes a method named ReadFile that reads data from a file.

The ReadFile() method must meet the following requirements:

  • It must not make changes to the data file.

  • It must allow other processes to access the data file.

  • It must not throw an exception if the application attempts to open a data file that does not exist.

You need to implement the ReadFile() method.

Which code segment should you use?

untitled

A. Option A

B. Option B

C. Option C

D. Option D

E. Option E

Answer: B

QUESTION NO: 8

An application receives JSON data in the following format:

The application includes the following code segment. (Line numbers are included for reference only.)

You need to ensure that the ConvertToName() method returns the JSON input string as a Name object.

Which code segment should you insert at line 10?

A. Return ser.ConvertToType<Name>(json);

B. Return ser.DeserializeObject(json);

C. Return ser.Deserialize<Name>(json);

D. Return (Name)ser.Serialize(json);

Answer: C

QUESTION NO: 9 DRAG DROP

An application serializes and deserializes XML from streams. The XML streams are in the following format:

The application reads the XML streams by using a DataContractSerializer object that is declared by the following code segment:

var ser = new DataContractSerializer(typeof(Name));

You need to ensure that the application preserves the element ordering as provided in the XML stream.

How should you complete the relevant code? (To answer, drag the appropriate attributes to the correct locations in the answer area-Each attribute 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: <map><m x1="5" x2="634" y1="47" y2="74" ss="0" a="0" /><m x1="5" x2="631" y1="82" y2="106" ss="0" a="0" /><m x1="2" x2="630" y1="118" y2="139" ss="0" a="0" /><m x1="2" x2="630" y1="153" y2="174" ss="0" a="0" /><m x1="3" x2="632" y1="187" y2="207" ss="0" a="0" /><m x1="1" x2="632" y1="217" y2="242" ss="0" a="0" /><m x1="4" x2="634" y1="253" y2="277" ss="0" a="0" /><m x1="10" x2="688" y1="350" y2="373" ss="1" a="0" /><m x1="34" x2="701" y1="414" y2="438" ss="1" a="0" /><m x1="27" x2="702" y1="478" y2="504" ss="1" a="0" /><c start="0" stop="0" /><c start="1" stop="1" /><c start="2" stop="2" /></map>

QUESTION NO: 10

You are developing an application. The application converts a Location object to a string by using a method named WriteObject. The WriteObject() method accepts two parameters, a Location object and an XmlObjectSerializer object.

The application includes the following code. (Line numbers are included for reference only.)

You need to serialize the Location object as a JSON object.

Which code segment should you insert at line 20?

A. New DataContractSerializer(typeof(Location))

B. New XmlSerializer(typeof(Location))

C. New NetDataContractSenalizer()

D. New DataContractJsonSerializer(typeof(Location))

Answer: D

The DataContractJsonSerializer class serializes objects to the JavaScript Object Notation (JSON) and deserializes JSON data to objects.

Use the DataContractJsonSerializer class to serialize instances of a type into a JSON document and to deserialize a JSON document into an instance of a type.

QUESTION NO: 11

An application includes a class named Person. The Person class includes a method named GetData.

You need to ensure that the GetData() method can be used only by the Person class or a class derived from the Person class.

Which access modifier should you use for the GetData() method?

A. Internal

B. Protected

C. Private

D. Protected internal

E. Public

Answer: C

The GetData() method should be private. It would then only be visible within the Person class.

QUESTION NO: 12

You are developing an application by using C#. The application includes the following code segment. (Line numbers are included for reference only.)

The DoWork() method must not throw any exceptions when converting the obj object to the IDataContainer interface or when accessing the Data property.

You need to meet the requirements.

Which code segment should you insert at line 07?

A. var dataContainer = (IDataContainer)obj;

B. dynamic dataContainer = obj;

C. var dataContainer = obj is IDataContainer;

D. var dataContainer = obj as IDataContainer;

Answer: D

QUESTION NO: 13

You are creating an application that manages information about zoo animals. The application includes a class named Animal and a method named Save.

The Save() method must be strongly typed. It must allow only types inherited from the Animal class that uses a constructor that accepts no parameters.

You need to implement the Save() method.

Which code segment should you use?

A. Option A

B. Option B

C. Option C

D. Option D

Answer: C

QUESTION NO: 14 DRAG DROP

You are developing a class named ExtensionMethods

You need to ensure that the ExtensionMethods class implements the IsUrl() method on string objects.

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: <map><m x1="5" x2="418" y1="50" y2="70" ss="0" a="0" /><m x1="2" x2="417" y1="89" y2="109" ss="0" a="0" /><m x1="4" x2="419" y1="120" y2="139" ss="0" a="0" /><m x1="2" x2="416" y1="157" y2="176" ss="0" a="0" /><m x1="3" x2="417" y1="189" y2="211" ss="0" a="0" /><m x1="10" x2="426" y1="285" y2="311" ss="1" a="0" /><m x1="94" x2="514" y1="352" y2="379" ss="1" a="0" /><c start="0" stop="0" /><c start="2" stop="1" /></map>

QUESTION NO: 15

You are developing an application. The application includes classes named Employee and Person and an interface named IPerson.

The Employee class must meet the following requirements:

  • It must either inherit from the Person class or implement the IPerson interface.

  • It must be inheritable by other classes in the application.

You need to ensure that the Employee class meets the requirements.

Which two code segments can you use to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

A. Option A

B. Option B

C. Option C

D. Option D

Answer: B, D

QUESTION NO: 16

You are developing an application that will convert data into multiple output formats.

The application includes the following code. (Line numbers are included for reference only.)

You are developing a code segment that will produce tab-delimited output. All output routines implement the following interface:

You need to minimize the completion time of the GetOutput() method.

Which code segment should you insert at line 06?

A. Option A

B. Option B

C. Option C

D. Option D

Answer: B

QUESTION NO: 17

You are developing an application by using C#.

The application includes an object that performs a long running process.

You need to ensure that the garbage collector does not release the object's resources until the process completes.

Which garbage collector method should you use?

A. ReRegisterForFinalize()

B. SuppressFinalize()

C. Collect()

D. WaitForFullGCApproach()

Answer: B

QUESTION NO: 18

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: A, F

QUESTION NO: 19

You are implementing a method named Calculate that performs conversions between value types and reference types. The following code segment implements the method. (Line numbers are included for reference only.)

You need to ensure that the application does not throw exceptions on invalid conversions.

Which code segment should you insert at line 04?

A. int balance = (int) (float)amountRef;

B. int balance = (int)amountRef;

C. int balance = amountRef;

D. int balance = (int) (double) amountRef;

Answer: A

QUESTION NO: 20

You are creating a console application by using C#.

You need to access the application assembly.

Which code segment should you use?

A. Assembly.GetAssembly(this);

B. this.GetType();

C. Assembly.Load();

D. Assembly.GetExecutingAssembly();

Answer: D

QUESTION NO: 21 HOTSPOT

You are implementing a library method that accepts a character parameter and returns a string.

If the lookup succeeds, the method must return the corresponding string value. If the lookup fails, the method must return the value "invalid choice."

You need to implement the lookup algorithm.

How should you complete the relevant code? (To answer, select the correct keyword in each drop-down list in the answer area.)

Answer: <map><m x1="29" x2="81" y1="203" y2="219" ss="0" a="0" /><m x1="47" x2="90" y1="274" y2="292" ss="0" a="0" /><m x1="56" x2="99" y1="436" y2="455" ss="0" a="0" /><m x1="68" x2="124" y1="617" y2="639" ss="0" a="0" /></map>

QUESTION NO: 22

You use the Task.Run() method to launch a long-running data processing operation. The data processing operation often fails in times of heavy network congestion.

If the data processing operation fails, a second operation must clean up any results of the first operation.

You need to ensure that the second operation is invoked only if the data processing operation throws an unhandled exception.

What should you do?

A. Create a TaskCompletionSource<T> object and call the TrySetException() method of the object.

B. Create a task by calling the Task.ContinueWith() method.

C. Examine the Task.Status property immediately after the call to the Task.Run() method.

D. Create a task inside the existing Task.Run() method by using the AttachedToParent option.

Answer: B

QUESTION NO: 23

You are modifying an application that processes leases. The following code defines the Lease class. (Line numbers are included for reference only.)

Leases are restricted to a maximum term of 5 years. The application must send a notification message if a lease request exceeds 5 years.

You need to implement the notification mechanism.

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Option A

B. Option B

C. Option C

D. Option D

E. Option E

F. Option F

Answer: A, B

QUESTION NO: 24

You are developing an application that uses structured exception handling. The application includes a class named ExceptionLogger.

The ExceptionLogger class implements a method named LogException by using the following code segment:

public static void LogException(Exception ex)

You have the following requirements:

  • Log all exceptions by using the LogException() method of the ExceptionLogger class.

  • Rethrow the original exception, including the entire exception stack.

You need to meet the requirements.

Which code segment should you use?

A. Option A

B. Option B

C. Option C

D. Option D

Answer: A

QUESTION NO: 25

You are developing an application that includes a class named UserTracker. The application includes the following code segment. (Line numbers are included for reference only.)

You need to add a user to the UserTracker instance.

What should you do?

A. Option A

B. Option B

C. Option C

D. Option D

Answer: D

QUESTION NO: 26 DRAG DROP

You develop an application that displays information from log files when errors occur. The application will prompt the user to create an error report that sends details about the error and the session to the administrator.

When a user opens a log file by using the application, the application throws an exception and closes.

The application must preserve the original stack trace information when an exception occurs during this process.

You need to implement the method that reads the log files.

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: <map><m x1="3" x2="471" y1="47" y2="65" ss="0" a="0" /><m x1="2" x2="472" y1="80" y2="97" ss="0" a="0" /><m x1="5" x2="470" y1="104" y2="121" ss="0" a="0" /><m x1="5" x2="469" y1="132" y2="151" ss="0" a="0" /><m x1="15" x2="582" y1="240" y2="262" ss="1" a="0" /><m x1="101" x2="660" y1="531" y2="564" ss="1" a="0" /><c start="1" stop="0" /><c start="3" stop="1" /></map>

QUESTION NO: 27 DRAG DROP

You are developing an application that includes a class named Kiosk. The Kiosk class includes a static property named Catalog. The Kiosk class is defined by the following code segment. (Line numbers are included for reference only.)

You have the following requirements:

  • Initialize the _catalog field to a Catalog instance.

  • Initialize the _catalog field only once.

  • Ensure that the application code acquires a lock only when the _catalog object must be instantiated.

You need to meet the requirements.

Which three code segments should you insert in sequence at line 09? (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: <map><m x1="5" x2="463" y1="49" y2="78" ss="0" a="0" /><m x1="4" x2="464" y1="85" y2="136" ss="0" a="0" /><m x1="2" x2="464" y1="145" y2="171" ss="0" a="0" /><m x1="8" x2="466" y1="185" y2="234" ss="0" a="0" /><m x1="2" x2="468" y1="244" y2="271" ss="0" a="0" /><m x1="476" x2="956" y1="41" y2="98" ss="1" a="0" /><m x1="479" x2="955" y1="105" y2="164" ss="1" a="0" /><m x1="478" x2="952" y1="176" y2="239" ss="1" a="0" /><c start="1" stop="0" /><c start="2" stop="1" /><c start="0" stop="2" /></map>

Note:

* If the _catalog field is not instantiated (== null) then need to create a new instance (_catalog = new Catalog();

* If the _catalog field is instantiated (not null/!= null) then lock it.

QUESTION NO: 28 DRAG DROP

You are developing an application that will include a method named GetData. The GetData() method will retrieve several lines of data from a web service by using a System.IO.StreamReader object.

You have the following requirements:

  • The GetData() method must return a string value that contains the first line of the response from the web service.

  • The application must remain responsive while the GetData() method runs.

You need to implement the GetData() method.

How should you complete the relevant code? (To answer, drag the appropriate objects to the correct locations in the answer area. Each object 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: <map><m x1="3" x2="177" y1="54" y2="99" ss="0" a="0" /><m x1="7" x2="178" y1="108" y2="151" ss="0" a="0" /><m x1="5" x2="176" y1="160" y2="209" ss="0" a="0" /><m x1="4" x2="176" y1="214" y2="260" ss="0" a="0" /><m x1="4" x2="176" y1="267" y2="314" ss="0" a="0" /><m x1="6" x2="176" y1="321" y2="363" ss="0" a="0" /><m x1="4" x2="175" y1="374" y2="421" ss="0" a="0" /><m x1="285" x2="458" y1="76" y2="118" ss="1" a="0" /><m x1="719" x2="889" y1="176" y2="218" ss="1" a="0" /><m x1="379" x2="552" y1="174" y2="222" ss="1" a="0" /><c start="3" stop="0" /><c start="2" stop="2" /><c start="0" stop="1" /></map>

QUESTION NO: 29

You are adding a public method named UpdateScore to a public class named ScoreCard.

The code region that updates the score field must meet the following requirements:

  • It must be accessed by only one thread at a time.

  • It must not be vulnerable to a deadlock situation.

You need to implement the UpdateScore() method.

What should you do?

A. Option A

B. Option B

C. Option C

D. Option D

Answer: B

QUESTION NO: 30 DRAG DROP

You are developing an application that implements a set of custom exception types. You declare the custom exception types by using the following code segments:

The application includes a function named DoWork that throws .NET Framework exceptions and custom exceptions.

The application contains only the following logging methods:

The application must meet the following requirements:

  • When AdventureWorksValidationException exceptions are caught, log the information by using the static void Log (AdventureWorksValidationException ex) method.

  • When AdventureWorksDbException or other AdventureWorksException exceptions are caught, log the information by using the static void I oq( AdventureWorksException ex) method.

You need to meet the requirements.

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: <map><m x1="1" x2="401" y1="12" y2="36" ss="0" a="0" /><m x1="2" x2="400" y1="47" y2="69" ss="0" a="0" /><m x1="5" x2="405" y1="85" y2="104" ss="0" a="0" /><m x1="4" x2="398" y1="115" y2="138" ss="0" a="0" /><m x1="513" x2="964" y1="137" y2="167" ss="1" a="0" /><m x1="511" x2="964" y1="259" y2="283" ss="1" a="0" /><m x1="513" x2="958" y1="376" y2="407" ss="1" a="0" /><c start="0" stop="0" /><c start="1" stop="1" /><c start="2" stop="2" /></map>

QUESTION NO: 31

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

QUESTION NO: 32

You are developing an application by using C#.

You have the following requirements:

  • Support 32-bit and 64-bit system configurations.

  • Include pre-processor directives that are specific to the system configuration.

  • Deploy an application version that includes both system configurations to testers.

  • Ensure that stack traces include accurate line numbers.

You need to configure the project to avoid changing individual configuration settings every time you deploy the application to testers.

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. Update the platform target and conditional compilation symbols for each application configuration.

B. Create two application configurations based on the default Release configuration.

C. Optimize the application through address rebasing in the 64-bit configuration.

D. Create two application configurations based on the default Debug configuration.

Answer: B, D

QUESTION NO: 33

You are developing a method named CreateCounters that will create performance counters for an application.

The method includes the following code. (Line numbers are included for reference only.)

You need to ensure that Counter1 is available for use in Windows Performance Monitor (PerfMon).

Which code segment should you insert at line 16?

A. CounterType = PerformanccCounterType.RawBase

B. CounterType = PerformanceCounterType.AverageBase

C. CounterType = PerformanceCounterType.SampleBase

D. CounterType = PerformanceCounterType.CounterMultiBase

Answer: C

QUESTION NO: 34

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. HMACSHA256

B. RNGCryptoServiceProvider

C. DES

D. Aes

Answer: A

QUESTION NO: 35 DRAG DROP

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: <map><m x1="1" x2="280" y1="50" y2="75" ss="0" a="0" /><m x1="3" x2="281" y1="84" y2="110" ss="0" a="0" /><m x1="3" x2="277" y1="121" y2="144" ss="0" a="0" /><m x1="3" x2="276" y1="154" y2="180" ss="0" a="0" /><m x1="0" x2="277" y1="186" y2="213" ss="0" a="0" /><m x1="3" x2="278" y1="224" y2="245" ss="0" a="0" /><m x1="337" x2="614" y1="107" y2="130" ss="1" a="0" /><m x1="336" x2="616" y1="148" y2="176" ss="1" a="0" /><c start="2" stop="0" /><c start="4" stop="1" /></map>

QUESTION NO: 36

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: B, D

QUESTION NO: 37

You are debugging an application that calculates loan interest. The application includes the following code. (Line numbers are included for reference only.)

You need to ensure that the debugger breaks execution within the CalculateInterest() method when the loanAmount variable is less than or equal to zero in all builds of the application.

What should you do?

A. Insert the following code segment at line 03:

Trace.Assert(loanAmount > 0);

B. Insert the following code segment at line 03:

Debug.Assert(loanAmount > 0);

C. Insert the following code segment at line 05:

Debug.Write(loanAmount > 0);

D. Insert the following code segment at line 05:

Trace.Write(loanAmount > 0);

Answer: A

QUESTION NO: 38

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

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.

QUESTION NO: 39 DRAG DROP

You are developing an application by using C#. The application will process several objects per second.

You need to create a performance counter to analyze the object processing.

Which three actions should you perform in sequence? (To answer, move the appropriate actions from the list of actions to the answer area and arrange them in the correct order.)

Answer: <map><m x1="4" x2="395" y1="45" y2="103" ss="0" a="0" /><m x1="3" x2="392" y1="112" y2="169" ss="0" a="0" /><m x1="8" x2="392" y1="181" y2="238" ss="0" a="0" /><m x1="6" x2="392" y1="247" y2="290" ss="0" a="0" /><m x1="3" x2="388" y1="304" y2="393" ss="0" a="0" /><m x1="414" x2="848" y1="42" y2="144" ss="1" a="0" /><m x1="415" x2="853" y1="161" y2="275" ss="1" a="0" /><m x1="415" x2="845" y1="295" y2="390" ss="1" a="0" /><c start="4" stop="0" /><c start="0" stop="1" /><c start="2" stop="2" /></map>

Box 1: Create a CounterCreationDataCollection collection. Then create the counters as CounterCreationData object and set necessary properties.

Box 2: Add ConterCreationData to the collection by calling the Add() method of the collection

Box 3: Call the Create method of the PerformanceCounterCategory and pass the collection to the method

QUESTION NO: 40

You are developing an application by using C#. You provide a public key to the development team during development.

You need to specify that the assembly is not fully signed when it is built.

Which two assembly attributes should you include in the source code? (Each correct answer presents part of the solution. Choose two.)

A. AssemblyKeyNameAttribute

B. ObfuscateAssemblyAttribute

C. AssemblyDelaySignAttribute

D. AssemblyKeyFileAttribute

Answer: C, D

Site Search:

Close

Close
Download Free Demo of VCE
Exam Simulator

Experience Avanset VCE Exam Simulator for yourself.


Simply submit your e-mail address below to get started with our interactive software demo of your free trial.


Enter Your Email Address

Free Demo Limits: In the demo version you will be able to access only first 5 questions from exam.