MCQs > IT & Programming > Microsoft MVC Framework MCQs > Basic Microsoft MVC Framework MCQs

Basic Microsoft MVC Framework MCQ

1. How to preserve session in TempData for consecutive requests

Answer

Correct Answer: Temp.Keep()

Note: This Question is unanswered, help us to find answer for this one

2. The ASP.NET run-time detects the browser user-agent using

Answer

Correct Answer: None of the below

Note: This Question is unanswered, help us to find answer for this one

3. An anti-forgery token is useful for

Answer

Correct Answer: preventing malicious form posts

Note: This Question is unanswered, help us to find answer for this one

4. ASP.NET MVC Framework implements a(n):

Answer

Correct Answer: Front controller pattern

Note: This Question is unanswered, help us to find answer for this one

5. True or False? You can use routing and "web.config" files to secure your MVC application.

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

6. What is the most scalable way to share Session information in a web farm?

Answer

Correct Answer: AppFabric caching

Note: This Question is unanswered, help us to find answer for this one

7. Which class contains information about the HTTP request that is parsed and inspected by the MVC pipeline when determining which controller and action to invoke?

Answer

Correct Answer: RequestContext

Note: This Question is unanswered, help us to find answer for this one

8. What does "Remote" attribute do?

Answer

Correct Answer: Model Data Annotation Attribute to call Ajax validation action

Note: This Question is unanswered, help us to find answer for this one

9. RenderPartial method:

Answer

Correct Answer: Renders to the stream

Note: This Question is unanswered, help us to find answer for this one

10. You are authoring unit tests. The unit tests must test code that consumes sealed classes. You need to create, maintain, and inject dependencies in the unit tests.

Answer

Correct Answer: Shim types

Note: This Question is unanswered, help us to find answer for this one

11. Which class is used by the MVC pipeline to map data from a HTTP request to the parameters in a controller's action method?

Answer

Correct Answer: DefaultModelBinder

Note: This Question is unanswered, help us to find answer for this one

12. Which method is NOT valid in the context of an MVC view?

Answer

Correct Answer: @RenderAction("Action")

Note: This Question is unanswered, help us to find answer for this one

13. Which property can you set on the BundleCollection class to indicate that you wish to enable support for CDN scripts or styles?

Answer

Correct Answer: UseCdn

Note: This Question is unanswered, help us to find answer for this one

14. The advantage of using read-only attribute for session state is:

Answer

Correct Answer: Parallel access of session

Note: This Question is unanswered, help us to find answer for this one

15. What is the advantage of InProc Session Storage over the other built-in methods?

Answer

Correct Answer: It can store non-serialisable data.

Note: This Question is unanswered, help us to find answer for this one

16. What type of filter should be used if you want to modify the result of an action method?

Answer

Correct Answer: Result filter

Note: This Question is unanswered, help us to find answer for this one

17. 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?

Answer

Correct Answer: <%: Model.FirstName %>

Note: This Question is unanswered, help us to find answer for this one

18. An MVC Filter can only be applied as an Attribute above an Action or Controller

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

19. Which attribute could you use if you had a property on your Model class that you wish to be hidden when using the EditorForModel HTML Helper method?

Answer

Correct Answer: HiddenInput

Note: This Question is unanswered, help us to find answer for this one

20. Which of these is a property of OutputCache attribute?

Answer

Correct Answer: VaryByHeader

Note: This Question is unanswered, help us to find answer for this one

21. Where are the routing rules defined in an asp.net MVC application?

Answer

Correct Answer: Application_Start event in Global.asax

Note: This Question is unanswered, help us to find answer for this one

22. Recipe is available in:

Answer

Correct Answer: MVC4

Note: This Question is unanswered, help us to find answer for this one

23. An MVC application can have a:

Answer

Correct Answer: Session

Note: This Question is unanswered, help us to find answer for this one

24. Which static class could you use to enable OAuth support for clients such as Twitter & Facebook?

Answer

Correct Answer: OAuthWebSecurity

Note: This Question is unanswered, help us to find answer for this one

25. Which of the following is NOT a member of the UrlHelper class.

Answer

Correct Answer: RenderAction

Note: This Question is unanswered, help us to find answer for this one

26. RenderAction method is used to:

Answer

Correct Answer: Run a controller action

Note: This Question is unanswered, help us to find answer for this one

27. When you implement your own Model Binder, what method do you have to implement?

Answer

Correct Answer: BindModel

Note: This Question is unanswered, help us to find answer for this one

28. How do you prevent forgery of a request?

Answer

Correct Answer: Using ValidateAntiForgeryToken and Html.AntiForgeryToken helper method only.

Note: This Question is unanswered, help us to find answer for this one

29. When declaring routes, what are constraints used for?

Answer

Correct Answer: Restrict the requests that match a particular route

Note: This Question is unanswered, help us to find answer for this one

