Q1. DRAG DROP - (Topic 4)
You are developing an ASP.NET MVC application in a web farm. The application has a page that uploads a customer's photo, resizes it, and then redirects the browser to a page where the new image is displayed along with the final dimensions.
The final dimensions should be available only to the page where the new image is displayed.
You need to store state and configure the application.
What should you do? (To answer, drag the appropriate item to the correct location. Each item may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Answer:
Q2. - (Topic 4)
You are developing a new ASP.NET MVC application that will be hosted on Microsoft Azure. You need to implement caching.
The caching solution must support the following:
The cache must be able to store out-of-process ASP.NET session state.
The cache must be able to store a variety of data types.
The cache must offer a large amount of space for cached content.
You must be able to share output cache content across web server instances.
You need to select a cache solution.
Which caching solution should you choose?
A. ASP.NET Caching
B. Azure In-Role Cache
C. Azure Redis Cache
D. Azure Managed Cache Service
Answer: C
Reference: How to Use Azure Redis Cache
https://azure.microsoft.com/sv-se/documentation/articles/cache-dotnet-how-to-use-azure-redis-cache/
Q3. DRAG DROP - (Topic 4)
You are developing an ASP.NET MVC application. The application has a view that displays a list of orders in a multi-select list box.
You need to enable users to select multiple orders and submit them for processing.
What should you do? (To answer, drag the appropriate words to the correct targets. Each word may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Answer:
Q4. - (Topic 4)
You are developing an ASP.NET MVC application by using Visual Studio.
The application throws and handles exceptions when it runs.
You need to examine the state of the application when exceptions are thrown.
What should you do?
A. Add the following code to the web.config file of the application.
<customErrors mode=”On” >
<error statusCode=”404” redirect=”CustomErrors.html” />
</customErrors>
B. From the Debug menu in Visual Studio, select Exceptions. Disable the User-unhandled
check box for Common Language Runtime Exceptions.
C. Add the following code to the web.config file of the application.
<customErrors mode=“On” >
<error statusCode=”500” redirect=”CustomErrors.html” />
</customErrors>
D. From the Debug menu in Visual Studio, select Exceptions. Enable the Thrown check
box for Common Language Runtime Exceptions.
Answer: D
Explanation: Configuring the debugger to break for first chance exceptions
To change when the debugger breaks, go to Debug->Exceptions…
When you first open this window you will see that there is a tree grid with one column and checkboxes.
*
Break when Thrown. This includes a default list of exceptions known by the debugger,
grouped by category.
Note: The possible exceptions that could break from this list is determined by the runtime
you are debugging. For example, if you are using managed-only debugging then the
debugger will never break for C++, Win32 Exceptions, etc. even if they are configured to
break when thrown.
*
Checkboxes. If you check the box for a category, then the debugger will break for all First
Chance Exceptions while debugging. If you don’t want to enable all First Chance
Exceptions, you can find the specific exception types that you wish to configure by using
the search box.
Reference: Understanding Exceptions while debugging with Visual Studio
http://blogs.msdn.com/b/visualstudioalm/archive/2015/01/08/understanding-exceptions-while-debugging-with-visual-studio.aspx
Q5. HOTSPOT - (Topic 4)
You are developing an ASP.NET MVC application. The application includes the following code. Line numbers are included for reference only.
You add the following markup to the system.web section of the web.config file:
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
Answer:
Q6. - (Topic 4)
You need to enable client-side validation for an ASP.NET MVC application.
Which three actions should you perform? Each correct answer presents part of the solution.
A. Attach a custom validation attribute to the model properties that the view uses.
B. Reference the jquery, jquery.validate and jquery.validate.unobtrusive script files in the view.
C. Open the web.config file at the project root, and set the values of the ClientValidationEnabled and UnobtrusiveJavaScriptEnabled keys to True.
D. For each form element, use the Validator.element() method to validate each item.
E. Add data annotations to the model properties that the view uses.
Answer: B,C,E
Explanation: B: . The validation can be implemented using jQuery and jQuery validation plug-in (jquery.validate.min.js and jquery.validate.unobtrusive.min.js).
C: When you are developing an MVC application in Visual Studio 2012 then the client-side
becomes enabled by default, but you can easily enable or disable the writing of the
following app setting code snippet in the web.config file.
<configuration>
<appSettings>
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
</configuration>
E: The jQuery validation plug-in takes advantage of the Data Annotation attributes defined in the model, which means that you need to do very little to start using it.
Reference: ASP.NET MVC Client Side Validation
http://www.codeproject.com/Articles/718004/ASP-NET-MVC-Client-Side-Validation
Q7. - (Topic 4)
You are developing an ASP.NET MVC application.
The application provides a RESTful API for third-party applications. This API updates the information for a contact by embedding the information in the URL of an HTTP POST.
You need to save the Contact type when third-party applications use the EditContact method.
Which code segment should you use? {Each correct answer presents a complete solution. Choose all that apply.)
A. Option A
B. Option B
C. Option C
D. Option D
Answer: B,D
Explanation: Basics of RESTful services:
REST stands for Representational State Transfer, it is a simple stateless architecture that runs over HTTP where each unique URL is representation of some resource. There are four basic design principles which should be followed when creating RESTful service:
* Use HTTP methods (verbs) explicitly and in consistent way to interact with resources
(Uniform Interface), i.e. to retrieve a resource use GET, to create a resource use POST, to
update a resource use PUT/PATCH, and to remove a resource use DELETE.
Etc.
Q8. - (Topic 4)
You are designing an enterprise-level Windows Communication Foundation (WCF) application. User accounts will migrate from the existing system. The new system must be able to scale to accommodate the increasing load.
The new servers are experiencing significant stress under load of large-scale role changes.
You need to ensure that the application can handle the stress.
Which authorizations should you redesign? (Each correct answer presents a complete solution. Choose all that apply.)
A. Role-based approach
B. Identity-based approach
C. Resource-based trusted subsystem model
D. Resource-based impersonation/delegation model
Answer: A,C
Q9. DRAG DROP - (Topic 4)
You are developing an ASP.NET MVC application in Visual Studio 2012. The application will be viewed with browsers on desktop devices and mobile devices. The application uses the Razor View Engine to display data.
The application contains two layouts located in the /Views/Shared directory.
These layouts are named:
. _Layout.cshmtl
. _MobleLayoutcshtml
The application must detect if the user is browsing from a mobile device. If the user is browsing from a mobile device, the application must use the _MobileLayout.cshtml file. If the user is browsing from a desktop device, the application must use .Layout, cs html.
You need to ensure that the application renders the layout that is appropriate for the browser.
You have the following code:
Which code segments should you include in Target 1, Target 2 and Target 3 to complete the code of the ViewStart.cshtml file? (To answer, drag the appropriate code segments to the correct targets. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Answer:
Q10. - (Topic 4)
You are designing a localized ASP.NET MVC online shopping application that will be deployed to customers in the United States, China, France, and Brazil. The application must support multiple cultures so that content in the appropriate language is available in each area.
You need to ensure that the content can be viewed in several languages.
How should you implement this feature?
A. Use a resource (.resx) file to provide translations.
B. Use Systems.Collections.Generics.Dictionary to store alternative translations.
C. Ensure that all strings are marked internal to avoid conflict with internal literals.
D. Include language-specific content in the assembly manifest and use .NET culture libraries.
Answer: A
Explanation: A resource file is an XML file that contains the strings that you want to translate into different languages or paths to images. The resource file contains key/value pairs. Each pair is an individual resource. Key names are not case sensitive. For example, a resource file might contain a resource with the key Button1 and the value Submit. You create a separate resource file for each language (for example, English and French) or for a language and culture (for example English [U.K.], English [U.S.]). Each localized resource file has the same key/value pairs; the only difference is that a localized resource file can contain fewer resources than the default resource file. The built-in language fallback process then handles loading the neutral or default resource.
Reference: SP.NET Web Page Resources Overview
Q11. - (Topic 4)
You are developing an application that uses many small images.
When the images load, the application runs slowly.
You need to improve the performance of the application.
What should you do?
A. Preload all the images when the application starts to ensure that the images are cached.
B. Convert the images to ICO file format and stream all images on a single connection.
C. Host all images on a Microsoft Azure web role with multiple instances.
D. Combine all the images into a single image and use CSS to create sprites.
Answer: D
Explanation: Because browsers limit how many concurrent HTTP requests they make to a website, a web page with many small icon images can result in a longer load time. You can combine many small images into a single larger image - a CSS sprite - using the free ASP.NET Sprite and Image Optimization Library available from Microsoft.
Reference: CSS Sprites and the ASP.NET Sprite and Image Optimization Library
http://dotnetslackers.com/articles/aspnet/CSS-Sprites-and-the-ASP-NET-Sprite-and-Image-Optimization-Library.aspx
Q12. DRAG DROP - (Topic 4)
You are developing an ASP.NET MVC application that authenticates a user by using claims-based authentication.
The application must:
. Use Windows Identity Foundation 4.5.
. Support the Windows Azure Access Control Service.
You need to implement authentication.
How should you build the class constructor? (To answer, drag the appropriate code segment to the correct location or locations in the answer area. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Answer:
Q13. DRAG DROP - (Topic 4)
You are developing an ASP.NET web application that uses health monitoring to log events to the Windows Event Log. The application contains a custom event that is defined in the following code segment. Line numbers are included for reference only.
You need to ensure that the event is correctly added to the Windows event log.
How should you complete the relevant code? To answer, drag the appropriate code segment to the correct location or locations. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.
Answer:
Q14. - (Topic 4)
You are developing an ASP.NET MVC web application for viewing a photo album. The application is designed for devices that support changes in orientation, such as tablets and smartphones. The application displays a grid of photos in portrait mode.
When the orientation changes to landscape, each tile in the grid expands to include a description. The HTML that creates the gallery interface resembles the following markup.
If this CSS is omitted, the existing CSS displays the tiles in landscape mode.
You need to update the portrait mode CSS to apply only to screens with a width less than 500 pixels.
Which code segment should you use?
A. @media resolution(max-width: 500px) {
. . .
}
B. @media screen(min-width: Opx, max-width: 500px) {
. . .
}
C. @media screen and (width <= 500px) {
. . .
}
D. @media screen and (max-width: 500px) {
. . .
}
Answer: D
Q15. - (Topic 4)
You are developing an ASP.NET MVC application by using Visual Studio 2012.
The application throws and handles exceptions when it runs.
You need to examine the state of the application when exceptions are thrown.
What should you do?
A. From the Debug menu in Visual Studio 2012, select Exceptions. Enable the Thrown check box for Common Language Runtime Exceptions.
B. From the DEBUG menu in Visual Studio 2012, select Attach to Process. Select the IIS process.
C. From the Debug menu in Visual Studio 2012, select Exceptions. Disable the User-unhandled check box for Common Language Runtime Exceptions.
D. From the TOOLS menu in Visual Studio 2012, click Customize. C!ic< tie Commands tab and select Debug.
Answer: A
Q16. - (Topic 4)
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?
A. ASP.NET session state
B. A local database
C. A state server
D. Profile properties
Answer: C