Microsoft TS: Web Applications Development with Microsoft .NET Framework 4 - 070-515 Exam Practice Test

Question 1
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?

Correct Answer: B
Question 2
You are developing an ASP.NET web application.
The application includes a class library named Contoso.dll that will be used by other ASP.Net applications
on the same server.
You need to ensure that only one copy of the class library exists on the server.
What should you do?

Correct Answer: B
Question 3
Which property of the ListView class is used to get\set the name of the data field whose value exclusively identifes every data row of a ListView when the ClientIDMode property is set to Predictable?

Correct Answer: A
Question 4
Which method of the ChildActionExtensions class calls a child action method and renders the result inline in the parent view?

Correct Answer: D
Question 5
You are developing an ASP.Net MVC 2 view and controller.
The controller includes an action method that retrieves rows from a Product table in Microsoft SQL Server
database.
You need to cache the data that the action method returns.
What should you do?

Correct Answer: D
Question 6
You are developing an ASP.NET MVC2 view and controller.
The application includes a class names Employee that has a LastName property. The controller requires an
action method that will insert an Employee
instance into a database.
You need to ensure that the data that is submitted is an Employee instance and that a LastName value is
given.
What should you do?

Correct Answer: B
Question 7
You are implementing an ASP.NET Web site. The site contains the following class.
public class Address
{ public int AddressType; public string Line1; public string Line2; public string City; public string ZipPostalCode;
}
The Web site interacts with an external data service that requires Address instances to be given in the following XML format.
<Address AddressType="2"> <Line1>250 Race Court</Line1> <City>Chicago</City> <ZipCode>60603</ZipCode>
</Address>
You need to ensure that Address instances that are serialized by the XmlSerializer class meet the XML
format requirements of the external data service.
Which two actions should you perform (Each correct answer presents part of the solution. Choose two.)

Correct Answer: B,C
Question 8
You are developing an ASP.NET Web page. You add the following markup to the page.
<asp:FileUpload id="FileUpload1" runat="server" />
<asp:Button id="btnUpload" Text="Upload selected file"
OnClick="btnUpload_Click" runat="server" />
<asp:Label id="lblFeedback" runat="server" />
You add the following code segment to the code-behind. (Line numbers are included for reference only.)
01 protected void btnUpload_Click(object sender, EventArgs e)
02 {
03 if (...)
04 {
05 string saveName = Path.Combine(@"c:\uploadedfiles\",
FileUpload1.FileName);
06
07 lblFeedback.Text = "File successfully uploaded.";
08 }
09 else
10 {
11 lblFeedback.Text = "File upload failed.";
12 }
13 }
You need to save the uploaded file and display a message to the user that indicates that the upload either
succeeded or failed.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

Correct Answer: A,B
Question 9
Which tool is used to simplify the migration, management and deployment of IIS Web servers, Web applications and Web sites?

Correct Answer: C
Question 10
You are implementing an ASP.NET AJAX page that contains two div elements.
You need to ensure that the content of each div element can be refreshed individually, without requiring a
page refresh.
What should you do?

Correct Answer: B
Question 11
Which directive defines master page-precise attributes that are used by the ASP.NET page parser and compiler?

Correct Answer: B
Explanation: Only visible for Actualtests4sure members. You can sign-up / login (it's free).
Question 12
You are developing an ASP.NET MVC 2 Web application.
A page makes an AJAX request and expects a list of company names in the following format.
["Adventure Works","Contoso"]
You need to write an action method that returns the response in the correct format. Which type should you return from the action method?

Correct Answer: D
Question 13
You are developing an ASP.NET Web page. The page contains the following markup.
<asp:GridView ID="gvModels" runat="server" onrowdatabound="gvModels_RowDataBound" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Model" />
<asp:TemplateField>
<ItemTemplate> <asp:Image ID="img" runat="server" /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView>
The pages code-behind file includes the following code segment. (Line numbers are included for reference only.)
01 protected void gvModels_RowDataBound(object sender, GridViewRowEventArgs e)
02 {
03 if (e.Row.RowType == DataControlRowType.DataRow)
04 {
05 CarModel cm = (CarModel)e.Row.DataItem;
06
07 img.ImageUrl = String.Format("images/{0}.jpg", cm.ID);
08 09 } 10 }
You need to get a reference to the Image named img. Which code segment should you add at line 06?

Correct Answer: B
Question 14
You are implementing an ASP.NET application.
The application includes a Person class with property Age.
You add a page in which you get a list of Person objects and display the objects in a GridView control.
You need to add code so that the GridView row is highlighted in red if the age of the person is less than 18.
Which GridView event should you handle?

Correct Answer: B