Microsoft MVC Framework MCQs

Microsoft MVC Framework MCQs

Answer these 100+ Microsoft MVC Framework MCQs and assess your grip on the subject of Microsoft MVC Framework.
Scroll below and get started!

1: Bundling and minification are two techniques you can use in ASP.NET 4.5 to:

A.   All of these

B.   Reduce the size of requested assets

C.   Reduce the number of requests to the server

D.   Improve request load time

2: As a best practice, all input validation should occur in which layer?

A.   View

B.   This is not best practice

C.   Model

D.   Controller

3: You are developing an ASP.NET MVC application that displays stock market information. The stock market information updates frequently and must be displayed in real-time. You need to eliminate unnecessary header data, minimize latency, and transmit data over a full-duplex connection. What should you do?

A.   Implement long-running HTTP requests.

B.   Implement WebSockets protocol on the client and the server.

C.   instantiate a MessageChannel object on the client.

D.   Configure polling from the browser.

4: Which is true about ModelState?

A.   It has the state of the model

B.   It has the properties that have changed only

C.   It has the model properties and filters

5: Where is data validation done?

A.   Controller

B.   Model

C.   View

6: What is the core process of rolling up a number of distinct resources together into a single downloadable resource in ASP.NET MVC?

A.   Hashing

B.   Compacting

C.   Joining

D.   Merging

E.   Bundling

7: A controller action can return:

A.   ContentResult

B.   ViewResult

C.   All answers are correct.

D.   JavascriptResult

8: Which of these formats is not supported out of the box by Web API?

A.   JSON

B.   AMF

C.   XML

D.   Form URL-encoded

9: Which HTML Helper would you use to create a form element in a View?

A.   Form

B.   FormGenerate

C.   FormBegin

D.   BeginForm

10: Which base class can be used for the return value of a MVC action method?

A.   Result

B.   ControllerResult

C.   ActionResult

D.   HttpResult

11: True or False? It is best practice to use model binding instead of manually parsing the request.

A.   False

B.   True

12: Which symbol[s] is used to designate Razor syntax code in a .cshtml file?

A.   ~

B.   <%

C.   ||

D.   @

13: The MVC framework is defined in which namespace?

A.   Unit.Control.Microsoft

B.   System.Web.Mvc

C.   SQL.Java.CSS

D.   Model.View.Controller

14: How can you restrict access to a Controller action so that only authorized users can call that action?

A.   Authorize attribute

B.   AllowUsers attribute

C.   SecurityDemand attribute

D.   A call to SecurityDemand static class

15: The order in which routes are defined matters.

A.   True

B.   False

16: True or False: By default, all controller classes must be named by using the "Controller" suffix.

A.   False

B.   True

17: What is the default view engine that comes with MVC3?

A.   Razor

B.   Spark

C.   Aspx

18: When creating a data-entry view for new data, which two HTTP request verbs (methods) should you anticipate using to serve the form to the user and allow the user to submit the form?

A.   POST, PUT

B.   PATCH, TRACE

C.   CONNECT, PUT

D.   GET, POST

19: Which Razor construct is used to indicate a view is strongly-typed

A.   @type

B.   @context

C.   @entity

D.   @model

20: In MVC, Which represents data that you want to have displayed on viewpage?

A.   Domain Model

B.   View Model

C.   Data Model

D.   Json Model

21: Which of these emulators are valid mobile emulators for MVC applications?

A.   Apple Safari

B.   Windows 7 Phone Emulator

C.   Opera Mobile Emulator

D.   All of these

22: Which attribute could you use if you had a Phone Number property on your model and you wanted to validate the value against the United States phone format?

A.   Required

B.   RegularExpression

C.   Custom

D.   Format

23: Which method in the RouteCollection can be used to prevent MVC from processing specific file types?

A.   OmitRoute

B.   DoNotResolve

C.   SkipRoute

D.   AvoidRoute

E.   IgnoreRoute

24: How do you prevent routing?

A.   Use deleteroute method

B.   Use ignoreroute method

C.   Use authentication flag in web.config

25: Which of the following regular expressions can be used as a constraint so that the route will match only when the "productId" parameter is numeric?

A.   new { productId = Integer }

B.   new { productId = @"\d+" }

C.   new { productId = @"^[a-zA-Z]+$" }

26: Which attribute could you use if you had a string property on your Model class named FirstName, but you want the labels for this property in your view to use the text "First Name"?

A.   Text

B.   Label

C.   Format

D.   Display

27: What is the first filter run in a controller action?

A.   Result

B.   Authorization

C.   None of these

