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.

Questions and Answers

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?

A - Design a model that handles the data call to populate the model. Create a partial view containing only this display area and put an asynchronous service call that returns this model in the partial view controller.

B - Put a synchronous service call into the main page controller.

C - Create a partial view containing only this display area and put a synchronous service call in the partial view controller.

D - Create a partial view containing only this display area and put an asynchronous service call in the partial view controller.

E - A and D both

F - All of the above

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

A - Data caching

B - Page output caching with duration of two minutes

C - Page output caching with duration of four hours

D - Windows AppFabric caching

E - A, C and D

F - All of the above

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?

A - object, EventArgs

B - HttpApplication

C - HttpContext

D - Object

E - A and D both

F - All of the above

Answer : C

Explanation

C.The ProcessRequest method takes the HttpContext parameter.

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>

D - <h2>@mvcapp.Resources.Home.Index.HeadingHello</h2>

E - C and B both

F - All of the above

Answer : A

Explanation

A.This is the correct way to insert resources into a view

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

D - [AuthorizeAttribute(Roles="Admin")]

E - A and B both

F - All of the above

Answer : B

Explanation

B.The Authorize attribute handles authorization on a controller and/or action basis by using the Roles= qualifier

Q 10 - Whichtools is used for unit testing in MVC

A - moq

B - Junit

C - xunit

D - Funit

E - C and D both

F - All of the above

Answer : A

Explanation

A.MOQ are used to perform unit testing in MVC.

mvc_framework_questions_answers.htm
Advertisements