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 - AppCmd.exe is an application that helps you work with which objects? (Choose all that apply.)

A - Site

B - Users

C - Config

D - App

E - A, D and E

F - All of the above

Answer : E

Explanation

E.AppCmd.exe enables the configuration of virtual sites.AppCmd.exe supports the administration of general configuration sections.AppCmd.exe manages the support of applications.

Q 2 - You are creating an ASP.NET MVC 4 web application that will be accessed by a large number of traditional consumers. If you need to be able to access state information on the client side in JavaScript/jQuery, where can you store it? (Choose all that apply.)

A - LocalStorage

B - QueryString

C - ViewState

D - Cookies

E - B and D both

F - All of the above

Answer : E

Explanation

E.Query string information is available across all browsers and is usable on both the client and server.Cookies can be stored for a period of time on the client and be read from either client- or server-side operations.

Q 3 - You are creating an ASP.NET MVC web application. The application must accept user input for a ProductName field. To reduce delays due to invalid entries making round trips between the client and server, user input should be validated on the client before being submitted to the server. Which code segment should you choose?

A -

@Html.LabelFor(model ⇒ model.ProductName)
@Html.EditorFor(model ⇒ model.ProductName)

B -

@Html.LabelFor(model ⇒ model.ProductName)
@Html.ValidationMessageFor (model ⇒ model.ProductName)

C -

@Html.EditorFor(model ⇒ model.ProductName)@Html.ValidationMessageFor(model⇒model.ProductName)

D -

@Html.LabelFor(model ⇒ model.ProductName)

E - C and A both

F - All of the above

Answer : C

Explanation

C.@Html.EditorFor, in combination with @Html.ValidationMessageFor, are used for client-side validation.

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.

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

Q 6 - You inherited a working application that began as a proof of concept but was eventually adopted as a production application without being refactored. Many new requirements need to be added. As part of your initial analysis, you notice a lot of problems with bad data. Which solutions will help remediate this issue? (Choose all that apply.)

A - Running the Performance Wizard to sample CPU usage

B - Adding code contracts to ensure that the input parameters have expected values

C - Adding code contracts to ensure that the return values meet specific criteria

D - Adding code contracts to ensure that objects do not become invalid during process

E - Running the Visual Studio profiler to analyze application flow

F - B, C and D

Answer : F

Explanation

F.Preconditional code contracts ensure that incorrect information is not submitted to a method. This helps eliminate the possibility of bad data.Postconditional code contracts ensure that incorrect information is not returned from a method. This helps eliminate the possibility of bad data.Invariant code contracts ensure that objects do not get to an invalid state. This helps eliminate the possibility of bad data.

Answer : F

Explanation

F.When publishing the projects, you can configure the process to deploy in debug mode with IntelliTrace enabled.You can view the IntelliTrace logs through Visual Studio after download.

Q 8 - What kind of helper methods does WebSecurity provide? (Choose all that apply.)

A - Login

B - ResetPassword

C - CreateAccount

D - ChangePassword

E - DeleteAccount

F - A ,B , C and D

Answer : F

Explanation

F.Login is one of the methods provided by the WebSecurity helper.ResetPassword is one of the methods provided by the WebSecurity helper.CreateAccount is one of the methods provided by the WebSecurity helper.ChangePassword is one of the methods provided by the WebSecurity helper.

Q 9 - You are developing an ASP.NET MVC 2 application. A view contains a form that allows users to submit their first name. You need to display the value that is submitted, and you must ensure that your code avoids crosssite scripting. Which code segment should you use?

A - <% Response.Write(HttpUtility.HtmlDecode(Model.FirstName)) %>

B - <%: Model.FirstName %>

C - <%= Model.FirstName %>

D - Both b&c will work

E - A and D both

F - All of the above

Answer : B

Explanation

B.<%: Model.FirstName %> avoids cross site scripting

Q 10 - Where are routes registered in ASP.NET MVC Application?

A - Controller

B - Web.config

C - Global.ascx

D - All of the above

E - C and D both

F - All of the above

Answer : C

Explanation

C.Routes are configured in Global.ascx in mvc

mvc_framework_questions_answers.htm
Advertisements