D.   Action

28: What enum represents a strongly-typed collection of the HTTP Status Codes?

A.   StatusCode

B.   HttpStatusCode

C.   HttpStatus

D.   Status

29: Which namespace contains the attributes used to describe your model and it's properties?

A.   System.ComponentModel.DataAnnotations

B.   System.Web

C.   System.Web.Mvc

D.   System.Annotations

30: What attribute is used to restrict access by callers to an action method?

A.   RestrictAccessAttribute

B.   AuthorizeAttribute

C.   AuthenticateAttrbitue

D.   AllowAttribute

E.   AdminOnlyAttribute

31: Which of the following protocols are not supported by WCF?

A.   All of these choices are supported by WCF

B.   HTTP

C.   NAMED PIPES FOR ON MACHINE COMMUNICATIONS

D.   TCP /IP

E.   PEER TO PEER PROTOCOLS

32: How can you specify that a particular View should not use any implicitly set Layout View?

A.   Set the Layout property to null

B.   Set the ViewBag.LayoutFile property to null

C.   Append "None" to the name of the View

D.   Rename your View to _ViewStart.cshtml

33: What is the type of the ViewBag property?

A.   Object

B.   IEnumerable

C.   Dynamic

D.   List

E.   Generic

34: To accommodate large projects, ASP.NET MVC lets you partition Web applications into smaller units that are referred to as?

A.   Shared Folders

B.   Sections

C.   Views

D.   Areas

E.   Content

35: If you wish to include custom transformation logic in your Bundles, which interface could you implement?

A.   IBundleTransform

B.   Itransform

C.   Ibundle

D.   IBundleInvoker

36: What property could you set on the OutputCache attribute to indicate that you want it to instantiate new caches for different combinations of parameters to the Controller action method?

A.   VaryByParam

B.   VaryByBinding

C.   VaryByAction

D.   VaryByCustom

37: How is a model passed to a controller action validated?

A.   StateManager.IsValid

B.   State.IsValid

C.   ModelState.IsValid

D.   Model.IsValid

E.   StateModel.IsValid

38: If you have a _Layout.cshtml file in your shared views, which file can you create to have custom layout for mobile platforms?

A.   _Layout.device.cshtml

B.   _Layout.mobile.cshtml

C.   _Layout_mobile.cshtml

D.   _Layout.mob.cshtml

39: You are developing an ASP.NET MVC application. You need to authenticate clients by using NT LAN Manager (NTLM). Which authentication method should you implement?

A.   Forms

B.   Basic

C.   Windows

D.   Kerberos

40: If you have restricted a Controller so that all actions require the user to be authorized, how can you indicate that a specific action should be available without authorization?

A.   A call to Anonymous static class

B.   AllowUsers attribute

C.   AllowAnonymous attribute

D.   Authorize attribute

41: Which class represents the result of a HTTP call to the Web API framework?

A.   HttpRequestMessage

B.   ResponseMessage

C.   HttpResponseMessage

D.   RequestMessage

42: 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 View("Cart.Add")

B.   return Redirect("Cart/Add")

C.   Response.Redirect("Cart.aspx?Add")

43: Which class represents an initial HTTP class to the Web API framework?

A.   RequestMessage

B.   HttpResponseMessage

C.   HttpRequestMessage

D.   ResponseMessage

44: [WebMethod] Attribute is required when calling an MVC Action with AJAX

A.   False

B.   True

45: Which class would you return from a Controller action when performing partial page updates?

A.   ActionResult

B.   PartialResult

C.   PartialViewResult

D.   ViewResult

46: If you wanted to use a partial view but also pass the same model object from the parent view, what HTML Helper would you use?

A.   Html.PartialWithModel()

B.   Html.Action()

C.   Html.Partial()

D.   Html.ActionWithModel()

47: What attribute is used to handle an exception that is thrown by an action method?

A.   ValidateExceptionAttribute

B.   IgnoreErrorAttribute

C.   CatchErrorAttribute

D.   HandleErrorAttribute

E.   IgnoreExceptionAttribute

48: Tempdata is used to:

A.   pass data from the view to the controller action

B.   pass data between two consecutive requests

C.   pass data from controller action to the view

49: What is OutputCacheAttribute used for?

A.   None of the answers

B.   To skip method execution until cached output expires.

C.   To mark an action method whose output will be cached.

D.   To notify client browser that output shall be cached.

50: Which class is NOT a child of ActionResult?

A.   CssResult

B.   RedirectToRouteResult

C.   HttpStatusCodeResult

D.   JavaScriptResult

E.   JsonResult