Latest 70-515 Real Exam Download 51-60

Ensurepass

QUESTION 51

You have created an ASP.NET server control named ShoppingCart for use by other developers.

Some developers report that the ShoppingCart control does not function properly with ViewState disabled. You want to ensure that all instances of the ShoppingCart control work even if ViewState is disabled. What should you do?

A. Require developers to set EnableViewStateMac to true.

B. Store state in ControlState instead of ViewState.

C. Serialize the state into an Application state entry called "MyControl"

D. Require developers to change the session state mode to SQL Server.

Answer: B


QUESTION 52

You are troubleshooting an ASP.NET Web application.

System administrators have recently expanded your web farm from one to two servers. Users are periodically reporting an error message about invalid view state.

You need to fix the problem. What should you do?

A. Set viewStateEncryptionMode to Auto in web.config on both servers.

B. Set the machineKey in machine.config to the same value on both servers.

C. Change the session state mode to SQL Server on both servers and ensure both servers use the same connection string.

D. Override the SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium methods in the page base class to serialize the view state to a local web server file.

Answer: B


QUESTION 53

You are developing a Web page.

The user types a credit card number into an input control named cc and clicks a button named submit. The submit button sends the credit card number to the server.

A JavaScript library includes a CheckCreditCard function that returns a value of true if the credit card appears to be valid, based on its checksum.

You need to ensure that the form cannot be used to submit invalid credit card numbers to the server. What should you do?

A. Configure the input control to run on the server. On the submit button, add a server-side OnClick handler that calls CheckCreditCard and rejects the form submission if the input is invalid.

B. On the input control, add an onChange handler that calls CheckCreditCard and cancels the form submission when the input is invalid.

C. Configure the input control and the submit button to run on the server. Add a submit_OnClick handler that calls CheckCreditCard and rejects the form submission if the input is invalid.

D. On the form, add an onSubmit handler that calls CheckCreditCard and cancels the form submission if the input is invalid.

Answer: D


QUESTION 54

You are implementing an ASP.NET Web page.

You need to add a text box that allows only values between 1 and 10, inclusive, to be submitted. Which two code segments should you use? (Each correct answer presents part of the solution. Choose two.)

A. <script type="text/javascript">

function validate_value(obj, args)

{

return (args.Value >= 1 && args.Value <= 10);

}

</script>

B. <script type="text/javascript"> function validate_value(obj, args)

{

args.IsValid = (args.Value >= 1 && args.Value <= 10);

}

</script>

C. <asp:TextBox ID="txt1" runat="server" />

<asp:CustomValidator ID="val1" runat="server" ControlToValidate="txt1"

ClientValidationFunction="validate_value" ErrorMessage="Value invalid" />

D. <asp:TextBox ID="txt1" runat="server" onChange="validate_value(this, args)" />

Answer: BC


QUESTION 55

You are implementing a Web page that allows users to upload files to a Web server. The page includes a form that has a Submit button.

You want to restrict uploads so that only files smaller than 1 MB can be uploaded. What should you do?

A. Add an HTML input type="file" control.

Add an onSubmit handler to the form to check the file size and cancel the form submission if the file size is too large.

B. Add an HTML input type="file" control.

Add an onChange handler to the input control to check the file size and cancel the upload if the file size is too large.

C. Add an ASP.NET FileUpload control and configure it to run on the server.

Add a server-side OnClick handler to the form’s Submit button to save the file only if the file size is allowed

D. Add an ASP.NET FileUpload control and configure it to run on the server.

Add a server-side OnDataBinding handler that saves the file only if the file size is allowed.

Answer: C


QUESTION 56

You are dynamically adding controls to an ASP.NET page in the Page_Load event handler. The page will have text boxes that correspond to the columns in a database table.

Each text box will be preceded by a label that displays the name of the corresponding column.

You need to create the form so that when the user clicks the label, the corresponding text box is selected for input.

What should you do?

A. For each column, output the following HTML, where COL is replaced by the name of the column.

<label>COL</label>

<input name="COL" type="text" id="COL" />

B. For each column, output the following HTML, where COL is replaced by the name of the column.

<label AssociatedControlID="COL">COL</label>

<input name="COL" type="text" id="COL" />

C. For each column, create an asp:Label control and a corresponding asp:TextBox that have the same ID.

D. For each column, create an asp:Label control and set the AssociatedControlID to the ID of the corresponding asp:Textbox control.

Answer: D

You create a Web page that has an ASP.NET menu.

You need to ensure that the menu items are populated from an array of strings in your code-behind file. What should you do?

A. Write a JavaScript function that uses document.write to write out an asp:MenuItem for each string array element.

B. In the Page_Render handler, use Response.Write to write out an asp:MenuItem for each string array element.

C. Set the DataSource attribute of asp:Menu to the name of the array.

D. In the Page_Load handler, create an instance of asp:MenuItem for each string array element, and add each of these instances to the menu’s Items collection.

Answer: D


QUESTION 58

You are implementing a Web page that displays text that was typed by a user.

You need to display the user input in the Web page so that a cross-site scripting attack will be prevented. What should you do?

A. Call document.write.

B. Call Response.Write.

C. Call HttpUtility.UrlEncode.

D. Call HttpUtility.HtmlEncode.

Answer: D


QUESTION 59

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 () {

$(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 60

You are implementing an ASP.NET application that makes extensive use of JavaScript libraries. Not all pages use all scripts, and some scripts depend on other scripts.

When these libraries load sequentially, some of your pages load too slowly.

You need to use the ASP.NET Ajax Library Script Loader to load these scripts in parallel.

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A. In your site’s master page, add a call to Sys.loader.defineScripts to define each of the scripts that are used in the site.

B. In your site’s master page, add a call to Sys.loader.registerScript to define each of the scripts that are used in the site.

C. In each page that uses scripts, add a call to Sys.get for each script that is needed in that page.

D. In each page that uses scripts, add a call to Sys.require for each script that is needed in that page.

Answer: AD

Download Latest 70-515 Real Free Tests , help you to pass exam 100%.