Question 6 of 219

You are authoring unit tests.

The unit tests must test code that consumes sealed classes.

You need to create, maintain, and inject dependencies in the unit tests.

Which isolation method should you use?

    Correct Answer: C

    Shim types are used in unit testing to isolate the code under test by diverting calls to specific methods to code that is defined in the test itself. This allows for consistent control over test conditions and returns predictable results irrespective of external factors, making it easier to test code that interacts with sealed classes, which cannot be inherited from and therefore cannot be stubbed easily.

Question 7 of 219

You are developing an ASP.NET MVC web application that includes the following method.

You need to test the AccountBalance method.

Which unit test should you use?

    Correct Answer: C

    The correct unit test should use the [TestMethod] attribute, which is essential for marking the method as a test method in the test framework. The Assert.AreEqual method should be used to verify that the expected value (finalBalance) and the actual result of the method call (result) are equal. Option C correctly uses the [TestMethod] attribute and Assert.AreEqual to compare the expected and actual values.

Question 8 of 219

You are developing an ASP.NET MVC application by using Visual Studio 2012.

The application throws and handles exceptions when it runs.

You need to examine the state of the application when exceptions are thrown.

What should you do?

    Correct Answer: A

    A

    Configuring the debugger to break for first chance exceptions

    To change when the debugger breaks, go to Debug->Exceptions"¦

    When you first open this window you will see that there is a tree grid with one column and checkboxes.

    ✑ Break when Thrown. This includes a default list of exceptions known by the debugger, grouped by category.

    Note: The possible exceptions that could break from this list is determined by the runtime you are debugging. For example, if you are using managed-only debugging then the debugger will never break for C++, Win32 Exceptions, etc. even if they are configured to break when thrown.

    ✑ Checkboxes. If you check the box for a category, then the debugger will break for all First Chance Exceptions while debugging. If you don't want to enable all

    First Chance Exceptions, you can find the specific exception types that you wish to configure by using the search box.

    Reference: Understanding Exceptions while debugging with Visual Studio http://blogs.msdn.com/b/visualstudioalm/archive/2015/01/08/understanding-exceptions-while-debugging-with-visual-studio.aspx

Question 9 of 219

You are developing an ASP.NET MVC news aggregation application that will be deployed to servers on multiple networks.

The application must be compatible with multiple browsers. A user can search the website for news articles. You must track the page number that the user is viewing in search results.

You need to program the location for storing state information about the user's search.

What should you do?

    Correct Answer: C

    Using QueryString to store search terms and page index is the best approach because it allows the state information to be maintained across multiple browser sessions and different server networks. It also ensures compatibility with various browsers since the information is passed within the URL. This approach makes the application stateless on the server side, which is particularly useful in a load-balanced environment.

Question 10 of 219

You are developing an ASP.NET MVC application. The application is deployed in a web farm and is accessed by many users.

The application must handle web server failures gracefully. The servers in the farm must share the state information.

You need to persist the application state during the session.

What should you implement?

    Correct Answer: A

    To handle web server failures gracefully and ensure servers in a web farm share state information, you should implement a state server for session state management. A state server allows session data to be stored out-of-process, on a separate server, which means session data is not lost if a web server fails, and it can be shared across multiple web servers. Options like InProc sessions are unsuitable for web farm environments because session data is stored in the memory of an individual web server, risking data loss and inconsistency among different servers. Cookieless sessions and web gardens do not provide mechanisms to share session state consistently across multiple servers in a web farm.