Q121. - (Topic 2) 

You need to create a method that can be called by using a varying number of parameters. 

What should you use? 

A. Method overloading 

B. Interface 

C. Named parameters 

D. Lambda expressions 

Answer:

Explanation: 

Member overloading means creating two or more members on the same type that differ only in the number or type of parameters but have the same name. Overloading is one of the most important techniques for improving usability, productivity, and readability of reusable libraries. Overloading on the number of parameters makes it possible to provide simpler versions of constructors and methods. Overloading on the parameter type makes it possible to use the same member name for members performing identical operations on a selected set of different types. 


Q122. - (Topic 2) 

You are developing a game that allows players to collect from 0 through 1000 coins. You are creating a method that will be used in the game. The method includes the following code. (Line numbers are included for reference only.) 

01 public string FormatCoins(string name, int coins) 

02 { 

04 } 

The method must meet the following requirements: 

Return a string that includes the player name and the number of coins. Display the number of coins without leading zeros if the number is 1 or greater. Display the number of coins as a single 0 if the number is 0. 

You need to ensure that the method meets the requirements. 

Which code segment should you insert at line 03? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:


Q123. - (Topic 2) 

You need to write a console application that meets the following requirements: 

. If the application is compiled in Debug mode, the console output must display Entering debug mode. . If the application is compiled in Release mode, the console output must display Entering release mode. 

Which code should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: Programmatically detecting Release/Debug mode (.NET) 

Boolean isDebugMode = false; 

#if DEBUG 

isDebugMode = true; 

#endif 

Reference: http://stackoverflow.com/questions/654450/programmatically-detecting-release-debug-mode-net 


Q124. - (Topic 2) 

You have the following class (line numbers are included for reference only): 

ServiceProxy is a proxy for a web service. Calls to the Update method can take up to five seconds. The Test class is the only class the uses Class1. 

You run the Execute method three times, and you receive the following results: 312 231 

You need to ensure that each value is appended to the Value property in the order that the Modify methods are invoked. 

What should you do? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:


Q125. - (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:

Explanation: Enumerable.Where<TSource> Method (IEnumerable<TSource>, 

Func<TSource, Boolean>) 

Filters a sequence of values based on a predicate. 

Example: 

List<string> fruits = 

new List<string> { "apple", "passionfruit", "banana", "mango", 

"orange", "blueberry", "grape", "strawberry" }; 

IEnumerable<string> query = fruits.Where(fruit => fruit.Length < 6); 

foreach (string fruit in query) 

Console.WriteLine(fruit); 

/* 

This code produces the following output: 

apple 

mango 

grape */ 


Q126. HOTSPOT - (Topic 1) 

You are developing an application in C#. 

The application will display the temperature and the time at which the temperature was recorded. You have the following method (line numbers are included for reference only): 

You need to ensure that the message displayed in the lblMessage object shows the time formatted according to the following requirements: 

The time must be formatted as hour:minute AM/PM, for example 2:00 PM. 

The date must be formatted as month/day/year, for example 04/21/2013. 

The temperature must be formatted to have two decimal places, for example 23-

45. 

Which code should you insert at line 04? (To answer, select the appropriate options in the answer area.) 

Answer: 


Q127. - (Topic 2) 

You are debugging a 64-bit C# application. 

Users report System.OutOfMemoryException exceptions. The system is attempting to use arrays larger than 2 GB in size. 

You need to ensure that the application can use arrays larger than 2 GB. 

What should you do? 

A. Add the /3GB switch to the boot.ini file for the operating system. 

B. Set the IMAGE_FILE_LARGE_ADDRESS_AWARE flag in the image header for the application executable file. 

C. Set the value of the gcAllowVeryLargeObjects property to true in the application configuration file. 

D. Set the value of the user-mode virtual address space setting for the operating system to MAX. 

Answer:


Q128. - (Topic 2) 

You are implementing a method named GetValidEmailAddresses. The GetValidEmailAddresses() method processes a list of string values that represent email addresses. 

The GetValidEmailAddresses() method must return only email addresses that are in a valid format. 

You need to implement the GetValidEmailAddresses() method. 

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 

Explanation: Note: 

* List<T>.Add Method 

Adds an object to the end of the List<T>. 


Q129. - (Topic 1) 

You are creating a console application named App1. 

App1 retrieves data from the Internet by using JavaScript Object Notation (JSON). 

You are developing the following code segment (line numbers are included for reference only): 

You need to ensure that the code validates the JSON string. 

Which code should you insert at line 03? 

A. DataContractSerializer serializer = new DataContractSerializer(); 

B. var serializer = new DataContractSerializer(); 

C. XmlSerlalizer serializer = new XmlSerlalizer(); 

D. var serializer = new JavaScriptSerializer(); 

Answer:

Explanation: The JavaScriptSerializer Class Provides serialization and deserialization functionality for AJAX-enabled applications. 

The JavaScriptSerializer class is used internally by the asynchronous communication layer to serialize and deserialize the data that is passed between the browser and the Web server. You cannot access that instance of the serializer. However, this class exposes a public API. Therefore, you can use the class when you want to work with JavaScript Object Notation (JSON) in managed code. 


Q130. - (Topic 2) 

You are developing a class named Account that will be used by several applications. The applications that will consume the Account class will make asynchronous calls to the Account class to execute several different methods. 

You need to ensure that only one call to the methods is executed at a time. 

Which keyword should you use? 

A. sealed 

B. protected 

C. checked 

D. lock 

Answer: