70-486: Exam Questions

Paige Gentry
Quiz by Paige Gentry, updated more than 1 year ago
Paige Gentry
Created by Paige Gentry over 4 years ago
316
0

Description

Developing ASP.NET MVC Web Applications

Resource summary

Question 1

Question
You have been instructed to meet the business requirements with regards to security. You are required to make changes to the CyclingLogController. Which of the following actions should you take?
Answer
  • A. You should consider adding code to assign users the Administrator role.
  • B. You should consider adding code to assign users the Advanced Operator role.
  • C. You should consider adding code to assign users the Author role.
  • D. You should consider adding code to assign users the Report Security Administrator role.

Question 2

Question
You have been instructed to insert a line of code into your existing code that allows for the “Distance” header of the table to be displayed in bold in the Views/CyclingLog/GetLog.cshtml view. Which of the following should be included in the line of code?
Answer
  • A. You should consider including the :first-child pseudo-class.
  • B. You should consider including the :last-child pseudo-class.
  • C. You should consider including the :nth-child pseudo-class.
  • D. You should consider including the :nth-last-child(n) pseudo-class.

Question 3

Question
You have been asked to make sure that the edit action of RunLogController is extended. You start by writing the following lines of code: [HttpPost] [ActionName (“Editlog”)] You are required to make use of a specific attribute next. Which of the following is the attribute in question?
Answer
  • A. The [ValueProviderCollection] attribute.
  • B. The [ValidateInput] attribute.
  • C. The [ValidateAntiForgeryToken] attribute.
  • D. The [ValidatableObjectAdapter] attribute.

Question 4

Question
You have been tasked with making sure that the application is configured to make use of a custom role provider, named CyclingLogRoleProvider. Which of the following actions should you take?
Answer
  • A. You should consider making changes to the machine.config file.
  • B. You should consider making changes to the app.config file.
  • C. You should consider making changes to the web.config file.
  • D. You should consider making changes to the client.config file.

Question 5

Question
You are preparing to write code that prevents invalid parameters from being distributed to the EditLog action. To achieve this, you are required to build the route in a certain way. Which of the following is a method that should be included in the code?
Answer
  • A. You should consider including the MapRoute method
  • B. You should consider including the IgnoreRoute method
  • C. You should consider including the GetVirtualPathForArea method
  • D. You should consider including the ReRoute method

Question 6

Question
You want to make sure that the application exhibits the text, “Cycling 2013”. The text should be exhibited in the footer in the last part of the _Layout.cshtml file, and should be formatted by JavaScript. You want to make sure that, based on browser support, the text is exhibited as plain text or formatted text. Which of the following actions should you take?
Answer
  • A. You should consider changing the InsertLog.cshtml view.
  • B. You should consider changing the EditLog.cshtml view.
  • C. You should consider changing the layout.
  • D. You should consider changing the _CalculateSpeed.cshtml view.

Question 7

Question
You have been tasked with creating a Communication Foundation (WCF) service that makes use of the Item class. You are informed that the Item class should be updated in such a way that it satisfies storage prerequisites. You start by marking the Item class with the DataContract attribute. Which of the following actions should you take NEXT?
Answer
  • A. You should consider making sure that the public members of the Item class is marked with the EnumMember attribute.
  • B. You should consider making sure that the private members of the Item class is marked with the DataMember attribute.
  • C. You should consider making sure that the private members of the Item class is marked with the EnumMember attribute.
  • D. You should consider making sure that the public members of the Item class is marked with the DataMember attribute.

Question 8

Question
You have received instructions to make sure that IIS errors are handled in accordance with the prerequisites. Which of the following actions should you take?
Answer
  • A. You should consider bringing the customErrors attribute in the web.config file up to date.
  • B. You should consider bringing the customErrors attribute in the machine.config file up to date.
  • C. You should consider bringing the customErrors attribute in the app.config file up to date.
  • D. You should consider bringing the customErrors attribute in the client.config file up to date.

Question 9

Question
You have been instructed to write code that creates a method for the ItemController class. The method must satisfy the prerequisites to handle exceptions related to logging. Which of the following actions should you take?
Answer
  • A. You should consider creating an OnResultExecuted method.
  • B. You should consider creating an OnAuthorization method.
  • C. You should consider creating an OnException method.
  • D. You should consider creating an OnActionExecuting method.

Question 10

Question
You have received instructions to make sure that the prerequisites with regards to the ItemId are suitably met. Which of the following actions should you take?
Answer
  • A. You should consider changing a method of ItemController.
  • B. You should consider changing a method of ItemProperty.
  • C. You should consider changing a method of ItemObject.
  • D. You should consider changing a method of ItemAttribute.

Question 11

