Microsoft Developing ASP.NET MVC 4 Web Applications - 070-486 Exam Practice Test
You are developing an ASP.NET Core Web API.
API methods must use JSON Web Tokens (JWT) to authenticate the method caller.
You need to implement JWT authentication.
How should you complete the code? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.

API methods must use JSON Web Tokens (JWT) to authenticate the method caller.
You need to implement JWT authentication.
How should you complete the code? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.

Correct Answer:

You develop an ASP.NET MVC application. You are creating a new layout page by using the Razor view engine.
The layout page has the following requirements:

You need to implement the layout page.
How should you complete the relevant Razor markup? To answer, select the appropriate Razor markup from each list in the answer area.

The layout page has the following requirements:

You need to implement the layout page.
How should you complete the relevant Razor markup? To answer, select the appropriate Razor markup from each list in the answer area.

Correct Answer:

Explanation:
Box 1: @Styles.Render("~/Content/css")
- Render a StyleBundle named ~/Content/css.
@Styles.Render("~/Content/css") is calling the files included in that particular bundle which is declared inside the BundleConfig class in the App_Start folder.
Box 2: @RenderSection("featured", true)
- Render the content of a section named featured just above the body of the page.
RenderSection renders only a part child view that is wrapped under named section.
RenderSection() method includes boolean parameter "required" which makes the section optional or mandatory. If required parameter is true then the child view must contain the section.
Box 3: @RenderSection("scripts", false)
- Render the content of a section named scripts at the bottom of the layout page.
References:
http://stackoverflow.com/questions/12028401/styles-render-in-mvc4
http://www.tutorialsteacher.com/articles/difference-between-renderbody-and-rendersection-mvc
You need to implement the business requirements for managing customer data.
What should you do? (Each correct answer presents part of the solution. Choose all that apply.)
What should you do? (Each correct answer presents part of the solution. Choose all that apply.)
Correct Answer: A,C
You are developing an ASP.NET MVC application by using Microsoft Visual Studio Professional. You plan to deploy the app to a Microsoft Azure App Services Web App.
You must be able to edit files in the webjpplication directly without having to redeploy or use other means of connecting to the web application.
You need to update the Web.config file to enable remote error messages.
What should you do?
You must be able to edit files in the webjpplication directly without having to redeploy or use other means of connecting to the web application.
You need to update the Web.config file to enable remote error messages.
What should you do?
Correct Answer: C
You need to enable client-side validation for an ASP.NET MVC application.
Which three actions should you perform? Each correct answer presents part of the solution.
Which three actions should you perform? Each correct answer presents part of the solution.
Correct Answer: B,D,E
Explanation: Only visible for ExamsLabs members. You can sign-up / login (it's free).
You are developing an ASP.NET Core MVC API microservice that calculates and provides loan rates. The microservice is configured to listen on port 6000.
The microservice must be deployed to a Docker container in Windows. You add a file named Dockerfile to the microservice project.
You need to build the Docker image.
In which order should you perform the actions? To answer, move all actions from the list of actions to the answer area and arrange them in the correct order.

The microservice must be deployed to a Docker container in Windows. You add a file named Dockerfile to the microservice project.
You need to build the Docker image.
In which order should you perform the actions? To answer, move all actions from the list of actions to the answer area and arrange them in the correct order.

Correct Answer:

1 - Use the FROM instruction to define the base image.
2 - Use the WORKDIR instruction to define the working directory.
3 - Use the COPY instruction to copy the source code into the image and then use the RUN instruction to restore NuGet packages.
4 - Use the ENTRYPOINT instruction to use the container as an executable.
5 - Use the EXPOSE instruction to specify the listen port and build and run the application.
Explanation:
Step 1: Use the FROM instruction to define the base image.
FROM creates a layer from the ubuntu Docker image.
The first FROM command is an important Docker command, allowing you to pull dependencies from other images.
Step 2: Use the WORKDIR instruction to define the working directory
The WORKDIR instruction sets the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD instructions that follow it in the Dockerfile.
Step 3: Use the COPY instructions to copy the source code into the image and then use the RUN instruction to restore NuGet packages.
Step 4: Use the ENTRYPOINT instruction to use the container as an executable Step 5: Use the EXPOSE instruction to specify the listen port and build and run the application.
References:
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
You are developing an ASP.NET MVC application. The application has a view that displays a list of orders in a multi-select list box.
You need to enable users to select multiple orders and submit them for processing.
What should you do? (To answer, drag the appropriate words to the correct targets. Each word 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.)

You need to enable users to select multiple orders and submit them for processing.
What should you do? (To answer, drag the appropriate words to the correct targets. Each word 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.)

Correct Answer:

You need to implement client-side animations according to the business requirements.
Which line of code should you use? (Each correct answer presents a complete solution. Choose all that apply.)
Which line of code should you use? (Each correct answer presents a complete solution. Choose all that apply.)
Correct Answer: A,B
Explanation: Only visible for ExamsLabs members. You can sign-up / login (it's free).
Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some questions sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You are developing a collaborative text editor. Multiple users may simultaneously edit the same document from within the application.
You need to ensure that users can see edits from all users as soon as they are made.
Solution: Implement the application by using ASP.NET Core. Configure the editor Controller action to return JSON data. Use XML HTTP requests for communicating editor changes.
Does the solution meet the goal?
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You are developing a collaborative text editor. Multiple users may simultaneously edit the same document from within the application.
You need to ensure that users can see edits from all users as soon as they are made.
Solution: Implement the application by using ASP.NET Core. Configure the editor Controller action to return JSON data. Use XML HTTP requests for communicating editor changes.
Does the solution meet the goal?
Correct Answer: B
You are developing an ASP.NET MVC application that takes customer orders.
Orders are restricted to customers with IP addresses based in the United States.
You need to implement a custom route handler.
You have the following code:

Which code segments should you include in Target1, Target 2 and Target 3 to implement the route handler? To answer, drag the appropriate code segments to the correct targets. 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.
NOTE: Each correct selection is worth one point.

Orders are restricted to customers with IP addresses based in the United States.
You need to implement a custom route handler.
You have the following code:

Which code segments should you include in Target1, Target 2 and Target 3 to implement the route handler? To answer, drag the appropriate code segments to the correct targets. 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.
NOTE: Each correct selection is worth one point.

Correct Answer:

Explanation:
Example:
This class implements IRouteHandler and has only one method "GetHttpHandler". The main purpose of this class is to return the instance of CustomHandler class. In the constructor, we are passing the RequestContext to the handler.
{
public class CustomRouteHandler : IRouteHandler
{
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
return new CustomHandler(requestContext);
}
}
References: http://msdn.microsoft.com/en-us/library/system.web.routing.iroutehandler.gethttphandler.aspx
You are developing an ASP.NET MVC application that has pages for users who browse the site with Windows Phone 7.
The pages for Windows Phone 7 include the following files:

You need to update the application so that it renders the customized files correctly to Windows Phone 7 users.
You have the following code:

How should you update the Application_Start method? (To answer, select the appropriate option from the drop-down list in the answer area.)


The pages for Windows Phone 7 include the following files:

You need to update the application so that it renders the customized files correctly to Windows Phone 7 users.
You have the following code:

How should you update the Application_Start method? (To answer, select the appropriate option from the drop-down list in the answer area.)


Correct Answer:

You are troubleshooting an ASP.NET MVC application that implements ASP.NET SignalR.
You need to identify the fallback transport mechanism order that ASP.NET SignalR will use.
In which order does SignalR attempt to use the transports? To answer, move all actions from the list of actions to the answer area and arrange them in the correct order.
NOTE: Each correct selection is worth one point.

You need to identify the fallback transport mechanism order that ASP.NET SignalR will use.
In which order does SignalR attempt to use the transports? To answer, move all actions from the list of actions to the answer area and arrange them in the correct order.
NOTE: Each correct selection is worth one point.

Correct Answer:

You are developing an ASP.NET MVC application in Visual Studio 2012. The application processes data for a bakery and contains a controller named BagelController.es that has several actions. The GetBagel action is defined in the following code segment.

The GetBagel action is the only action that should be accessed via a URL pattern. Routes to the other actions in the controller must be suppressed.
The default route must map to HomeController and the Index action.
You need to build the routes.
Which three code segments should you use in sequence? (To answer, move the appropriate actions from the list of actions to the answer area and arrange them in the correct order.)


The GetBagel action is the only action that should be accessed via a URL pattern. Routes to the other actions in the controller must be suppressed.
The default route must map to HomeController and the Index action.
You need to build the routes.
Which three code segments should you use in sequence? (To answer, move the appropriate actions from the list of actions to the answer area and arrange them in the correct order.)

Correct Answer:

You are preparing to deploy an ASP.NET MVC web application to an Microsoft Azure App Services Web App. The application was built by another team, and the source code cannot be changed.
The application depends on a specific set of files to operate correctly. These files must exist on a local disk.
You need to ensure that the application works correctly.
Which two tasks should you perform? Each correct answer presents part of the solution.
NOTE: Each correct selection is worth one point
The application depends on a specific set of files to operate correctly. These files must exist on a local disk.
You need to ensure that the application works correctly.
Which two tasks should you perform? Each correct answer presents part of the solution.
NOTE: Each correct selection is worth one point
Correct Answer: B,D
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?
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: D
Explanation: Only visible for ExamsLabs members. You can sign-up / login (it's free).