70-486 Premium Bundle

70-486 Premium Bundle

Developing ASP.NET MVC 4 Web Applications Certification Exam

4.5 
(35250 ratings)
0 QuestionsPractice Tests
0 PDFPrint version
December 3, 2024Last update

Microsoft 70-486 Free Practice Questions

Q1. - (Topic 4) 

You develop an ASP.NET MVC application. The application has a controller named PeopleController.cs. The controller has an action method that returns a parent view. The parent view includes the following code. Line numbers are included for the reference only. 

The application also contains a partial view named People. The parent view must display the partial view. 

You need to add code at line 09 to display the partial view within the parent view. 

Which two code segments will achieve the goal? Each correct answer presents a complete solution. 

A. @{ Html.RenderPartial(“People”, Model);} 

B. @Html.Partial(“People”, Model) 

C. @Html.Display(“People”, Model) 

D. @Html.Raw(“People”) 

Answer:

Explanation: By default, any partial view rendered by calling @Html.Partial("PartialViewName") will get the view model passed to the parent view. 

Reference: How to populate mvc razor partial view 

http://stackoverflow.com/questions/13769707/how-to-populate-mvc-razor-partial-view 

Q2. - (Topic 2) 

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

A. $("body h1:nth-child(1)").fadeIn(1000); 

B. $("body h1:nth-child(1)")-fadeOut(1000); 

C. $("body h2:nth-child(1)").animate({ opacity: 0 }); 

D. $("body h1:nth-child(1)").animate({ opacity: 1 }); 

Answer: B,C 

Q3. - (Topic 4) 

You are developing an ASP.NET MVC application that uses forms authentication. The user database contains a user named LibraryAdmin. 

You have the following requirements: 

. You must allow all users to access the GetBook method. 

. You must restrict access to the EditBook method to the user named LibraryAdmin. 

You need to implement the controller to meet the requirements. 

Which code segment should you use? (Each correct answer presents a complete solution. Choose all that apply.) 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer: A,C 

Q4. - (Topic 1) 

If the canvas element is supported by the client browser, the application must display "London 2012" in the footer as text formatted by JavaScript at the end of the _Layout.cshtml file. 

You need to modify the layout to ensure that "London 2012" is displayed as either formatted text or as plain text, depending on what the client browser supports. 

Which code segment should you add? 

A. <canvas id="myFooter"> 

@(Request,Browser.JavaApplets ? new HtmlString("London 2012") : null) 

</canvas> 

B. <canvas id="myFooter">London 2012</canvas> 

C. <canvas id="myCanvas">London 2012</canvas> 

D. <canvas id="myCanvas"></canvas> 

<p>London 2012</p> 

Answer:

Q5. - (Topic 2) 

When users attempt to retrieve a product from the product page, a run-time exception 

occurs if the product does not exist. 

You need to route the exception to the CustomException.aspx page. 

Which method should you add to MvcApplication? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q6. - (Topic 4) 

You are developing a new ASP.NET MVC application that will be hosted on Microsoft Azure. You need to implement caching. 

The caching solution must support the following: 

The cache must be able to store out-of-process ASP.NET session state. 

The cache must be able to store a variety of data types. 

The cache must offer a large amount of space for cached content. 

You must be able to share output cache content across web server instances. 

You need to select a cache solution. 

Which caching solution should you choose? 

A. ASP.NET Caching 

B. Azure In-Role Cache 

C. Azure Redis Cache 

D. Azure Managed Cache Service 

Answer:

Reference: How to Use Azure Redis Cache 

https://azure.microsoft.com/sv-se/documentation/articles/cache-dotnet-how-to-use-azure-redis-cache/ 

Q7. - (Topic 4) 

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

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? 

A. Add the following code to the web.config file of the application. 

<customErrors mode=”On” > 

<error statusCode=”404” redirect=”CustomErrors.html” /> 

</customErrors> 

B. From the Debug menu in Visual Studio, select Exceptions. Disable the User-unhandled 

check box for Common Language Runtime Exceptions. 

C. Add the following code to the web.config file of the application. 

<customErrors mode=“On” > 

<error statusCode=”500” redirect=”CustomErrors.html” /> 

</customErrors> 

D. From the Debug menu in Visual Studio, select Exceptions. Enable the Thrown check 

box for Common Language Runtime Exceptions. 

Answer:

Explanation: 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 

Q8. - (Topic 4) 

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? 

A. From the Debug menu in Visual Studio 2012, select Exceptions. Enable the Thrown check box for Common Language Runtime Exceptions. 

B. From the DEBUG menu in Visual Studio 2012, select Attach to Process. Select the IIS process. 

C. From the Debug menu in Visual Studio 2012, select Exceptions. Disable the User-unhandled check box for Common Language Runtime Exceptions. 

D. From the TOOLS menu in Visual Studio 2012, click Customize. C!ic< tie Commands tab and select Debug. 

Answer:

Q9. DRAG DROP - (Topic 4) 

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

Answer:  

Q10. HOTSPOT - (Topic 4) 

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: 

. _Layout.WP7.cshtml 

. Index.WP7.cshtml 

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

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

Answer:  

Q11. DRAG DROP - (Topic 1) 

You need to implement security according to the business requirements. 

You have the following code: 

Which code segments should you include in Target 1, Target 2, Target 3 and Target 4 to modify RunLogController? To answer, drag the appropriate code segment 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. 

Answer:  

Q12. DRAG DROP - (Topic 4) 

You are developing an ASP.NET web application that uses health monitoring to log events to the Windows Event Log. The application contains a custom event that is defined in the following code segment. Line numbers are included for reference only. 

You need to ensure that the event is correctly added to the Windows event log. 

How should you complete the relevant code? To answer, drag the appropriate code segment to the correct location or locations. 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:  

Q13. - (Topic 3) 

You need to maximize performance of video delivery. 

Which code segment should you use as the body of the GetVideoStream function in the Video-Controller class? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q14. - (Topic 4) 

You are designing an MVC web application. 

The view must be as simple as possible for designers who do not have a technical 

background. 

You need to combine two existing models to meet the requirement. 

Which component of the MVC framework should you use? 

A. View 

B. View Model 

C. Controller 

D. Model 

Answer:

Q15. - (Topic 1) 

You need to add an action to RunLogController to validate the users' passwords. Which code segment should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q16. - (Topic 4) 

You are developing an ASP.NET MVC application that uses forms authentication. The application uses SQL queries that display customer order data. 

You need to prevent all SQL injection attacks against the application. 

How should you secure the queries? 

A. Implement parameterization. 

B. Pattern check the input. 

C. Filter out prohibited words in the input. 

D. Escape single quotes on string-based input parameters. 

Answer:

Explanation: With most development platforms, parameterized statements that work with parameters can be used (sometimes called placeholders or bind variables) instead of embedding user input in the statement. A placeholder can only store a value of the given type and not an arbitrary SQL fragment. Hence the SQL injection would simply be treated as a strange (and probably invalid) parameter value. 

Reference: https://en.wikipedia.org/wiki/SQL_injection#Parameterized_statements 

START 70-486 EXAM