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 have been given requirements for a dashboard page that will contain summary information from your order processing system in a single display table. However, this summarization needs to be done by combining data requests from the order system, the shipping system, and the accounting system. The dashboard page will be the only place you use this combined data. What is the best way to implement this requirement?

A - Make the various data requests and compile the information in the controller for display.

B - Create an individual model for each of the data requests, and then create a view- specific model that calls those models and merges the data.

C - Create a model for the summary data and handle the various data requests within that model as well as the merging of the data.

D - Create an individual model for each of the data requests and then merge the data on the client side for display.

E - C and D both

F - All of the above

Answer : B

Explanation

B.You will have a better chance of code reuse if you break down the separate calls into their own models and then create another model to pull them together and compile them.

Q 2 - You are designing an ASP.NET MVC 4 application that uses an Oracle database for persistence. What session configuration choices enable you to deploy your application on a web farm? (Choose all that apply.)

A - InProc

B - SQLServer

C - StateServer

D - Custom session provider

E - C and D both

F - All of the above

Answer : E

Explanation

E.Using a shared state server across the web farm is an available option. Using a state server designates one server to maintain state for all the servers that connect to it.A custom session provider enables you to maintain state as necessary by doing the work in your custom code. It is generally used when you try to use a dif- ferent RDBMS system or when you do not want to use the default session database design.

Answer : C

Explanation

C.Intercepting every request for .jpg and .png files is the easiest way to consistently add watermarks to the images.

Q 4 - You are modifying an ASP.NET MVC web application and you have created a new master layout page named _Layout.WindowsPhone.cshtml. You want to use that layout in a new view. Which code segment do you use?

A - @Html.ActionLink("_Layout.WindowsPhone.cshtml");

B - Layout="~/Views/Shared/_Layout.WindowsPhone.cshtml";

C - Layout="Layout.WindowsPhone.cshtml";

D - @Html.Partial("_Layout.WindowsPhone.cshtml");

E - C and A both

F - All of the above

Answer : B

Explanation

B.Layout="" loads the layout file to be used with that view.

Answer : E

Explanation

E.Bundling every script into a single large file might decrease the effective- ness of concurrent downloading.Not separating scripts logically might lead to the user downloading scripts that will never be used. Although the download experience is maximized, it does not make sense to download unused scripts.

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 9 - You are implementing an ASP.NET MVC 2 Web application. The URL with path /Home/Details/{country} will return a page that provides information about the named country. You need to ensure that requests for this URL that contains an unrecognized country value will not be processed by the Details action of HomeController.What should you do?

A - Add the ValidateAntiForgeryToken attribute to the Details action method.

B - Add the Bind attribute to the country parameter of the Details action method. Set the attribute's Prefix property to Country.

C - Create a class that implements the IRouteConstraint interface. Configure the default route to use this class.

D - Create a class that implements the IRouteHandler interface. Configure the default route to use this class.

E - A and D both

F - All of the above

Answer : C

Explanation

C.IrouteConstraint interface is implemented to configure default route to implement custom logic

Q 10 - Which of the following represents razor syntax?

A - !

B - @

C - <%-%>

D - )

E - C and D both

F - All of the above

Answer : B

Explanation

B.Razar syntax starts with @

mvc_framework_questions_answers.htm
Advertisements