Ensurepass.com : Ensure you pass the IT Exams
2018 Aug Microsoft Official New Released 70-486
100% Free Download! 100% Pass Guaranteed!
Developing ASP.NET MVC 4 Web Applications
Question No: 131 – (Topic 4)
You are developing an ASP.NET MVC application. The application includes the following HomeController class. Line number are included references only.
During testing, all errors display an ASP.NET error page instead of the expected error view.
-
Replace line 01 with the following code segment: [HandleError(View=鈥滶rror鈥?]
-
in the web.config file, set the value of the customErrors property to On.
-
Replace line 01 with the following code: [HandleError(ExceptionType=typeof(SystemException))]
-
Create a custom error page named Error.aspx. Save the file in the Views\Shared folder for the project.
Answer: D
Question No: 132 – (Topic 4)
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?
-
Aspnet_regiis.exe
-
Ngen.exe
-
Aspnet_merge.exe
-
EdmGen.exe
Answer: A Explanation:
References: http://msdn.microsoft.com/en-us/library/zhhddkxy(v=vs.100).aspx
Question No: 133 DRAG DROP – (Topic 4)
DRAG DROP
You are developing an ASP.NET MVC application in Visual Studio. The application contains sensitive bank account data.
The application contains a helper class named SensitiveData.Helpers.CustomEncryptor.
The application contains a controller named BankAccountController with two actions.
The application contains a model named BankAccount, which is defined in the following code segment.
The application must not display AccountNumber in clear text in any URL. You need to build the view for the GetAccounts action.
You have the following code:
Which code segments should you include in Target 1, Target 2 and Target 3 to build the view? To answer, drag the appropriate code segment 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:
Explanation:
Target1: maskedAccountNum Target2: custEncrypt
Target3: Encrypt(item.AccountNumber) SensitiveData.Helpers
Question No: 134 – (Topic 4)
You are developing an ASP.NET MVC application.
The application must allow users to enter HTML in a feedback text box only. You need to disable request validation.
What should you do?
-
Use the HttpRequest.Form property to read the unvalidated form value.
-
Apply and set the Validatelnput attribute on the controller action to FALSE.
-
Use the HttpRequest.Unvalidated property to read the unvalidated form value.
-
Apply and set the CausesValidation attribute on the controller action to FALSE.
Answer: C Explanation:
The HttpRequest.Unvalidated Property provides access to HTTP request values without triggering request validation.
Question No: 135 DRAG DROP – (Topic 4)
You need to ensure that URLs for log manipulation are mapped to the controller. You have the following code:
Which code segments should you include in Target 1 and Target 2 to map the URLs? 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 need to drag the split bar between panes or scroll to view content.
Answer:
Explanation:
Target 1: routes.MapRoute(
The MapRoute method takes three parameters: routes, name, and URL. Target 2: url: quot;GetLog/{action}/{id}quot;,
Examplecode: routes.MapRoute( quot;Defaultquot;, // Route name
quot;{controller}/{action}/{id}quot;, // URL with parameters
new { controller =quot;Homequot;, action = quot;Indexquot;, id = quot;quot; } // Parameter defaults
);
Incorrect:
Not routes.MapHttpRoute(:
The MapHttpRoute method takes three parameters: routes, name, and routetemplate, but we need an URL parameter, not a routeTemplate parameter.
References: https://msdn.microsoft.com/en-
us/library/system.web.mvc.routecollectionextensions.maproute(v=vs.118).aspx https://msdn.microsoft.com/en-us/library/cc668201.aspx
Question No: 136 DRAG DROP – (Topic 4)
DRAG DROP
You plan a new ASP. NET MVC application.
The application uses the Model-View Controller (MVC) pattern to separate the modeling of the domain, the presentation, and the actions. This separation is based on user input into three separate classes.
You need to diagram the structural relationship between the three classes.
What should you do? To answer, drag the appropriate class to the correct location or locations. Each class name 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:
Explanation:
Graphically, MVC can be shown like on image bellow:
References: http://www.beansoftware.com/ASP.NET-Tutorials/Intro-ASP.NET-MVC.aspx
Question No: 137 – (Topic 4)
You are designing an MVC web application.
You need to combine two existing models to create a view. Which MVC component should you use?
-
View
-
Controller
-
Model
-
ViewModel
Answer: D
Question No: 138 – (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?
-
@media resolution(max-width: 500px) {. . .}
-
@media screen(min-width: Opx, max-width: 500px) {. . .}
-
@media screen and (width lt;= 500px) {. . .}
-
@media screen and (max-width: 500px) {. . .}
Answer: D Explanation:
Screen is used for computer screens, tablets, smart-phones etc.
max-width is the maximum width of the display area, such as a browser window. References: http://www.w3schools.com/cssref/css3_pr_mediaquery.asp
Question No: 139 HOTSPOT – (Topic 4)
HOTSPOT
You are using the features of the IIS SEO Toolkit to configure the website. You need to exclude search engines from indexing parts of website.
What should you do? (To answer, select the appropriate option from the drop-down list in the answer area.)
Answer:
Question No: 140 HOTSPOT – (Topic 4)
HOTSPOT
You are developing an ASP.NET MVC web application that enables users to open
Microsoft Excel files.
The current implementation of the ExcelResult class is as follows.
You need to enable users to open Excel files. You have the following code:
Which code segments should you include in Target 1, Target 2 and Target 3 to implement the ExecuteResult method? To answer, select the appropriate option or options in the answer area.
Answer:
Explanation:
Target 1:
Name: AcceptTypes
Synopsis: stringArray = Request.AcceptTypes
Return s a String array containing the Multipurpose Internet Mail Extension (MIME) types accepted by the client. You can use this property to determine whether a client can accept certain response types, including application types such as Word or Excel, which are supported only by Internet Explorer.
Target 2, Target 3:
Example: Response.AddHeader(quot;content-dispositionquot;, quot;attachment; filename=MyExcelFile.xlsquot;); Response.ContentType = quot;application/ms-excelquot;;
References: