[Free] Get all latest Microsoft 70-515 Actual Tests 51-60

Ensurepass

QUESTION 51

You are implementing an ASP.NET Dynamic Data Web site. The Web site includes a data context that enables automatic scaffolding for all tables in the data model.

 

The Global.asax.vb file contains the following code segment.

 

Public Shared Sub RegisterRoutes(ByVal routes As RouteCollection)

 

routes.Add(New DynamicDataRoute(“{table}/ListDetails.aspx”) _

 

With

 

{

 

.Action = PageAction.List,

 

.ViewName = “ListDetails”,

 

.Model = DefaultModel

 

})

 

routes.Add(New DynamicDataRoute(“{table}/ListDetails.aspx”) _

 

With

 

{

 

.Action = PageAction.Details,

 

.ViewName = “ListDetails”,

 

.Model = DefaultModel

 

})

 

End Sub

 

You need to display the items in a table named Products by using a custom layout.

 

What should you do?

 

A.

Add a new Web page named Products.aspx to the Dynamic DataPageTemplates folder of the Web site.

B.

Add a new folder named Products to the Dynamic DataCustomPages folder of the Web site. Add a new Web page named ListDetails.aspx to the Products folder.

C.

Add a new Web user control named Products.ascx to the Dynamic DataFilters folder of the Web site. In the code-behind file for the control, change the base class from UserControl to System.Web.DynamicData.QueryableFilterUserControl.

D.

Add a new Web user control named Products_ListDetails.ascx to the Dynamic DataEntityTemplates folder of the Web site. In the code-behind file for the control, change the base class from UserControl to System.Web.DynamicData.EntityTemplateUserControl.

 

Correct Answer: B

 

 

QUESTION 52

You are implementing an ASP.NET Web site. The site allows users to explicitly choose the display language for the site# s Web pages. You create a Web page that contains a DropDownList named ddlLanguage, as shown in the following code segment.

 

<asp:DropDownList ID=”ddlLanguage” runat=”server” AutoPostBack=”True” ClientIDMode=”Static” OnSelectedIndexChanged=”SelectedLanguageChanged”>

 

<asp:ListItem Value=”en”>English</asp:ListItem>

 

<asp:ListItem Value=”es”>Spanish</asp:ListItem>

 

<asp:ListItem Value=”fr”>French</asp:ListItem>

 

<asp:ListItem Value=”de”>German</asp:ListItem>

 

</asp:DropDownList>

 

The site contains localized resources for all page content that must be translated into the language that is selected by the user.

 

You need to add code to ensure that the page displays content in the selected language if the user selects a language in the drop-down list.

 

Which code segment should you use?

 

A.

Protected Sub SelectedLanguageChanged(ByVal sender As Object,

ByVal e As EventArgs) Handles ddlLanguage.SelectedIndexChanged

Page.UICulture = ddlLanguage.SelectedValue

End Sub

B.

Protected Overrides Sub InitializeCulture()

Page.UICulture = Request.Form(“ddlLanguage”)

End Sub

C.

Protected Sub Page_Load(ByVal sender As Object,

ByVal e As System.EventArgs) Handles Me.Load

Page.Culture = Request.Form(“ddlLanguage”)

End Sub

D.

Protected Overrides Sub InitializeCulture()

Page.Culture = ddlLanguage.SelectedValue

End Sub

 

Correct Answer: B

Explanation:

 

 

 

QUESTION 53

You are implementing a read-only page that includes the following controls.

 

clip_image002

 

You disable view state to improve performance. You need to ensure that the page is updated to display the latest data when the user clicks the refresh button.

 

Which code segment should you use?

 

A.

Private Sub Page_PreInit(ByVal sender As Object,

ByVal e As System.EventArgs) Handles Me.PreInit

If Not IsPostBack Then

gvCustomers.DataSource = GetCustomers()

gvCustomers.DataBind()

End If

End Sub

B.

Protected Sub Page_Load(ByVal sender As Object,

ByVal e As System.EventArgs) Handles Me.Load

gvCustomers.DataSource = GetCustomers()

gvCustomers.DataBind()

End Sub

C.

Private Sub gvCustomers_DataBinding(ByVal sender As Object,

ByVal e As System.EventArgs) Handles gvCustomers.DataBinding

gvCustomers.DataSource = GetCustomers()

gvCustomers.DataBind()

End Sub

D.

Private Sub Page_PreRender(ByVal sender As Object,

ByVal e As System.EventArgs) Handles Me.PreRender If Not IsPostBack Then

gvCustomers.DataSource = GetCustomers()

gvCustomers.DataBind()

End If

End Sub

 

Correct Answer: B

 

 

QUESTION 54

