The Safer, Easier Way To Help You Pass Any IT Exams
The Safer, Easier Way To Help You Pass Any IT Exams
www.testinexam.com 1 / 6
QUESTION 1 You are implementing an ASP.NET MVC 2 Web application that contains several folders. The Views/ Shared/DisplayTemplates folder contains a templated helper named Score.ascx that performs custom formatting of integer values. The Models folder contains a class named Player with the following definition. public class Player { public String Name { get; set; } public int LastScore { get; set; } public int HighScore { get; set; } } You need to ensure that the custom formatting is applied to LastScore values when the HtmlHelper. DisplayForModel method is called for any view in the application that has a model of type Player. What should you do? A. Rename Score.ascx to LastScore.ascx. B. Move Score.ascx from the Views/Shared/DisplayTemplates folder to the Views/Player/ DisplayTemplates folder. C. Add the following attribute to the LastScore property. [UIHint("Score")] D. Add the following attribute to the LastScore property. [Display(Name="LastScore", ShortName="Score")] Answer: C QUESTION 2 You are implementing an ASP.NET MVC 2 Web application. A controller contains the following code. public ActionResult Edit(int id) { return View(SelectUserToEdit(id)); } public ActionResult Edit(Person person) { UpdateUser(person); return RedirectToAction("Index"); } The first Edit action displays the user whose details are to be edited, and the second Edit action is called when the Save button on the editing form is clicked to update the user details. An exception is thrown at run time stating that the request for action Edit is ambiguous. You need to correct this error and ensure that the controller functions as expected. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.) A. Add the following attribute to the first Edit action. [AcceptVerbs(HttpVerbs.Head)] B. Add the following attribute to the first Edit action. [HttpGet] C. Add the following attribute to the second Edit action. [HttpPost] D. Add the following attribute to the second Edit action. [HttpPut] Answer: BC
www.testinexam.com 2 / 6
QUESTION 3 You are implementing an ASP.NET application that uses data-bound GridView controls in multiple pages. You add JavaScript code to periodically update specific types of data items in these GridView controls. You need to ensure that the JavaScript code can locate the HTML elements created for each row in these GridView controls, without needing to be changed if the controls are moved from one pa to another. What should you do? A. Replace the GridView control with a ListView control. B. Set the ClientIDMode attribute to Predictable in the web.config file. C. Set the ClientIDRowSuffix attribute of each unique GridView control to a different value. D. Set the @ OutputCache directive's VaryByControl attribute to the ID of the GridView control. Answer: C QUESTION 4 You create a Web page that contains the following image element. <img id="myImage" src="/image1.png" /> You need to write a JavaScript function that will dynamically change which image is displayed. Which code segment should you use? A. function changeImage() { myImage.src = "image2.png"; } B. function changeImage() { document.getElementById("myImage").src = "image2.png"; } C. function changeImage() { getElementById("myImage").src = "image2.png"; } D. function changeImage() { window.getElementById("myImage").src = "image2.png"; } Answer: B QUESTION 5 You are implementing an ASP.NET MVC 2 Web application that allows users to view and edit data. You need to ensure that only logged-in users can access the Edit action of the controller. What are two possible attributes that you can add to the Edit action to achieve this goal? (Each correct answer presents a complete solution. Choose two.) A. [Authorize(Users = "")] B. [Authorize(Roles = "")] C. [Authorize(Users = "*")] D. [Authorize(Roles = "*")] Answer: AB QUESTION 6 You are implementing an ASP.NET AJAX page. You add the following control to the page. <asp: UpdatePanel ID="pnl1" runat="server" UpdateMode="Conditional"> <ContentTemplate> ... </ ContentTemplate> </asp:UpdatePanel> You need update the contents of the UpdatePanel without causing a full reload of the page. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) A. Add the following control before the UpdatePanel. <asp:Timer ID="Timer1" OnLoad="Timer1_Tick" runat="server" Interval="3000" />
www.testinexam.com 3 / 6
B. Add the following control within the UpdatePanel. <asp:Timer ID="Timer1" OnLoad="Timer1_Tick" runat="server" Interval="3000" /> C. Add an AsyncPostBackTrigger that references Timer1. D. Add a PostBackTrigger that references Timer1. Answer: BC QUESTION 7 You create a Web page that contains drop-down menus that are defined by using div tags in the following code. <div class="dropdown-menu"> <div class="menu-title">Menu One</div> <div class="menu-items" style="display:none;"> <div><a href="#">Item One</a></div> <div><a href="#">Item Two</a></div> </div> </div> <div class="dropdown-menu"> <div class="menu-title">Menu Two</div> <div class="menu-items" style="display:none;"> <div><a href="#">Item Three</a></div> <div><a href="#">Item Four</a></div> </div> </div> You need to write a JavaScript function that will enable the drop-down menus to activate when the user positions the mouse over the menu title. Which code segment should you use? A. $(".dropdown-menu").hover( function () { $(".menu-items").slideDown(100); }, function () { $(".menu-items").slideUp(100); } ); B. $(".dropdown-menu").hover( function () { $(".menu-items", this).slideDown(100); }, function () { $(".menu-items",this).slideUp(100); } ); C. $(".dropdown-menu").hover( function () {
www.testinexam.com 4 / 6
$(this)".slideDown(100); }, function () { $(this).slideUp(100); } ); D. $(".dropdown-menu").hover( function () { $("this,".menu-title",).slideDown(100); }, function () { $("this.menu-title",).slideUp(100); } ); Answer: B QUESTION 8 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 contain 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. B. Add the Bind attribute to the country parameter of the Details action method. Set the attribute's Prefix property to Country. C. Create a class that implements the IRouteConstraint interface. Configure the default route to use this class. D. Create a class that implements the IRouteHandler interface. Configure the default route to use this class. Answer: C QUESTION 9 You create a Web page that contains the following code. <script type="text/javascript"> var lastId = 0; </script> <div class="File"> Choose a file to upload: <input id="File0" name="File0" type="file" /> </div> <input id="AddFile" type="button" value="Add a File" /> <input id="Submit" type="submit" value="Upload" /> You need to provide the following implementation.
www.testinexam.com 5 / 6
?Each time the AddFile button is clicked, a new div element is created. ?The new div element is appended after the other file upload div elements and before the AddFile span. ?Each new element has a unique identifier. Which code segment should you use? A. $("#AddFile").click(function () { var id = "File" + ++lastId; var item = $(".File:first").clone(true); $("input:file", item).attr({ id: id, name: id }); item.insertBefore("#AddFile"); }); B. $("#AddFile").click(function () { var id = "File" + ++lastId; $(".File:first").clone(true) .attr({ id: id, name: id }) .insertBefore("#AddFile"); }); C. $("#AddFile").click(function () { var id = "File" + ++lastId; }); D. $("#AddFile").click(function () { var id = "File" + ++lastId; var item = $(".File:first").clone(true) $("input:file", item).attr({ id: id, name: id }); item.insertAfter("input[type=file]"); }); Answer: A QUESTION 10 You are creating an ASP.NET Web application that uses the SqlMembershipProvider. You plan to test locally and deploy to multiple production servers. You need to ensure that each deployed application accesses the same production database in Microsoft SQL Server. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) A. Run the aspnet_regsql command to create the database on the appropriate SQL Server computer. B. Right-click App_Data in your Visual Studio 2010 project, click Add, and select New Item to create the SQL Server database on the appropriate SQL Server computer. C. Modify the connection string in the web.config file to specify the names of the production server and database. D. Modify the web.release.config file to transform the connection string to specify the names of the production server and database. Answer: AD
www.testinexam.com 6 / 6