- MVC Framework Tutorial
- MVC Framework - Home
- MVC Framework - Introduction
- MVC Framework - Architecture
- MVC Framework - ASP.NET Forms
- MVC Framework - First Application
- MVC Framework - Folders
- MVC Framework - Models
- MVC Framework - Controllers
- MVC Framework - Views
- MVC Framework - Layouts
- MVC Framework - Routing Engine
- MVC Framework - Action Filters
- Advanced Example
- MVC Framework - Ajax Support
- MVC Framework - Bundling
- Exception Handling
- MVC Framework Useful Resources
- Questions & Answers
- MVC Framework - Quick Guide
- MVC Framework - Resources
- MVC Framework - Discussion
MVC Framework Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to MVC Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.
Q 1 - You are designing an application in which a section of the main page will be populated by content from a third-party provider. You do not have control over the responsiveness of the client or how much information will be returned with each request. The call is to a Restful service and will return the information formatted in Extensible Markup Language (XML). What is the best way to implement this application?
B - Put a synchronous service call into the main page controller.
Answer : A
Explanation
A.Because you do not have control over the responsiveness of the third- party provider and you do not know how much data might be returned from each call, you should wrap the call in the asynchronous framework. Providing the data in a strongly-typed model gives it more flexibility than working with the raw XML on the client side.
Q 2 - You are adding a reporting vertical to an enterprise application. Many of the reports will be run every morning by a set of users. Some of the reports will be identical as every member of a team will get the same report sometime in the morning. What kind of caching will provide an improvement in performance? (Choose all that apply.)
B - Page output caching with duration of two minutes
Answer : E
Explanation
E.Data caching with the appropriate timeout will enable the data needed for the reports to be stored so that the call to the database is not necessary.A page output caching of four hours caches the output of the report for the whole morning and should eliminate the need for the report to be run a second time.AppFabric caching acts much like data caching to eliminate the need for additional calls to the database to generate the reports.
Q 3 - When you are creating a custom handler, what is the parameter being passed into the ProcessRequest method?
Answer : C
Explanation
C.The ProcessRequest method takes the HttpContext parameter.
Q 4 - You are modifying an existing ASP.NET MVC web application to incorporate mobile access. What should you do to ensure that mobile devices view mobile-only pages? (Choose all that apply.)
A - Run the Install-Package jQuery.Mobile.MVC command using the Package Manager console.
B - Create a _Layout.Mobile.cshtml master layout page.
C - Create additional views with .Mobile, such as Index.Mobile.cshtml.
Answer : E
Explanation
E.This installs all the necessary mobile packages.All mobile views and mobile master layout ensure that the page will load accordingly.
Q 5 - You are creating an ASP.NET MVC website and you want to replace a <h2>hello</h2>tag within the view with custom resources you have created. What should you use?
A - <h2>@mvcapp.Resources.Home.Index.Heading</h2>
B - <h2div="resource">Hello</h2>
C - <h2 class="resource">Hello</h2>
Answer : A
Explanation
A.This is the correct way to insert resources into a view
Q 6 - You are helping a client estimate the effort involved in adding comprehensive monitoring to an enterprise-level ASP.NET MVC application. Which of the following are useful considerations while building the estimate? (Choose all that apply.)
Answer : E
Explanation
E.Adding health monitors is an easy task. Determining which options pro- vide the information you need will be time-consuming because of the number of choices.Generic logging is a useful addition and can be added as items are refac- tored; it is not an all-or-nothing type of work.
Q 7 - You are under contract with a large company that is starting to implement a TDD approach. As part of the long-term support for this effort, the company needs you to complete several unit tests. As you review the current code base, you find good tests for the model, but no tests for anything other than the model. Which of the following is the best approach to complete the unit tests?
Answer : D
Explanation
D.This solution provides for testing actions and nonactions as well as a good split of the tests per file.
Q 8 - What attribute or code snippet within a controller enables a role named Admin to access actions or code blocks after the check-in code?
A - RoleProvider.GetRolesForUser("Admin")
B - [Authorize(Roles="Admin")]
C - RoleProvider.IsUserInRole(User.Name)
Answer : B
Explanation
B.The Authorize attribute handles authorization on a controller and/or action basis by using the Roles= qualifier
Q 9 - How do you encrypt the <connectionStrings> section of the Web.config file?
B - aspnet_regiis -pe "Web.Config"-app "/MachineDPAPI" -prov "RsaProtectedConfigurationProvider"
D - aspnet_regiis -pd "Web.Config" -app "/MachineDPAPI" -prov "RsaProtectedConfigurationProvider"
Answer : A
Explanation
A.This is the proper way to encrypt the <connectionStrings> setting of the Web.config file
Q 10 - Whichtools is used for unit testing in MVC
Answer : A
Explanation
A.MOQ are used to perform unit testing in MVC.
To Continue Learning Please Login
Login with Google