MVC Framework Mock Test



This section presents you various set of Mock Tests related to MVC Framework Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

MVC Framework Mock Test IV

Q 1 - Windows Azure ACS allows for federated identification from outside agencies such as a Microsoft account or Facebook. Which entity issues the final token that your application will accept for access?

A - The outside agency

B - Your application

C - Your network firewall

D - Windows Azure ACS

E - A and B both

F - All of the above

Answer : D

Explanation

D.ACS reads the token provided by the identity providers and creates a token that your application understands and accepts.

Q 2 - WIF enables you to create a custom token. To be able to use the token, you must create a custom token handler by overriding which of the following?

A - SecurityToken

B - SecurityTokenHandler

C - SWTToken

D - Saml2SecurityTokenHandler

E - A and B both

F - All of the above

Answer : B

Explanation

B.SecurityTokenHandler is the appropriate class to override for creating a custom token handler

Q 3 - WIF adds the concepts of claims to which of the following? (Choose all that apply.)

A - IIdentity

B - IPrincipal

C - User

D - MembershipProvider

E - A and B both

F - All of the above

Answer : E

Explanation

E.The class implementing the IIdentity interface contains claims information. The class implementing the IPrincipal interface contains claims information.

Answer : C

Explanation

C.CryptoStream provides access to an encrypted stream

Q 5 - What are digital signatures used for? (Choose all that apply.)

A - Encryption

B - Authentication

C - Nonrepudiation

D - Authorization

E - Hashing

F - B, C and D

Answer : F

Explanation

F.Authentication is a reason for digital signing because it uniquely defines the party signing the data. Non-repudiation is a reason for digital signing because it uniquely defines the party signing the data and shows that it had to be the original party that submitted the data.Authorization can be determined after the individual is uniquely defined.

Answer : E

Explanation

E.The CA validates the company or individual.The CA signs the certificate

Answer : E

Explanation

E.The AntiXSS Library is more performant than the traditional .NET Framework.AntiXSS takes an accepted-list approach, which means only those characters that have been approved are allowed through.AntiXSS was designed to allow additional support for globalization.

Q 9 - A SQL injection attack occurs when an application allows input submitted by the client to be run as part of a SQL command. What actions should a developer take to ensure that this doesn't happen? (Choose all that apply.)

A - Use Entity SQL because it does not suffer from the same risk.

B - Use SQLParameters to submit the parameters.

C - Use Linq-to-Entities to access the database,

D - Filter out keywords and symbols.

E - B and C both

F - All of the above

Answer : E

Explanation

E.Using SQLParameters is the best way to manage this risk.Linq-to-Entities uses an object model as access into the data layer, so the risk is mitigated.

Q 10 - If you have View with @Page directive to inherit from ViewPage<TModel> then your View is_________.(where TModel is type of Model)

A - Partial View

B - Strongly Typed View

C - Content View

D - Template View

E - A and D both

F - All of the above

Answer : B

Explanation

B.Strongly typed views are bound to the model

Q 11 - You are writing an action method called AddProduct inside the Product controller. The logic in your code indicates that you need to call the Cart controller's Add method as a result of your controller's action method. Which line of code would accomplish this?

A - return Content("Cart.Add")

B - Response.Redirect("Cart.aspx?Add")

C - return redirect("Cart/Add")

D - return View("Cart.Add")

E - A and D both

F - All of the above

Answer : C

Explanation

C.This will redirect to the Add method of Cart controller

Q 12 - 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 13 - You create an ASP.NET MVC 2 Web application that contains the following controller class.public class CartController : Controller { static List products = new List(); public ActionResult Index() { return View(); }}and the Views folder of your application, you add a view page named Index.aspx that includes the following @ Page directive.<%@ Page Inherits="System.Web.Mvc.ViewPage" %> You test the application with a browser. You receive the following error message when the Index method is invoked: "The view 'Index' or its master was not found." You need to resolve the error so that the new view is displayed when the Index method is invoked.What should you do?

A - Create a folder named Cart inside the Views folder.Move Index.aspx to the Cart folder.

B - Modify the Index method by changing its signature to the following: public ActionResult Index(Cart c)

C - Change the name of Index.aspx file to Cart.aspx

D - None of above

E - A and D both

F - All of the above

Answer : A

Explanation

A.Create a folder named Cart inside the Views folder.Move Index.aspx to the Cart folder.

Q 14 - 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

Answer : B

Explanation

B.Makes Test Driven Development (TDD) very difficult

Q 17 - Which Helper Method is used to return a user-defined content type.

A - Content

B - JavaScript

C - View

D - RedirectToRoute

E - A and D both

F - All of the above

Answer : A

Explanation

A.Content Helper Method is used to return a user-defined content type.

Q 18 - Which Helper Method Returns binary output to write to the response?

A - Content

B - File

C - JavaScript

D - Json

E - C and D both

F - All of the above

Answer : B

Explanation

B.File Helper Method Returns binary output to write to the response

Q 19 - Which Action Result Renders a partial view, which defines a section of a view that can be rendered inside another view?

A - ContentResult

B - RedirectResult

C - PartialViewResult

D - None of above.

E - C and D both

F - All of the above

Answer : C

Explanation

C.PartialViewResult

Answer : A

Explanation

A.Strongly typed views are created with model class

Answer : D

Explanation

D.Partial views in mvc are the reusable views

Q 22 - 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.

Q 23 - 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

Q 24 - 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 @

Answer : A

Explanation

A.JSON are used to return JSON result in MVC

Answer Sheet

Question Number Answer Key
1 D
2 B
3 E
4 C
5 F
6 A
7 E
8 E
9 E
10 B
11 C
12 C
13 A
14 B
15 B
16 D
17 A
18 B
19 C
20 A
21 D
22 A
23 C
24 B
25 A
mvc_framework_questions_answers.htm
Advertisements