EnsurepassQUESTION   1 You are creating a new file to store some log data. Each time a new log entry is necessary, you write a string to the file. Which method do you use?   A. File.CreateText B. FileInfo.Create C. File.Create D. File.AppendText   Correct Answer: D     QUESTION   2 You have built a complex calculation algorithm. It takes quite some time to complete and you want to make sure that your application remains responsive. What do you do? Read more [...]
EnsurepassQUESTION   1 A user needs to enter a DateTime in a text field. You need to parse the value in code. Which method do you use?   A. DateTime.Parse B. DateTime.TryParse C. Convert.ToDateTime D. Regex.Match.   Correct Answer: B     QUESTION   2 You are working on a globalized web application. You need to parse a text field where the user enters an amount of money. Which method do you use?   A. int.TryParse(value, NumberStyles.Currency, UICulture); Read more [...]
EnsurepassQUESTION   11 You want to create a type that can be easily sorted. Which interface should you implement?   A. IEnumerable B. IComparable C. IDisposable D. IUnknown   Correct Answer: B     QUESTION   12 You want to inherit from an existing class and add some behavior to a method. Which steps do you have to take? (Choose all that apply.)   A. Use the abstract keyword on the base type. B. Use the virtual keyword on the base method. C. Read more [...]
EnsurepassQUESTION   1 You are creating a new collection type and you want to make sure the elements in it can be easily accessed. What should you add to the type?   A. Constructor B. Indexer property C. Generic type parameter D. Static property   Correct Answer: B     QUESTION   2 You are creating a generic class that should work only with reference types. Which type constraint should you add?   A. where T : class B. where T : struct C. where Read more [...]
EnsurepassQUESTION   1 You have a lot of items that need to be processed. For each item, you need to perform a complex calculation. Which technique should you use?   A. You create a Task for each item and then wait until all tasks are finished. B. You use Parallel.For to process all items concurrently. C. You use async/await to process all items concurrently. D. You add all items to a BlockingCollection and process them on a thread created by the Thread class.   Correct Read more [...]
Ensurepass QUESTION 51 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.) Select and Place: Correct Answer: Read more [...]
Ensurepass QUESTION 41 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 XML. Which code segment should you insert at line 20? A. New XmlSerializer(typeof(Location)) B. New Read more [...]
Ensurepass QUESTION 31 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 Correct Answer: B QUESTION 32 You are creating a console application by using C#. You need to access the assembly found in the file Read more [...]
Ensurepass QUESTION 21 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 Correct Answer: B QUESTION 22 You are developing a C# application that Read more [...]
Ensurepass QUESTION 11 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 Read more [...]
EnsurepassQUESTION 1 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> Correct Answer: A QUESTION 2 You are developing Read more [...]