30. Any method that is decorated with ChildActionOnlyAttribute can be called ONLY using:

Answer

Correct Answer: Html.Action or Html.RenderAction

Note: This Question is unanswered, help us to find answer for this one

31. Which class is used by the MVC pipeline to call a resolved controller's action as the result of a HTTP request?

Answer

Correct Answer: ControllerActionInvoker

Note: This Question is unanswered, help us to find answer for this one

32. How do you catch unhandled action exceptions in a controller?

Answer

Correct Answer: In the overriden OnException method

Note: This Question is unanswered, help us to find answer for this one

33. What is ChildActionOnlyAttribute?

Answer

Correct Answer: Any method that is marked with ChildActionOnlyAttribute can be called only with the Action or RenderAction HTML extension methods.

Note: This Question is unanswered, help us to find answer for this one

34. Which HTML Helper would you use if you want the MVC engine to dynamically generate a form for an entire object based upon the metadata of the object's type?

Answer

Correct Answer: Html.EditorForModel()

Note: This Question is unanswered, help us to find answer for this one

35. If you wish to write a module for your own custom logging or message headers, which interface could you implement?

Answer

Correct Answer: IHttpModule

Note: This Question is unanswered, help us to find answer for this one

36. You are developing an ASP.NET MVC application that will be deployed on a web farm. Passwords must be stored in the web.config file and must not be readable or in a format that is easily decodable You need to encrypt the passwords that are stored in the web.config file. Which command-line tool should you use?

Answer

Correct Answer: Aspnet_regiis.exe

Note: This Question is unanswered, help us to find answer for this one

37. The UIHint attribute is used to do what?

Answer

Correct Answer: Placed on the Model to specify the custom template to render for the property.

Note: This Question is unanswered, help us to find answer for this one

38. Which class could you use to create rules for using custom display modes?

Answer

Correct Answer: DisplayModeProvider

Note: This Question is unanswered, help us to find answer for this one

39. Which of the following is NOT a way to pass information from a controller to a view to be used by the razor view engine?

Answer

Correct Answer: Using a JSON object.

Note: This Question is unanswered, help us to find answer for this one

40. Which of these are NOT conditions in which it's recommended to use asynchronous methods?

Answer

Correct Answer: The operations are simple or short-running.

Note: This Question is unanswered, help us to find answer for this one

41. If you want to setup custom configuration for a controller (formatters, model binders, etc.) which interface would you attribute need to implement?

Answer

Correct Answer: IControllerConfiguration

Note: This Question is unanswered, help us to find answer for this one

42. If you wish to genrate links to related resources to add hypermedia to your REST service, what class could you use?

Answer

Correct Answer: UrlHelper

Note: This Question is unanswered, help us to find answer for this one

43. What class would you derive from if you wish to create a custom type for Web API's HTTP Content Negotiation?

Answer

Correct Answer: MediaTypeFormatter

Note: This Question is unanswered, help us to find answer for this one

44. You are developing an ASP.NET MVC application. The application is deployed in a web farm and is accessed by many users. The application must handle web server failures gracefully. The servers in the farm must share the short-term state information. You need to persist the application state during the session. What should you implement?

Answer

Correct Answer: A state server

Note: This Question is unanswered, help us to find answer for this one

45. Which of these is NOT an view engine for MVC?

Answer

Correct Answer: Angular

Note: This Question is unanswered, help us to find answer for this one

46. ActionResult is:

Answer

Correct Answer: An abstract class

Note: This Question is unanswered, help us to find answer for this one

47. By default, where is TempData stored?

Answer

Correct Answer: Session

Note: This Question is unanswered, help us to find answer for this one

48. MVC Filters can only be applied to Actions

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

49. If you wish to use a custom IoC container when the ASP.NET MVC engine is generating instances of your controller, what interface would you implement?

Answer

Correct Answer: IDependencyResolver

Note: This Question is unanswered, help us to find answer for this one

50. If you wish to leverage the OData standards for querying your REST service, what attribute could you use on your ApiController action?

Answer

Correct Answer: Queryable

Note: This Question is unanswered, help us to find answer for this one

51. If you wish for a ApiController action to be used for many different HTTP Verbs, which attribute would you set?

Answer

Correct Answer: AcceptVerbs

Note: This Question is unanswered, help us to find answer for this one

52. If you wish to create a Web API controller, what class would you derive your controller from?

Answer

Correct Answer: ApiController

Note: This Question is unanswered, help us to find answer for this one

53. Which class is NOT a child of ActionResult?

Answer

Correct Answer: CssResult

Note: This Question is unanswered, help us to find answer for this one

54. What is OutputCacheAttribute used for?

Answer

Correct Answer: To mark an action method whose output will be cached.

Note: This Question is unanswered, help us to find answer for this one

55. Tempdata is used to:

Answer

Correct Answer: pass data between two consecutive requests