Question
You are developing an ASP.NET MVC application that uses forms authentication. The user database contains a user named LibraryAdmin. You have the following requirements: - You must allow all users to access the GetBook method. - You must restrict access to the EditBook method to the user named LibraryAdmin. You need to implement the controller to meet the requirements. Which code segment should you use? (Select all that apply
Answer
  • A. [Authorize] public class LibraryController : Controller { [AllowAnonymous] public ActionResult GetBook(){ //... return View(); } [Authorize (Users = "LibraryAdmin")] public ActionResult EditBook(){ //... return View(); } }
  • B. [Authorize (Roles="Anonymous")] public class LibraryController : Controller { public ActionResult GetBook() { //... return View(); } [Authorize (Users = "LibraryAdmin")] public ActionResult EditBook() { //... return View(); } }
  • C. [Authorize] public class LibraryController : Controller { [AllowAnonymous] public ActionResult GetBook(){ //... return View(); } [Authorize] public ActionResult EditBook(){ if(this.HttpContext.User.Identity.Name != "LibraryAdmin") return RedirectToAction("Login", "Account", new { ReturnUrl = "/Library/EditBook"}); else { //... return View(); } } }
  • D. [Authorize] public class LibraryController : Controller { [Authorize (Roles="Anonymous")] public ActionResult GetBook() { //... return View(); } [Authorize (Users = "LibraryAdmin")] public ActionResult EditBook() { //... return View(); } }

Question 12

Question
You are developing an ASP.NET MVC application that takes customer orders. Orders are restricted to customers with IP addresses based in the United States. You need to implement a custom route handler. How should you implement the route handler? public class USOnlyRouteHandler : [blank_start]IRouteHandler[blank_end] { ____public [blank_start]IHttpHandler[blank_end] GetHttpHandler([blank_start]RequestContext[blank_end] requestContext) { ________return new USIPHandler(requestContext); ____} }
Answer
  • IRouteHandler
  • IHttpConstraint
  • IRouteFactory
  • IHttpHandler
  • RequestContext
  • ServerContext

Question 13

Question
You are designing an HTML5 website. You need to design the interface to make the content of the web page viewable in all types of browsers, including voice recognition software, screen readers, and reading pens. What should you do? (Select all that apply)
Answer
  • A. Annotate HTML5 content elements with Accessible Rich Internet Application (ARIA) attributes.
  • B. Convert HTML forms to XForms.
  • C. Ensure that HTML5 content elements have valid and descriptive names.
  • D. Use HTML5 semantic markup elements to enhance the pages.
  • E. Use Resource Description Framework (RDF) to describe content elements throughout the entire page.

Question 14

Question
You are developing an ASP.NET MVC web application in Visual Studio 2012. The application has a model named ReservationLocation that contains properties named City and State. The view that displays reservations has a single text box named loc for entering the location information. The location is entered as city, state. There are action methods that have ReservationLocation as a parameter type. You need to ensure that the City and State properties are correctly populated. How should you implement model binding for the ReservationLocation type? public class ReservationModelBinder : IModelBinder { ______public object BindModel( ControllerContext controllerContext, ModelBindingContext bindingContext) { ____________[blank_start]var raw =[blank_end] [blank_start]bindingContext.ValueProvider.GetValue[blank_end]([blank_start]"loc"[blank_end]); ____________[blank_start]dynamic data =[blank_end] [blank_start]raw.RawValue.ToString()[blank_end][blank_start].Split(',')[blank_end]; ____________return new ReservationLocation { __________________City = data[0], __________________State = data[1] ____________}; ______} }
Answer
  • var raw =
  • bindingContext.ModelType =
  • bindingContext.ModelState
  • bindingContext.ValueProvider.GetValue
  • .Add
  • typeof
  • "loc"
  • "city,state",new ModelState{Value=data}
  • ReservationLocation
  • dynamic data =
  • raw.RawValue.ToString()
  • controllerContext.RouteData
  • bindingContext.ValueProvider
  • .Split(',')
  • .Values[raw + "[city,state]"]
  • .GetValue("loc");

Question 15

Question
You are developing an ASP.NET MVC application in Visual Studio 2012. The application supports multiple cultures. The application contains three resource files in the Resources directory: - My Dictionary.resx - MyDictionary.es.resx - MyDictionary.fr.resx Each file contains a public resource named Title with localized translation. The application is configured to set the culture based on the client browser settings. The application contains a controller with the action defined in the following code segment. 1: public ActionResult GetProducts() { 2: 3: List<ProductModel> products = DataBase.DBAccess.GetProducts(); 4: return View(products); 5: } You need to set ViewBag.Title to the localized title contained in the resource files. Which code segment should you add to the action at line 02?
Answer
  • A. ViewBag.Title = HttpContext.GetGlobalResourceObject("MyDictionary", "Title");
  • B. ViewBag.Title = HttpContext.GetGlobalResourceObject("MyDictionary", "Title", new System.Globalization. CultureInfo("en"));
  • C. ViewBag.Title = Resources.MyDictionary.Title;
  • D. ViewBag.Title = HttpContext.GetLocalResourceObject("MyDictionary", "Title");

Question 16

Question
You are testing an ASP.NET application. The test plan requires that tests run against the application's business layer. You need to use the test project template that meets this requirement. Which template should you use?
Answer
  • A. Web Test Project
  • B. Load Test Project
  • C. Unit Test Project
  • D. Coded Test Project

Question 17

Question
You are developing an ASP.NET MVC web application that includes the following method. 1: public double AccountBalance( double currentBalance, double transactionAmmount ) { 2: double finalBalance = 0.00; 3: finalBalance = currentBalance + transactionAmmount; 4: return finalBalance; 5: } You need to test the AccountBalance method. Which unit test should you use?
Answer
  • A. [TestMethod()] private void AccountBalanceTest() { double currentBalance = 175.05; double trasnactionAmount = 76.03; double finalBalance = 251.08 double result = 0.00; result = AccountBalance(currentBalance, trasnactionAmount); Assert.IsEqual(finalBalance, result); }
  • B. [TestMethod()] private void AccountBalanceTest() { double currentBalance = 175.05; double trasnactionAmount = 76.03; double finalBalance = 251.08 double result = 0.00; result = AccountBalance(currentBalance, trasnactionAmount); Assert.IsTrue(finalBalance, result); }
  • C. [TestMethod()] private void AccountBalanceTest() { double currentBalance = 175.05; double trasnactionAmount = 76.03; double finalBalance = 251.08 double result = 0.00; result = AccountBalance(currentBalance, trasnactionAmount); Assert.AreEqual(finalBalance, result); }
  • D. [UnitTest()] private void AccountBalanceTest() { double currentBalance = 175.05; double trasnactionAmount = 76.03; double finalBalance = 251.08 double result = 0.00; result = AccountBalance(currentBalance, trasnactionAmount); Assert.AreEqual(finalBalance, result); }

Question 18

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. Which isolation method should you use?
Answer
  • A. T4 text templates and code generation
  • B. Stub types
  • C. Shim types
  • D. Hard-coded implementation

Question 19

Question
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?
Answer
  • 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.

Question 20

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 state information. You need to persist the application state during the session. What should you implement?
Answer
  • A. A state server
  • B. Cookieless sessions
  • C. A web garden on the web servers
  • D. An InProc session

Question 21

Question
You are designing a distributed application that runs on the Windows Azure platform. The application must store a small amount of insecure global information that does not change frequently. You need to configure the application to meet the requirements. Which server-side state management option should you use?
Answer
  • A. Windows Azure application state
  • B. SQL Azure
  • C. Profile properties of the Windows Azure application
  • D. Windows Azure session state

Question 22

Question
You are developing an ASP.NET MVC application that has pages for users who browse the site with Windows Phone 7. The pages for Windows Phone 7 include the following files: - _Layout.WP7.cshtml - Index.WP7.cshtml You need to update the application so that it renders the customized files correctly to Windows Phone 7 users. How should you update the Application_Start method? protected void Application_Start() { ______DisplayModeProvider.Instance.Modes.Insert(0, ____________new [blank_start]DefaultDisplayMode("WP7")[blank_end] { __________________ContextCondition = ( context => context.GetOverriddenUserAgent().IndexOf( ________________________[blank_start]"Windows Phone OS",[blank_end] ________________________[blank_start]StringComparison.OrdinalIgnoreCase[blank_end]) >= 0 ) __________________}); ______AreaRegistration.RegisterAllAreas(); }
Answer
  • DefaultDisplayMode("WP7")
  • DefaultDisplayMode("Mobile")
  • "Windows Phone OS",
  • "Mobile",
  • StringComparison.OrdinalIgnoreCase
  • AreaRegistration.RegisterAllDevices();

Question 23

Question
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. The CSS used to style the tiles in landscape mode is as follows. <ul class="gallery"> <li> <img src="..."/> <div>Description</div> </li> </ul> ul.gallery > li { width: 100px; } ul.gallery > li > div { display: none; } 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?
Answer
  • A. @media resolution(max-width: 500px) { . . . }
  • B. @media screen(min-width: 0px, max-width: 500px) { . . . }
  • C. @media screen and (width <= 500px) { . . . }
  • D. @media screen and (max-width: 500px) { . . . }
Show full summary Hide full summary

Similar

How to improve your SAT math score
Brad Hegarty
The SAT Math test essentials list
lizcortland
RE Keywords - Paper 1 - Religion and life
Kerris Linney
Quick tips to improve your Exam Preparation
James Timpson
Command Words
Mr Mckinlay
LOGARITHMS
pelumi opabisi
Flashcards for CPXP exam
Lydia Elliott, Ed.D
Revision Timetable
katy.lay
CCNA Security 210-260 IINS - Exam 1
Mike M
2014 GCSE History Exam Paper Setup
James McConnell
History- Home Front WW1
jessmitchell