- 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 - .Which of the following are valid reasons for overriding the Run method? (Choose all that apply.)
C - Managing error handling for the application
D - Starting and supporting a logging application for use by the Worker role
Answer : E
Explanation
E.Creating and running an application in parallel is what the Run method was designed to allow.The polling service is a good example of an activity in which the Run.method enables a process to work independently of the main role.Creating and running an application in parallel is what the Run method was designed to allow.
Q 2 - You are designing an ASP.NET MVC 4 application that uses an Oracle database for persistence. What session configuration choices enable you to deploy your application on a web farm? (Choose all that apply.)
Answer : E
Explanation
E.Using a shared state server across the web farm is an available option. Using a state server designates one server to maintain state for all the servers that connect to it.A custom session provider enables you to maintain state as necessary by doing the work in your custom code. It is generally used when you try to use a dif- ferent RDBMS system or when you do not want to use the default session database design.
Q 3 - What is the best way to intercept every request for an image on your site and ensure that a watermark is added to the image?
A - An HTTP module handling the AuthorizeRequest event
B - A custom HTTP handler set to handle .htm and .html pages
C - A custom HTTP handler configured to serve .png and .jpg files
D - An HTTP module handling the PostRequestHandlerExecute event
Answer : C
Explanation
C.Intercepting every request for .jpg and .png files is the easiest way to consistently add watermarks to the images.
Q 4 - You are modifying an existing ASP.NET MVC web application to incorporate mobile access. What should you do to ensure that mobile devices view mobile-only pages? (Choose all that apply.)
A - Run the Install-Package jQuery.Mobile.MVC command using the Package Manager console.
B - Create a _Layout.Mobile.cshtml master layout page.
C - Create additional views with .Mobile, such as Index.Mobile.cshtml.
Answer : E
Explanation
E.This installs all the necessary mobile packages.All mobile views and mobile master layout ensure that the page will load accordingly.
Q 5 - You have a set of requirements that expects a particular action to be accessed only through HTTPS by an authenticated user. What is the best way to meet these requirements?
A - Use the Authorize attribute before the RequireHttps filter.
B - Use the RequireHttps attribute before the Authorize filter.
Answer : B
Explanation
B.It filters out those users not on an SSL connection before performing the more resource-intensive authentication check.
Q 6 - You are working on a AJAX-heavy site, and your script files are separated in your solution by function. You have already implemented minification and bundling, but you are still getting reports of poor performance when users try to access your pages. You cannot replicate the problem locally. What additional steps can you take and still provide the same user experience?
D - There is nothing more to do without redesigning the site.
Answer : C
Explanation
C.This is an appropriate next step to try to compress the script and style files being sent to the client.
Q 7 - You will be deploying your application in Windows Azure. You know that you need to include logging, but you have some concerns. What diagnostic capabilities can Windows Azure support? (Choose all that apply.)
C - The capability to retain logs from your custom logging solution when written to a local store
Answer : E
Explanation
E.You can control the diagnostics setting through configuration within your Windows Azurehosted application.Although the Windows Azure VMs get recycled when the role restarts, saving the logs to the Windows Azure storage system outside of your VM would ensure that they are available.You can treat the Windows Azure diagnostics system like a traditional logging tool by writing messages to the system.
Q 8 - What attribute or code snippet within a controller enables a role named Admin to access actions or code blocks after the check-in code?
A - RoleProvider.GetRolesForUser("Admin")
B - [Authorize(Roles="Admin")]
C - RoleProvider.IsUserInRole(User.Name)
Answer : B
Explanation
B.The Authorize attribute handles authorization on a controller and/or action basis by using the Roles= qualifier
Q 9 - How do you encrypt the <connectionStrings> section of the Web.config file?
B - aspnet_regiis -pe "Web.Config"-app "/MachineDPAPI" -prov "RsaProtectedConfigurationProvider"
D - aspnet_regiis -pd "Web.Config" -app "/MachineDPAPI" -prov "RsaProtectedConfigurationProvider"
Answer : A
Explanation
A.This is the proper way to encrypt the <connectionStrings> setting of the Web.config file
Q 10 - Which Helper Method is used to return a user-defined content type.
Answer : A
Explanation
A.Content Helper Method is used to return a user-defined content type.