Question:* Bundling and minification are two techniques you can use in ASP.NET 4.5 to:
Answer: • All of these
Question:* As a best practice, all input validation should occur in which layer?
Answer: • Model
Question:* Which of these formats is not supported out of the box by Web API?
Answer: • AMF
Question:* Which of these are NOT advantages to the ASP.NET MVC framework?
Answer: • All are advantages
Question:* Which symbol[s] is used to designate Razor syntax code in a .cshtml file?
Answer: • @
Question:* What does MVC stand for?
Answer: • Model View Controller
Question:* The MVC framework is defined in which namespace?
Answer: • System.Web.Mvc
Question:* True or False? It is best practice to use model binding instead of manually parsing the request.
Answer: • True
Question:* Which base class can be used for the return value of a MVC action method?
Answer: • ActionResult
Question:* 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: • GET, POST
Question:* True or False: By default, all controller classes must be named by using the "Controller" suffix.
Answer: • True
Question:* How can you restrict access to a Controller action so that only authorized users can call that action?
Answer: • Authorize attribute
Question:* What is the default view engine that comes with MVC3?
Answer: • Razor
Question:* Which of these emulators are valid mobile emulators for MVC applications?
Answer: • All of these
Question:* Which Razor construct is used to indicate a view is strongly-typed
Answer: • @model
Question:* 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: • RegularExpression
Question:* In MVC, Which represents data that you want to have displayed on viewpage?
Answer: • View Model
Question:* Which HTML Helper would you use to create a form element in a View?
Answer: • BeginForm
Question:* A controller action can return:
Answer: • All answers are correct.
Question:* What is the core process of rolling up a number of distinct resources together into a single downloadable resource in ASP.NET MVC?
Answer: • Bundling
Question:* Where is data validation done?
Answer: • Model
Question:* How do you prevent routing?
Answer: • Use ignoreroute method
Question:* What is the first filter run in a controller action?
Answer: • Authorization
Question:* 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: • Implement WebSockets protocol on the client and the server.
Question:* Which of the following protocols are not supported by WCF?
Answer: • All of these choices are supported by WCF
Question:* 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: • Display
Question:* Which namespace contains the attributes used to describe your model and it's properties?
Answer: • System.ComponentModel.DataAnnotations
Question:* 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: • AllowAnonymous attribute
Question:* How can you specify that a particular View should not use any implicitly set Layout View?
Answer: • Set the Layout property to null
Question:* What attribute is used to restrict access by callers to an action method?
Answer: • AuthorizeAttribute
Question:* How is a model passed to a controller action validated?
Answer: • ModelState.IsValid
Question:* 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: • Windows
Question:* Which class represents the result of a HTTP call to the Web API framework?
Answer: • HttpResponseMessage
Question:* Which is true about ModelState?
Answer: • It has the state of the model
Question:* What enum represents a strongly-typed collection of the HTTP Status Codes?
Answer: • HttpStatusCode
Question:* 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: • Html.Partial()
Question:* Which class represents an initial HTTP class to the Web API framework?
Answer: • HttpRequestMessage
Question:* What is the type of the ViewBag property?
Answer: • Dynamic
Question:* If you wish to include custom transformation logic in your Bundles, which interface could you implement?
Answer: • IBundleTransform
Question:* If you have a _Layout.cshtml file in your shared views, which file can you create to have custom layout for mobile platforms?
Answer: • _Layout.mobile.cshtml
Question:* 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: • VaryByParam
Question:* To accommodate large projects, ASP.NET MVC lets you partition Web applications into smaller units that are referred to as?
Answer: • Areas
Question:* [WebMethod] Attribute is required when calling an MVC Action with AJAX
Answer: • False
Question:* If you wish to create a Web API controller, what class would you derive your controller from?
Answer: • ApiController
Question:* Which class is NOT a child of ActionResult?
Answer: • CssResult
Question:* 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?
Answer: • return redirect("Cart/Add")
Question:* Tempdata is used to:
Answer: • pass data between two consecutive requests
Question:* Which class would you return from a Controller action when performing partial page updates?
Answer: • PartialViewResult
Question:* What is OutputCacheAttribute used for?
Answer: • To mark an action method whose output will be cached.
Question:* What attribute is used to handle an exception that is thrown by an action method?
Answer: • HandleErrorAttribute
Question:* ActionResult is:
Answer: • An abstract class
Question:* If you wish to leverage the OData standards for querying your REST service, what attribute could you use on your ApiController action?
Answer: • Queryable
Question:* Which of these is NOT an view engine for MVC?
Answer: • Angular
Question:* If you wish to genrate links to related resources to add hypermedia to your REST service, what class could you use?
Answer: • UrlHelper
Question:* MVC Filters can only be applied to Actions
Answer: • False
Question:* If you wish for a ApiController action to be used for many different HTTP Verbs, which attribute would you set?
Answer: • AcceptVerbs
Question:* 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: • A state server
Question:* 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: • IDependencyResolver
Question:* What class would you derive from if you wish to create a custom type for Web API's HTTP Content Negotiation?
Answer: • MediaTypeFormatter
Question:* If you want to setup custom configuration for a controller (formatters, model binders, etc.) which interface would you attribute need to implement?
Answer: • IControllerConfiguration
Question:* 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: • Aspnet_regiis.exe
Question:* If you wish to write a module for your own custom logging or message headers, which interface could you implement?
Answer: • IHttpModule
Question:* Which of the following is NOT a way to pass information from a controller to a view in ASP.NET MVC 3?
Answer: • Using a JSON object.
Question:* Which class could you use to create rules for using custom display modes?
Answer: • DisplayModeProvider
Question:* Which of these are NOT conditions in which it's recommended to use asynchronous methods?
Answer: • The operations are simple or short-running.
Question:* RenderAction method is used to:
Answer: • Run a controller action
Question:* What is ChildActionOnlyAttribute?
Answer: • Any method that is marked with ChildActionOnlyAttribute can be called only with the Action or RenderAction HTML extension methods.
Question:* Which class is used by the MVC pipeline to call a resolved controller's action as the result of a HTTP request?
Answer: • ControllerActionInvoker
Question:* Any method that is decorated with ChildActionOnlyAttribute can be called ONLY using:
Answer: • Html.Action or Html.RenderAction
Question:* When you implement your own Model Binder, what method do you have to implement?
Answer: • BindModel
Question:* Which static class could you use to enable OAuth support for clients such as Twitter & Facebook?
Answer: • OAuthWebSecurity
Question:* How do you catch unhandled action exceptions in a controller?
Answer: • In the overriden OnException method
Question:* 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: • Html.EditorForModel()
Question:* How do you prevent forgery of a request?
Answer: • Using ValidateAntiForgeryToken and Html.AntiForgeryToken helper method only.
Question:* 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: • <%: Model.FirstName %>
Question:* Which of the following is NOT a member of the UrlHelper class.
Answer: • RenderAction
Question:* Which of these is a property of OutputCache attribute?
Answer: • VaryByHeader
Question:* What is the purpose of _ViewStart.cshtml?
Answer: • To make it easy to apply the same logic to all the views under its folder and subfolders.
Question:* Where are the routing rules defined in an asp.net MVC application?
Answer: • Application_Start event in Global.asax
Question:* Recipe is available in:
Answer: • MVC4
Question:* 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: • HiddenInput
Question:* What is strongly typed?
Answer: • Only ViewData and Model
Question:* The advantage of using read-only attribute for session state is:
Answer: • Parallel access of session
Question:* What is the advantage of InProc Session Storage over the other built-in methods?
Answer: • It can store non-serialisable data.
Question:* What type of filter should be used if you want to modify the result of an action method?
Answer: • Result filter
Question:* RenderPartial method:
Answer: • Renders to the stream
Question:* Which property can you set on the BundleCollection class to indicate that you wish to enable support for CDN scripts or styles?
Answer: • UseCdn
Question:* An MVC application can have a:
Answer: • Session
Question:* An MVC Filter can only be applied as an Attribute above an Action or Controller
Answer: • False
Question:* Which method is NOT valid in the context of an MVC view?
Answer: • @RenderAction("Action")
Question:* 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: • DefaultModelBinder
Question:* 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: • Shim types
Question:* 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: • RequestContext
Question:* What is the most scalable way to share Session information in a web farm?
Answer: • AppFabric caching
Question:* What type would your Controller's action return if you wish to have an asynchronous action method that returns a View?
Answer: • Task
Question:* You are developing an ASP.NET MVC application. The application must allow users to enter JavaScript in a feedback text box only. You need to disable request validation. What should you do?
Answer: • Use the HttpRequest.Unvalidated property to read the unvalidated form value.
Question:* True or False? You can use routing and "web.config" files to secure your MVC application.
Answer: • False
Question:* ASP.NET MVC Framework implements a(n):
Answer: • Front controller pattern
No comments:
Post a Comment