You are implementing an ASP.NET application that includes the following requirements. Retrieve the number of active bugs from the cache, if the number is present. If the number is not found in the cache, call a method named GetActiveBugs, and save the result under the ActiveBugs cache key. Ensure that cached data expires after 30 seconds. You need to add code to fulfill the requirements. Which code segment should you add?

 

A.

Dim numOfActiveBugs As Integer? = DirectCast(Cache(“ActiveBugs”), Integer?)

If Not numOfActiveBugs.HasValue Then

Dim result As Int32 = GetActiveBugs()

Cache.Insert(“ActiveBugs”, result, Nothing, DateTime.Now.AddSeconds(30),

Cache.NoSlidingExpiration)

numOfActiveBugs = result

End If

ActiveBugs = numOfActiveBugs.Value

B.

Dim numOfActiveBugs As Integer = CInt(Cache.Get(“ActiveBugs”))

If numOfActiveBugs <> 0 Then

Dim result As Integer = GetActiveBugs()

Cache.Insert(“ActiveBugs”, result, Nothing,

DateTime.Now.AddSeconds(30), Cache.NoSlidingExpiration)

numOfActiveBugs = result

End If

ActiveBugs = numOfActiveBugs

C.

Dim numOfActiveBugs As Integer = 0

If Cache(“ActiveBugs”) Is Nothing Then

Dim result As Integer = GetActiveBugs()

Cache.Add(“ActiveBugs”, result, Nothing, DateTime.Now.AddSeconds(30),

Cache.NoSlidingExpiration,

CacheItemPriority.Normal, Nothing)

numOfActiveBugs = result

End If

ActiveBugs = numOfActiveBugs

D.

Dim numOfActiveBugs? As Integer =

DirectCast(Cache(“ActiveBugs”), Integer?)

If Not numOfActiveBugs.HasValue Then

Dim result As Integer = GetActiveBugs()

Cache.Insert(“ActiveBugs”, result, Nothing, Cache.NoAbsoluteExpiration,

TimeSpan.FromSeconds(30))

numOfActiveBugs = result

End If

ActiveBugs = numOfActiveBugs.Value

 

Correct Answer: A

Explanation:

 

 

QUESTION 55

You create a custom server control named Task that contains the following code segment.

(Line numbers are included for reference only.)

 

01 Namespace DevControls

 

03 Public Class Task

 

04 Inherits WebControl

 

06 <ComponentModel.DefaultValue(“”)>

 

07 Public Property Title As String

 

09 Protected Overrides Sub RenderContents(

 

10 ByVal output As HtmlTextWriter)

 

12 output.Write(Title)

 

13 End Sub

 

15 End Class

 

17 End Namespace

 

You need to ensure that adding a Task control from the Toolbox creates markup in the following format.

 

<Dev:Task ID=”Task1″ runat=”server” Title=”New Task” />

 

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

 

A.

Add the following code segment to the project’s AssemblyInfo.vb file.

<Assembly: TagPrefix(“DevControls”, “Dev”)>

B.

Replace line 06 with the following code segment.

<ComponentModel.DefaultValue(“New Task”)>

C.

Insert the following code segment immediately before line 03.

<ToolboxData(“<{0}:Task runat=””server”” Title=””New Task”” />”)>

D.

Replace line 12 with the following code segment.

output.Write(“<Dev:Task runat=””server”” Title=””New Task”” />”)

 

Correct Answer: AC

Explanation:

CHAPTER 7 Creating Custom Web Controls

Lesson 2: Creating Custom Web Server Controls

Controlling the Markup Generated for Your Custom Web Server Control (page 369)

 

 

QUESTION 56

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.

 

Correct Answer: AD

Explanation:

The ASP.NET Ajax Library’s Script Loader provides a flexible way to load scripts required by a page as well as any dependencies that may be needed. Because it loads scripts in parallel the page’s load time is minimized and the amount of code needed to load scripts, their dependencies and components is significantly reduced. To load ASP.NET Ajax Library or jQuery scripts a collection called Sys.scripts (defined in the ASP.NET Ajax

Library’s Start.js file) can be used along with a call to Sys.require. In cases where a custom script has dependencies on one or more scripts a custom metadata file can be created to define the dependencies. This metadata file can define all the scripts involved using the Script Loader’s Sys.loader.defineScripts function. The metadata script defines the custom scripts to load as well as any dependencies they may have.

HOW TO Load Required Scripts

