- MVC Framework - Home
- MVC Framework - Introduction
- MVC Framework - Architecture
- MVC Framework - ASP.NET Forms
- MVC Framework - First Application
- MVC Framework - Folders
- MVC Framework - Models
- MVC Framework - Controllers
- MVC Framework - Views
- MVC Framework - Layouts
- MVC Framework - Routing Engine
- MVC Framework - Action Filters
- Advanced Example
- MVC Framework - Ajax Support
- MVC Framework - Bundling
- Exception Handling
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.
Q 1 - You are designing an application in which a section of the main page will be populated by content from a third-party provider. You do not have control over the responsiveness of the client or how much information will be returned with each request. The call is to a Restful service and will return the information formatted in Extensible Markup Language (XML). What is the best way to implement this application?
B - Put a synchronous service call into the main page controller.
Answer : A
Explanation
A.Because you do not have control over the responsiveness of the third- party provider and you do not know how much data might be returned from each call, you should wrap the call in the asynchronous framework. Providing the data in a strongly-typed model gives it more flexibility than working with the raw XML on the client side.
Q 2 - What is the technique in which the client sends a request to the server, and the server holds the response until it either times out or has information to send to the client is?
Answer : B
Explanation
B.In HTTP long polling, the client sends a request to the server, and the server holds it open until it either has something to return to the client or the con- nection times out.
Q 3 - You are creating an ASP.NET MVC web application. The application accepts phone number input through the applications form. When viewing the source from a browser, you find the following code:
PhoneNumber: <input id="text1" name="phoneNumber" size="10" type="text" value="" />What Razor syntax code segment was used?
B - @Html.EditorFor(model → model.PhoneNumber)
D - PhoneNumber: @Html.TextBox("phoneNumber", Request["phoneNumber"], new { size = 10 })
Answer : D
Explanation
D.This is the proper way to limit the size of a certain field that is being bound to the model.
Q 4 - You have been asked by the marketing department to help improve your company's ranking in search engine results. They are particularly concerned about a section of the site that is highly interactive, with extensive mouse-over color, background, and text changes. Without looking at the code, what is the most likely reason for ranking low in search engine results?
B - Content hidden in JavaScript tags
Answer : B
Explanation
B.Additional views must be created or ported to fit the smaller layout.
Q 5 - You are developing an ASP.NET MVC application. You have a set of requirements to create a help section for remote users. Your typical help scheme is help/desktop or help/mobile, so logically this section should be help/remote. The change board wants the links in the application to point to the default support site. Which code segment would you use?
B - routes.MapRoute( "remote", "help/remote",new { controller = "support", action = "Index" });
C - routes.MapRoute( "remote", "help",new { controller = "support", action = "Index" });
D - routes.MapRoute( "remote", "remote/help",new { controller = "support", action = "Index" });
Answer : B
Explanation
B.This is how you add an additional route and point to a different controller.
Q 6 - You work for a financial services company that deals with many small brokers. Your executives want to be able to run a report that details all the actions taken by the brokers on the site as a form of auditing and protection. Neither the application nor system currently stores this kind of information. Which of the following are viable solutions? (Choose all that apply.)
D - Override the AuthorizeAttribute and have it store the user, the URL, and the forms collection.
Answer : E
Explanation
E.Creating a globally applied action filter enables you to save the state of every action taken by the user while logged in to your site.By creating a globally applied action filter you have ensured that every action taken by the user will be logged.
Q 7 - You want to configure Windows Azure diagnostics. Where do you configure the specific Performance Monitors you want to have run in support of your application?
Answer : C
Explanation
C.You configure specific monitors that will run in your application in the Diagnostics.wadcfg file.
Q 8 - Why should you create a custom role provider? (Choose all that apply.)
A - To use a data source not regularly supported
B - To use the SimpleRoleProvider
C - To use a database design different than .NET provides
Answer : E
Explanation
E.Because traditional providers work only on SQL Server, accessing a differ- ent data provider such as MySQL would require a custom provider.Using a different database design would require that you create a custom provider.
Q 9 - 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.
Answer : C
Explanation
C.IrouteConstraint interface is implemented to configure default route to implement custom logic
Q 10 - Which Action Result Renders a partial view, which defines a section of a view that can be rendered inside another view?
Answer : C
Explanation
C.PartialViewResult