Note: This Question is unanswered, help us to find answer for this one

56. What attribute is used to handle an exception that is thrown by an action method?

Answer

Correct Answer: HandleErrorAttribute

Note: This Question is unanswered, help us to find answer for this one

57. 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?

Answer

Correct Answer: Html.Partial()

Note: This Question is unanswered, help us to find answer for this one

58. Which class would you return from a Controller action when performing partial page updates?

Answer

Correct Answer: PartialViewResult

Note: This Question is unanswered, help us to find answer for this one

59. [WebMethod] Attribute is required when calling an MVC Action with AJAX

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

60. Which class represents an initial HTTP class to the Web API framework?

Answer

Correct Answer: HttpRequestMessage

Note: This Question is unanswered, help us to find answer for this one

61. Which class represents the result of a HTTP call to the Web API framework?

Answer

Correct Answer: HttpResponseMessage

Note: This Question is unanswered, help us to find answer for this one

62. 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?

Answer

Correct Answer: AllowAnonymous attribute

Note: This Question is unanswered, help us to find answer for this one

63. 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?

Answer

Correct Answer: Windows

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: _Layout.mobile.cshtml

Note: This Question is unanswered, help us to find answer for this one

65. How is a model passed to a controller action validated?

Answer

Correct Answer: ModelState.IsValid

Note: This Question is unanswered, help us to find answer for this one

66. 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?

Answer

Correct Answer: VaryByParam

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: IBundleTransform

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Areas

Note: This Question is unanswered, help us to find answer for this one

69. What is the type of the ViewBag property?

Answer

Correct Answer: Dynamic

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Set the Layout property to null

Note: This Question is unanswered, help us to find answer for this one

71. Which of the following protocols are not supported by WCF?

Answer

Correct Answer: All of these choices are supported by WCF

Note: This Question is unanswered, help us to find answer for this one

72. What attribute is used to restrict access by callers to an action method?

Answer

Correct Answer: AuthorizeAttribute

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: System.ComponentModel.DataAnnotations

Note: This Question is unanswered, help us to find answer for this one

74. What enum represents a strongly-typed collection of the HTTP Status Codes?

Answer

Correct Answer: HttpStatusCode

Note: This Question is unanswered, help us to find answer for this one

75. What is the first filter run in a controller action?

Answer

Correct Answer: Authorization

Note: This Question is unanswered, help us to find answer for this one

76. 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"?

Answer

Correct Answer: Display

Note: This Question is unanswered, help us to find answer for this one

77. 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?

Answer

Correct Answer: new { productId = @"\d+" }

Note: This Question is unanswered, help us to find answer for this one

78. How do you prevent routing?

Answer

Correct Answer: Use ignoreroute method

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: IgnoreRoute

Note: This Question is unanswered, help us to find answer for this one

80. 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?

Answer

Correct Answer: RegularExpression

Note: This Question is unanswered, help us to find answer for this one

81. Which of these emulators are valid mobile emulators for MVC applications?

Answer

Correct Answer: All of these

Note: This Question is unanswered, help us to find answer for this one

82. In MVC, Which represents data that you want to have displayed on viewpage?

Answer

Correct Answer: View Model

Note: This Question is unanswered, help us to find answer for this one

83. Which Razor construct is used to indicate a view is strongly-typed

Answer

Correct Answer: @model

Note: This Question is unanswered, help us to find answer for this one

84. 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?

Answer

Correct Answer: GET, POST

Note: This Question is unanswered, help us to find answer for this one

85. What is the default view engine that comes with MVC3?

Answer

Correct Answer: Razor

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

87. The order in which routes are defined matters.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Authorize attribute

Note: This Question is unanswered, help us to find answer for this one

89. The MVC framework is defined in which namespace?

Answer

Correct Answer: System.Web.Mvc

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: @

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: ActionResult

Note: This Question is unanswered, help us to find answer for this one

93. Which HTML Helper would you use to create a form element in a View?

Answer

Correct Answer: BeginForm

Note: This Question is unanswered, help us to find answer for this one

94. Which of these formats is not supported out of the box by Web API?

Answer

Correct Answer: AMF

Note: This Question is unanswered, help us to find answer for this one

95. A controller action can return:

Answer

Correct Answer: All answers are correct.

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Bundling

Note: This Question is unanswered, help us to find answer for this one

97. Where is data validation done?

Answer

Correct Answer: Model

Note: This Question is unanswered, help us to find answer for this one

98. Which is true about ModelState?

Answer

Correct Answer: It has the state of the model

Note: This Question is unanswered, help us to find answer for this one

99. 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?

Answer

Correct Answer: Implement WebSockets protocol on the client and the server.

Note: This Question is unanswered, help us to find answer for this one

100. As a best practice, all input validation should occur in which layer?

Answer

Correct Answer: Model

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: All of these

Note: This Question is unanswered, help us to find answer for this one