(http://www.asp.net/ajaxLibrary/HOW%20TO%20Load%20Required%20Scripts.ashx) HOW TO Load a Custom Script with Dependencies

(http://www.asp.net/ajaxlibrary/HOW%20TO%20Load%20a%20Custom%20Script%20with %20Dependencies.ashx)

 

 

QUESTION 57

You are implementing an ASP.NET page. You add asp:Button controls for Help and for Detail. You add an ASP.NET skin file named default.skin to a theme. You need to create and use a separate style for the Help button, and you must use the default style for the Detail button. What should you do?

 

A.

Add the following markup to the default.skin file.

<asp:Button ID=”Help”></asp:Button>

<asp:Button ID=”Default”></asp:Button>

Use the following markup for the buttons in the ASP.NET page.

<asp:Button SkinID=”Help”>Help</asp:Button>

<asp:Button SkinID=”Default”>Detail</asp:Button>

B.

Add the following markup to the default.skin file.

<asp:Button SkinID=”Help”></asp:Button>

<asp:Button ID=”Default”></asp:Button>

Use the following markup for the buttons in the ASP.NET page.

<asp:Button SkinID=”Help”>Help</asp:Button>

<asp:Button SkinID=”Default”>Detail</asp:Button>

C.

Add the following code segment to default.skin.

<asp:Button SkinID=”Help”></asp:Button>

<asp:Button></asp:Button>

Use the following markup for the buttons in the ASP.NET page.

<asp:Button SkinID=”Help”></asp:Button>

<asp:Button SkinID=”Default”>Detail</asp:Button>

D.

Add the following markup to default.skin.

<asp:Button SkinID=”Help”></asp:Button>

<asp:Button></asp:Button>

Use the following markup for the buttons in the ASP.NET page.

<asp:Button SkinID=”Help”>Help</asp:Button>

<asp:Button>Detail</asp:Button>

 

Correct Answer: D

 

 

QUESTION 58

A Web page includes the HTML shown in the following code segmen <span id=”ref”>

 

<a name=Reference>Check out</a>

 

the FAQ on

 

<a href=”http://www.contoso.com”>

 

Contoso</a>’s web site for more information:

 

<a href=”http://www.contoso.com/faq”>FAQ</a>.

 

</span>

 

<a href=”http://www.contoso.com/home”>Home</a>

 

You need to write a JavaScript function that will dynamically format in boldface all of the hyperlinks in the ref span.

 

Which code segment should you use?

 

A.

$(“#ref”).filter(“a[href]”).bold();

B.

$(“ref”).filter(“a”).css(“bold”);

C.

$(“a”).css({fontWeight:”bold”});

D.

$(“#ref a[href]”).css({fontWeight:”bold”});

 

Correct Answer: D

Explanation:

css() Method

(http://api.jquery.com/css/)

 

 

QUESTION 59

You create an ASP.NET page. The page uses the jQuery $.ajax function to make calls back to the server in several places.

 

You add the following div element to the page.

 

<div id=”errorInfo”>

 

</div>

 

You need to implement a single error handler that will add error information from all page $.ajax calls to the div named errorInfo.

 

What should you do?

 

A.

Add the following options to each $.ajax function call:

global: true,

error: function (XMLHttpRequest, textStatus, errorThrown){ $(“#errorInfo”).text(“<li>Error information is: ” + textStatus + “</li>”);

B.

Add the following code to the $(document).ready function on the page:

$(“#errorInfo”).ajaxError(function(event, request, settings){ $(this).append(“<li>Error requesting page ” + settings.url + “</li>”); });

C.

Add the following option to each $.ajax function call:

error: function (XMLHttpRequest, textStatus, errorThrown){ $(“#errorInfo”).text(“<li>Error information is: ” + textStatus + “</li>”);

}

D.

Add the following code to the $(document).ready function on the page:

$.ajaxError(function(event, request, settings){

$(this).append(“<li>Error requesting page ” + settings.url + “</li>”);});

Add the following option to each $.ajax function call:

global: true

 

Correct Answer: B

 

 

QUESTION 60

You create a Web page that contains the span shown in the following line of code.

 

<span id=”span1″>Text</span>

 

You need replace the contents of the span with HTML that you download from a URL specified by a global variable named localURL.

 

Which code segment should you use?

 

A.

$.ajax({

type: “GET”,

url: localURL,

dataType: “jsonp”,

success: function(htmlText) {

$(“#span1”).text(htmlText);

}}

);

B.

$.ajax(localURL, {},

function(htmlText) {

$(“#span1”).html(htmlText);

},

“html”);

C.

$.ajax({

type: “GET”,

url: localURL,

dataType: “html”,

success: function(htmlText) {

$(“#span1”).innerHTML = htmlText;

}}

);

D.

$.ajax({

type: “GET”,

url: localURL,

success: function(htmlText) {

$(“#span1”).html(htmlText);

}}

);

 

Correct Answer: D

Explanation:

CHAPTER 9 Working with Client-Side Scripting, AJAX, and jQuery Lesson 3: Implementing jQuery

Implementing AJAX with jQuery (page 536)

 

Instant Access to Download Testing Software & PDF File for Microsoft 70-515 Real Exam

Instant Access to Try Microsoft 70-515 Free Demo

This entry was posted in 70-515 Actual Tests and tagged , , , , , . Bookmark the permalink.