Jump to content
IndiaDivine.org

.NET brain dump

Rate this topic


Guest guest

Recommended Posts

dear samratchanites,

I have attached .NET brain dump questions which might be useful for

those who are

planning to take MCAD exam.This dump contains exact set of questions asked

in exam.

This will be very useful to understand the question pattern that will come

in actual exam.

It contains questions (around 120) for the exam " Developing Web applications

using ASP.NET " .

 

With luv,

Baskar.

 

 

 

<<mcad_dump.txt>>

 

 

This is the gateway to 70-305 exam.

 

B_F

 

 

1. <h3 align= " center " ><i>Do not memorize this Dump, Learn it and you will pass

easy. Powered by Big_Foot!<br>

Good Luck for the preparations.</h3></i>

 

 

1. You are a Web developer for your company. You create an ASP.NET application

that accesses sales and marketing data. The data is stored in a Microsoft SQL

Server 2000 database on a server named Prod01.

 

The company purchases a factory automation software application. The application

is installed on Prod01, where it creates a second instance of SQL Server 2000

named Factory and a database named FactoryDB. You connect to FactoryDB by using

Windows Integrated authentication.

 

You want to add a page to your ASP.NET application to display inventory data

from FactoryDB. You use a SqlConnection object to connect to the database. You

need to create a connection string to FactoryDB in the instance of SQL Server

named Factory on Prod01.

 

Which string should you use?<br>

 

a. _Server=Prod01;Data Source=Factory;<br>

Initial Catalog=FactoryDB;Integrated Security=SSPI_

 

b. _Server= Prod01;Data Source=Factory;<br>

Database=FactoryDB;Integrated Security=SSP1_

 

c. _Data Source= Prod01\Factory;Initial Category=Factory;<br>

Integrated Security=SSP1_

 

d. _Data Source= Prod01\Factory;Database=FactoryDB;<br>

Integrated Security=SSP1_

 

 

 

Ans: D

 

 

 

 

 

 

 

2. You are creating an ASP.NET application that performs updates to a database.

The application performs the updates by running a series of SQL statements. You

write a procedure to run the SQL statements. The procedure accepts a connection

string and an array of SQL statements as parameters.

 

You use structured exception handling in your procedure to handle any errors

that occur while the statements are running. You want the procedure to terminate

after handling an exception and to return to the SQL statement that caused the

exception. You also want to ensure that the database connection is closed before

the procedure terminates, whether or not an error occurs.

 

You begin writing the procedure by using the following code:<br>

 

public static void ExecuteStatements(<br>

string connectionString, string[. sql)<br>

{<br>

OleDbConnection cnn =<br>

new OleDbConnection(connectionString);<br>

OleDbCommand cmd = new OleDbCommand();<br>

 

int i;<br>

cmd.Connection = cnn;<br>

cnn.Open();<br>

try<br>

{<br>

for (i=0; i<= sql.Length - 1;i++)<br>

{<br>

cmd.CommandText = sql[i.;<br>

cmd.ExecuteNonQuery();<br>

}<br>

}<br>

Which code segment should you use to complete the procedure?

 

a. catch(OleDbException ex)<br>

{<br>

throw(ex);<br>

}<br>

finally<br>

{<br>

cnn.Close();<br>

}<br>

}

 

b. catch(OleDbException ex)<br>

{<br>

throw(new Exception(sql[i., ex));<br>

}<br>

finally<br>

{<br>

cnn.Close();<br>

}<br>

}

 

c. catch(OleDbException ex)<br>

{<br>

throw(ex);<br>

}<br>

}<br>

cnn.Close();

 

d. catch(OleDbException ex)<br>

{<br>

throw(new Exception(sql[i., ex));<br>

}<br>

}<br>

cnn.Close();

 

 

Ans: B

 

 

 

 

 

 

 

3. You ASP.NET application manages order entry data by using a DataSet object

named orderEntry. The orderEntry object includes twp DataTable objects named

orderNames and OrderDetails. A ForeignKeyConstraint object named orderDetailsKey

is defined between the two DataTable objects.

 

You attempt to delete a row in orderNames while there are related rows in

OrderDetails, and an exception is generated.

 

What is the most likely cause of the problem?

 

a. The current value of OrderDetails.KeyDeleteRule is Rule.Cacade.

 

b. The current value of OrderDetails.KeyDeleteRule is Rule.SetNull.

 

c. The current value of OrderDetails.KeyDeleteRule is Rule.SetDefault.

 

d. The current value of OrderDetails.KeyDeleteRule is Rule.None.

 

 

 

Ans: D

 

 

 

 

 

 

 

4. You are creating an ASP.NET application to track sales orders. The

application users an ADO.NET DataSet object that contains two DataTable objects.

One table is named Orders, and the other table is named OrderDetails. The

application displays data from the Orders table in a list box. You want the

order details for an order to be displayed in a grid when a user selects the

order in the list box. You want to modify these objects to enable your code to

find all the order details for the selected order.

 

What should you do?

 

a. Add a DataRelation object to the Relations collection of the DataSet object.

 

b. Use the DataSet.Merge method to connect the Orders table and the OrderDetails

table to each other.

 

c. Add a ForeignKeyConstraint to the OrderDetails table.

 

d. Add a keyref constraint to the OrderDetails table.

 

 

 

Ans: A

 

 

 

5. You create an ASP.NET application to display a sorted list of products in a

DataGrid control. The product data is stored in a Microsoft SQL Server database.

Each product is identified by a numerical value named ProductID, and each

product has an alphabetic named ProductName. You write ADO.NET code that uses a

SqlDataAdapter object and a SqlCommand object to retrieve the product data from

the database by calling a stored procedure.

 

You set the CommandType property of the SqlCommand object to

CommandType.StoredProcedure. You set the CommandText property of the object to

procProductList. Your code successfully files a DataTable object with a list of

products that is sorted by ProductID in descending order.

 

You want to data to be displayed in reverse alphabetic order by ProductName.<br>

 

What should you do?

 

a. Change the CommandType property setting of the SqlCommand object to

CommandType.Text.<br>

Change the CommandText property setting of the SqlCommand object to the

following:<br>

SELECT * FROM procProductList ORDER BY ProductName DESC;<br>

Bind the DataGrid control to the DataTable object.

 

b. Create a new DataView object based on the DataTable object.<br>

Set the Sort Property of the DataView object to _ProductName DESC_.<br>

Bind the DataGrid control to the DataView object.

 

c. Set the AllowSorting property of the DataGrid control to True.<br>

Set the SortExpression property of the DataGridColumn that displays ProductName

to<br>

_ProductName DESC_.<br>

Bind the DataGrid control to the DataTable object.

 

d. Set the DisplayExpression property of the DataTable object to _ORDER BY

ProductName

DESC_.<br>

Bind the DataGrid control to the DataTable object.

 

 

 

Ans: B

 

 

6. You create an ASP.NET application and deploy it on a test server. The

application consists of a main page that links to 30 other pages containing

ASP.NET code.

 

You want to accomplish the following goals:

" Enable tracing on all the pages in the application except the main page.

" Display trace output for up to 40 requests.

" Ensure that trace output is appended to the bottom of each of the pages that

will contain trace output.<br>

" Ensure that any configuration changes affect only this application.

 

You need to accomplish these goals with the minimum amount of development

effort. Which three actions should you take? (Each Ans: presents part of the

solution. Choose three)

 

a. Add the following element to the Web.config file:<br>

& LT;trace enabled=_true_ pageOutput=_True_/>

 

b. Add the following attribute to the Trace element of the application's

Weconfig file:<br>

requestLimit=40

 

c. Add the following attribute to the Trace element of the application's

Machine.config file:<br>

RequestLimit=40

 

d. Set the Trace attribute of the Page directive to true for each page except

the main page.

 

e. Set the Trace attribute of the Page directive to false for the main pag

 

f. Set the TraceMode attribute of the Page directive to SortByTime for the main

page.

 

 

Ans: A-B-E

 

 

 

 

 

 

 

7. You create an ASP.NET page to display a sorted list of products in a DataGrid

control. The product data is stored in a Microsoft SQL Server database. Each

product is identified by a numerical value named ProductID, and each product has

an alphabetic named ProductName. You write ADO.NET code that uses a

SqlDataAdapter object and a SqlCommand object to retrieve the product data from

the database by calling a stored procedure.

 

You set the CommandType property of the SqlCommand object to

CommandType.StoredProcedure. You set the CommandText property of the object to

procProductList. Your code successfully fills a DataTable object with a list of

products that is sorted by ProductID in descending order.

 

You want the data to be displayed in reverse alphabetic order by ProductName.

 

What should you do?

 

a. Change the CommandType property setting of the SqlCommand object to

CommandType.Text.<br>

Change the CommandText property setting of the SqlCommand object to the

following:<br>

SELECT * FROM procProductList ORDER BY ProductName DESC;<br>

Bind the DataGrid control to the DataTable object.

 

b. Create a new DataView object based on the DataTable object.<br>

Set the Sort Property of the DataView object to _ProductName DESC_.<br>

Bind the DataGrid control of the DataView object.

 

c. Set the AllowSorting property of the DataGrid control to True.<br>

Set the SortExpression property of the DataGridColumn that displays ProductName

to<br>

_ProductName DESC_.<br>

Bind the DataGrid control to the DataTable object.

 

d. Set the DisplayExpression property of the DataTable object to _ORDER BY

ProductName<br>

DESC_.<br>

Bind the DataGrid control to the DataTable object.

 

 

Ans: B

 

 

 

 

8.You are creating an ASP.NET application that uses the Microsoft SQL Server

..NET Data Provider to connect to your company's database. Your database

administrator reports that, due to heavy usage of the application, data requests

are being blocked while users wait for new connections to be created.

 

You want to improve throughput by setting a minimum connection pool size of

10.<br>

 

What should you do?

 

a. Add a connection element under an appSettings element in the Web.config file

for your application, <br>

and specify a minimum size of 10 for the connection pool.

 

b. Add a connection element under an appSettings element in the Machine.config

file on your Web server,<br>

and specify a minimum size of 10 for the connection pool.

 

c. Add a Min Pool Size property to the connection string you use when opening a

connection, and specify <br>a minimum size of 10 for the connection pool.

 

d. Add a Min Pool Size property to your ADO.NET connection objects, and assign a

value of 10 to the property.

 

 

Ans: C

 

 

 

 

 

9. You are creating an ASP.NET Web Form that displays employee data from a

DataSet object. You want to fill the DataSet object and then you want to

retrieve a reference to the employee whose primary key has the value of 1.

 

You write the following code. (Line numbers are included for reference

only)<br><br>

 

01 SqlConnection(ConnectionString);<br>

02 conn.Open();<br>

03 SqlCommand cmd = new SqlCommand (_SELECT * FROM Employees_, conn);<br>

04 SqlDataAdapter da = new SqlDataAdapter(cmd);<br>

05 DataSet ds = new DataSet();<br>

06<br>

07 da.Fill(ds, _Employees_);<br>

08<br>

09 DataRow dr;<br>

10 dr = ds.Tables[_Employees_..Rows.Find(1);<br>

11 nameLabel.Text = dr[_Name_..ToString();<br>

 

When you run the code, you receive the following error message at line 10:

_Table doesn't have a primary key._ <br>

You ensure that a primary key is defined on the Employees table in the database.

You want to alleviate <br>

the error to allow the code to run correctly. You also want to catch the

exception that would occur if the<br>

employee whose primary key has the value if 1 is deleted from the database.

 

Which two actions should you take? (Each Ans: presents part of the solution.

Choose

two)

 

a. Add the following code at line 06:<br>

dMissingSchemaAction = MissingSchemaAction.AddWithKey;

 

b. Add the following code at line 06:<br>

da.MissingSchemaAction = MissingSchemaAction.Add;

 

c. Add the following code at line 06:<br>

da.MissingSchemaAction = MissingSchemaAction.Ignore;

 

d. Add the following code at line 06:<br>

da.MissingSchemaAction = MissingSchemaAction.Error;

 

e. Place line 07 in a structured exception handling block.

 

f. Place lines 10 and 11 in a structured exception handling block.

 

 

 

Ans: A-F

 

 

 

 

10. You are creating an ASP.NET application for your company. The company data

is stored in a Microsoft SQL Server 6.5 database. Your application generates

accounting summary reports based on transaction tables that contain million of

rows.

 

You want your application to return each summary report as quickly as possible.

You need to configure your application to connect to the database and retrieve

the data in a away that achieves this goal.

 

What should you do?

 

a. Use a SqlConnection object to connect to the database, and use a SqlCommand

object to run a stored <br>

procedure that returns the dat

 

b. Use an OleDbConnection object to connect to the database, and use an

OleDbCommand <br>object to run a stored procedure that returns the data.

 

c. Configure SQL Server to support HTTP access, and create an XML template to

run <br>a stored procedure that returns the data in XML format.

 

d. Use COM interop to create an ADODB.Connection object, and use an

ADODB.Command object<br> to run a SQL statement that returns the data.

 

 

 

Ans: B

 

 

 

 

11. You are creating an ASP.NET page to retrieve sales data from a Microsoft SQL

Server database. You are writing a method named GetYTDSales to run a stored

procedure in the SQL Server database. The stored procedure has one input

parameter that is used to specify a product. The stored procedure returns to the

year-to-date sales for that products.

 

You declare a numeric variable in the GetYTDSales method. You want to assign the

return value of the stored procedure to the variable.

 

What should you do?

 

a. Create a SqlDataAdapter object and call its Fill method to run the stored

procedure and assign the year-to-date sales value to your numeric variable.

 

b. Create a SqlDataAdapter object and call its Update method to run the stored

procedure and assign the year-to-date sales value to your numeric variable.

 

c. Create a SqlCommand object and call its ExecuteScalar method to run the

stored procedure and assigns the year-to-date sales value to your numeric

variable.

 

d. Create a SqlCommand object and call its ExecuteReader method to run the

stored procedure and assign the year-to-date sales value to your numeric

variable.

 

Ans: C

 

 

 

 

12. You are developing an ASP.NET application for your company's intranet.

Employees will use the application to administer their employee benefits. The

benefits information is stored in a Microsoft SQL Server database named

Benefits.

 

An employee can select benefits options from 10 different drop-down list boxes.

The values for each list are stored in separate tables in the Benefits database.

The values that are available for employees to choose can change once each year

during the benefits enrollment period.

 

You want to minimize the number of times your application must access the

Benefits database to obtain the values for the drop-down list box.

 

Which two courses of action should you take? (Each Ans: presents part of the

solution. Choose two)

 

a. Create one stored procedure that returns the result for all 10 drop-down list

boxes.<br>

Create one DataTable object for each of the 10 drop-down list boxes.<br>

Use a SqlDataReader object to populate 10 DataTable objects by calling the

NextResult()<br>

method.

Bind the drop-down list boxes to the DataTable objects.

 

b. Create a stored procedure that returns the result set for all 10 drop-down

list boxes.<br>

Bind the drop-down list boxes to the DataReader object.

 

c. Create one DataTable object for each of the 10 drop-down list boxes.<br>

Create a stored procedure for each of the 10 tables.<br>

Use a SqlDataReader object to populate the 10 DataTable objects.<br>

Bind the drop-down list boxes to the DataTable objects.

 

d. Store the result sets for the 10 drop-down list boxes in a DataSet

object.<br>

Add the DataSet objects to the Cache object for the application.

 

e. Store the result sets for the 10 drop-down list bikes in a file on the user's

computer by using the DataSet.WriteXml() method.

 

 

 

Ans: A-D

 

 

 

 

13. You are creating an ASP.NET page that displays a list of products. The

product information is stored in a Microsoft SQL Server database. You use

SqlConnection object to connect to the database.

 

Your SQL Server computer is named ServerA The database that contains the product

information is named SalesDB. The table that contains the product information is

named Products. To connect to SalesDB, you use a SQL Server user account named

WebApp that has the password s1p2t9.

 

You need to set the ConnectionString property of the SqlConnection object.

 

Which string should you use?

 

a. _Provider=SQLOLEDB.1;File Name =_Data\MyFile.udl

 

b. _Provider=MSDASQL;Data Source=ServerA;<br>

Initial Catalog=SalesDB;<br>

User ID=WebApp;Password=s1p2t9_

 

c. _Data Source= ServerA;Initial Catalog=SalesDB;<br>

User ID=WebApp;Password=s1p2t9_

 

d. _Data Source= ServerA;Database=SalesDB;<br>

Initial File Name=Products;User ID=WebApp;Pwd=s1p2t9_

 

Ans: C

 

 

 

 

14. You are using ASP.NET and ADO.NET to create an accounting application for

your company. You are writing code to run a set of stored procedures that

perform posting operations in a database at the end of each month.

 

You use an OleDbConnection object to connect to the database. You use an

OleDbCommand object to run the stored procedures.

 

If an error occurs during execution of any of the stored procedures, you want to

roll back any data changes that were posted. You want the changes to be

committed only of all of the posting operations succeed.

 

You write code to catch an OleDbException object if an error occurs during the

execution of a stored procedure.

 

What else should you do?

 

a. Call the BeginTransaction method of the OleDbConnection object before running

the stored procedure.<br> If an error occurs, use the OleDbConnection object to

roll back the changes.

 

b. Call the BeginTransaction method of the OleDbConnection object before running

the stored procedures.<br> If an error occurs, use the OleDbException object to

roll back the changes.

 

c. Use the BeginTransaction method of the OleDbConnection object to create an

OleDbTransaction object.<br> Assign the OleDbTransaction object to the

Transaction property of your OleDbCommand object. If an error occurs, use the

OleDbTransaction object to roll back the changes.

 

d. Use the BeginTransaction method of the OleDbConnection object to create an

OleDbTransaction object. <br>Pass a reference to the OleDbTransaction object to

each stored procedure. Use error handling inside the stored procedures to roll

back the changes.

 

 

 

Ans: C

 

 

 

 

15. You are creating an ASP.NET application that uses role-based security to

allow users to access only those pages that they are authorized to access. You

use a Microsoft SQL Server database to manage the list of users and roles for

the ASP.NET application. A table named Roles contains a column named RoleID and

a column named RoleName. A table named Users contains a column named UserID, a

column named UserName, and a column named Password.

 

A table named UserRoles contains a column named UserID and a column named

RoleID. You need to create a stored procedure that returns all users who belong

to a specific role. You write the following Transact-SQL code to define the

stored procedure:

 

CREATE PROCEDURE GetRoleMembers<br>

@RoleID int<br>

AS

 

Which code segment should you use to complete the stored procedure?

 

a. SELECT UserRoles.UserID, Users.UserName<br>

FROM Users<br>

INNER JOIN<br>

Roles UserRoles On UserRoles.RoleID = Users.UserID<br>

WHERE UserRoles.RoleID = @RoleID

 

b. SELECT UserRoles.UserID, Users.UserName<br>

FROM UserRoles<br>

INNER JOIN<br>

Roles On UserRoles.RoleID = Roles.RoleID, Users<br>

WHERE UserRoles.RoleID = @RoleID

 

c. SELECT UserRoles.UserID, Users.UserName<br>

FROM UserRoles<br>

INNER JOIN<br>

Users On Users.UserID = UserRoles.UserID<br>

WHERE UserRoles.RoleID = @RoleID

 

d. SELECT Users.UserI Users.UserName<br>

FROM Users, UserRoles<br>

INNER JOIN<br>

Roles On UserRoles.RoleID = Roles.RoleID<br>

WHERE UserRoles.RoleID = @RoleID

 

 

Ans: C

 

 

16. You are a Web developer for your company. You create an ASP.NET application

that accesses sales and marketing data. The data is stored in a Microsoft SQL

Server 2000 database on a server named Server01.

 

The company purchases a factory automation software application. The application

is installed on Server01, where it creates a second instance of SQL Server 2000

named Factory and a database named Factory DB. You connect to FactoryDB by using

Windows Integrated authentication.

 

You want to add a page to your ASP.NET application to display inventory data

from FactoryDB. You use a SqlConnection object to connect to the database. You

need to create a connection string to connect to FactoryDB in the instance of

SQL Served named Factory on Server01.

 

Which string should you use?

 

a. _Server= Server01;Data Source=Factory;<br>

Initial Catalog=FactoryDB;Integrated Security=SSPI_

 

b. _Server= Server01;Data Source=Factory;<br>

Database=FactoryDB;Integrated Security=SSPI_

 

c. _Data Source= Server01\Factory;Initial Catalog=Factory;<br>

Integrated Security=SSPI_

 

d. _Data Source= Server01\Factory;Databse=FactoryDB;<br>

Integrated Security=SSPI_

 

 

 

Ans: D

 

 

 

 

17. You are creating an ASP.NET page for the sales department at your company.

The page enables users to access data for individual customers by selecting a

customer's name. After a customer's name is selected, the page displays a list

of that customer's unshipped orders and the total year-to-date (YTD) sales to

that customer.

 

Your company's sales data is stored in a Microsoft SQL Server database. You

write a stored procedure to return the data that you need to display on the

ASP.NET page. The stored procedure returns a result set containing the list of

unshipped orders, and it returns the YTD sales in a parameter named @YTD.

 

You write code that uses a SqlCommand object named cmd and a SqlDataReader

object named reader to run the stored procedure and return the data. You bind

reader to a DataGrid control on your page to display the list of unshipped

orders.

 

You want to display the YTD sales in a Label control named ytdLabel.

Which code segment should you use?

 

a. reader.NextResult()<br>

ytdLabel.Text = cmd.Parameters(_@YTD_).Value.ToString()<br>

reader.Close()

 

b. reader.Close()<br>

ytdLabel.Text = reader.NextResult().ToString()

 

c. reader.Close()<br>

ytdLabel.Text = cmd.Parameters(_@YTD_).Value.ToString()

 

d. ytdLabel.Text =<br>

cmParameters(_@RETURN_VALUE_).Value.ToString()<br>

reader.Close()

 

 

Ans: C

 

 

 

 

18. You are creating an ASP.NET page that displays inventory figures for

selected items. Your code creates ad hoc SQL queries and retrieves data from a

Microsoft SQL Server database.

 

The identification number of an item is stored in a string variable named

ItemID, and the SQL statement for your query is stored in a variable named SQL.

 

You use the following line of code to construct the SQL query:

 

SQL = _SELECT UnitsOnHand, UnitsOnOrder FROM Inventory_

+ _ WHERE ProductID = _ + ItemID;

 

The ProductID, UnitsOnHand, and UnitsOnOrder columns in the database are all of

type int.<br>

You use a SqlDataReader object named reader to retrieve the data.<br><br>

 

You want to assign the UnitsOnHand quantity to a variable named OnHand,<br>

Which line of code should you use?

 

a. OnHand = reader.GetInt16(0);

 

b. OnHand = reader.GetInt16(1);

 

c. OnHand = reader.GetInt32(0);

 

d. OnHand = reader.GetInt32(1);

 

 

Ans: C

 

 

 

 

 

19. You create an ASP.NET application that is deployed on your company's

intranet. Sales representatives use this application to connect to a database

while they are speaking to customers on the telephone. Your code is running

under the security context of the user who requested the page.

 

The application requires each sales representative to supply a unique user name

and password to access the application. These individual user names and

passwords are included in the ConnectionString property settings that your code

uses to connect to the database. All users have the same access rights to the

database.

 

Sales representatives report that it takes a long time to access the database.

You test the application and discover that a new connection is created each time

a sales representative connects to the database.

 

You want to reuse connections in order to reduce the time it takes to access the

database.

 

What should you do?

 

a. Modify the connection string to specify Windows Integrated authentication.

 

b. Modify the connection string to increase the connection timeout setting.

 

c. Modify the connection string so that is uses a single application user name

and password for every connection to the database.

 

d. Modify the connection string so that is uses a login user named that is a

member of the sysadmin fixed server role.

 

 

 

Ans: C

 

 

 

 

 

20. You are creating an ASP.NET page that contains a Label control named

specialsLabel. A text file named Specials.txt contains a list of products.

Specials.txt is located in the application directory. Each product name listed

in Specials.txt is followed by a carriage return.

 

You need to display a list if featured products in specialsLabel. You need to

retrieve the list of products from Specials.txt.

 

Which code segment should you use?

 

a. Dim reader As System.IO.StremReader =_<br>

System.IO.File.OpenText(_<br>

Server.MapPath(_Specials.txt_))<br>

Dim input As String<br>

input = reader.BaseStream.ToString()<br>

While Not input Is Nothing<br>

specialsLabel.Text =_<br>

String.Format(_{0} <br> {1} _,_<br>

specialsLabel.Text, input)<br>

input = reader.BaseStream.ToString()<br>

End While<br>

reader.Close()

b. Dim reader As System.IO.StreamReader =_<br>

System.IO.File.OpenText(_<br>

Server.MapPath(_Specials.txt_))<br>

Dim input As String<br>

input = reader.ReadLine()<br>

While Not input Is Nothing<br>

specialsLabel.Text =_<br>

String.Format(_{0} <br> {1} _,_<br>

specialsLabel.Text, input)<br>

input = reader.ReadLine()<br>

End While<br>

reader.Close()

 

c. Dim strm As System.IO.Stream =_<br>

System.IO.File.OpenRead(_<br>

Server.MapPath(_Specials.txt_))<br>

Dim b As Byte()<br>

Dim input As String<br>

input = strm.Read(b, 0, s.Length).ToString()<br>

specialsLabel.Text = input<br>

strm.Close()

 

d. Dim strm As System.IO.FileStream =_<br>

System.IO.File.OpenRead(_<br>

Server.MapPath(_Specials.txt_))<br>

Dim input As String<br>

input = strm.ToString()<br>

specialsLabel.Text = input<br>

strm.Close()

 

 

Ans: B

 

 

 

 

21. You are creating an ASP.NET application for Margie's Travel. Margie's Travel

uses a Microsoft SQL Server 2000 database to store information about vacation

packages. Your application will allow a user to request information about

vacation packages for a specific destination.

 

You want to display this data to the user in a DataGrid. You want the data to be

displayed in read-only form. The user's travel destination is contained in a

form level string variable named destinationCode. In your Page.Load event

handler, you create a SqlConnection object named sqlConnection1, initialize it,

and call its Open() method. When your code runs the query, you want the data to

be returned as quickly as possible.

 

You define the following local variable to hold the destination code:

string dest = destinationCode;

 

What should you do?

 

a. Create a stored procedure named GetDestinations and then use the following

code to retrieve data:<br>

SqlCommand cmd =<br>

new SqlCommand(_GetDestinations_, sqlConnection1);<br>

cmd.CommandType = CommandType.StoredProcedure;<br>

SqlParameter parm =<br>

new SqlParameter(_@DestinationCode_, dest);<br>

cmd.Parameters.Add(parm);<br>

SqlDataReader sqlDataReader1 = cmd.ExecuteReader();

 

b. Create a stored procedure named GetDestinations and then use the following

code to retrieve the data:<br>

string qry =<br>

_EXEC GetDestinations WHERE DestID = _+ dest + __;<br>

SqlDataAdapter da =<br>

new SqlDataAdapter(qry, sqlConnection1);<br>

DataSet ds = new DataSet();<br>

da.Fill(ds);

 

c. Use the following code to retrieve the data:<br>

string qry =<br>

_SELECT * FROM Destinations WHERE DestID =<br>

__ + dest + __;<br>

SqlCommand cmd = new SqlCommand(qry,<br>

sqlConnection1);<br>

cmd.CommandType = CommandType.Text;<br>

SqlDataReader sqlDataReader1 = cmd.ExecuteReader();

 

d. Use the following code to retrieve the data:<br>

string qry =<br>

_SELECT * FROM Products WHERE DestID = @DestID_; SqlCommand cmd = new

SqlCommand(qry, SqlConnection1);<br>

cmCommandType = CommandType.Text;<br>

SqlParameter = new SqlParameter(_@DestID_, dest);<br>

cmParameters.Add(parm);<br>

SqlDataReader sqlDataReader1 = cmExecuteReader();

 

 

Ans: A

 

 

 

 

22. You create an ASP.NET application for your company. This application will

display information about products that the company sells. The application uses

a Microsoft SQL Server database.

 

You add two DropDownList controls to your .aspx page. One drop-down list box

will display product information. The control for this drop-down list box is

named Products. The other drop-down list box will display category information.

The control for this drop-down list box is named Category. You have an open

SqlConnection object named con.

 

The Page.Load event handler uses the following code segment to populate the

drop-down list by binding the SqlDataReader.

 

(Line numbers included for reference only.)

 

01 Dim cmd1 as New SqlCommand(_SELECT * FROM __<br>

& _Products_,con<br>

02 Dim dr1 as SqlDataReader<br>

03 dr1 = cmd1.ExecuteReader()<br>

04 Products.DataTextField = _ProductName_<br>

05 Products.DataValueField = _ProductID_<br>

06 Products.DataSource = dr1<br>

07 Products.DataBind()<br>

08 Dim dr2 as SqlDataReader<br>

09 cmd1.CommandText = _SELECT * FROM Category_<br>

10 dr2 = cmd1.ExecuteReader()<br>

11 Category.DataTextField = _CategoryName_<br>

12 Category.DataValueField = _Category ID_<br>

13 Category.DataSource = dr2<br>

14 Category.DataBind()

 

During testing, the page raises an invalid operation exception. You need to

ensure that the page displays correctly without raising an exception.

 

What should you do?

 

a. Replace the code for line 03 of the code segment with the following code:<br>

dr1.ExecuteReader(CommandBehavior.CloseConnection)

 

b. Add the following code between line 07 and line 08 of the code segment:<br>

drl.Close()

 

c. Replace the code for line 09 and line 10 of the code segment with the

following code:<br>

Dim cmd2 as New SqlCommand_SELECT * FROM Category_,con)

dr2 = cmd2.ExecuteReader()

 

d. Remove the code for line 07 of the code segment.<br>

Replace the code for line 14 of the code segment with the following code:

Page.DataBind()

 

 

 

Ans: B

 

 

 

 

 

23. You are creating an ASP.NET page that presents data to users in an updatable

DataGrid control. Users update data in the grid. Your code uses the System.Data

namespace and the System.Data.OleDb namespace.

 

Data changes are saved in an ADO.NET DataTable object. You want a user's changes

to be saved to a database when the user finishes making changes. You write the

following procedure to accomplish this task:

 

public static void UpdateData)<br>

string sql, string connectionString, DataTable dataTable)<br>

{<br>

OleDbDataAdapter da = new OleDbDataAdapter();<br>

OleDbConnection cnn =<br>

new OleDbConnection(connectionString);<br>

dataTable.AcceptChanges();<br>

da.UpdateCommand.CommandText = sql;<br>

da.UpdateCommand.Connection = cnn;<br>

da.Update(dataTable);<br>

da.Dispose();<br>

}<br>

 

This code runs to completion, but no data changes appear in the database. You

test the update query and the connection string that you are passing to the

procedure, and they both work correctly.

 

You need to alter the code to ensure that data changes appear in the database.

 

What should you do?

 

a. Add the following two lines of code before calling the Update method:<br>

OleDbCommandBuilder cb = new OleDbCommandBuilder(da);<br>

cb.GetUpdateCommand();

 

b. Add the following line of code before calling the Update method:<br>

da.UpdateCommand.Connection.Open();

 

c. Delete this line of code:<br>

dataTable.AcceptChanges();

 

d. Delete this line of code:<br>

da.Dispose();

 

 

 

Ans: C

 

 

 

 

 

24. You are creating an ASP.NET application for an online payment service. The

service allows users to pay their bills electronically by using a credit card.

 

The application includes a payment page named Payment.aspx. This page contains a

form for entering payee, payment amount, and credit card information. When a

user needs to submit a new billing address to a payee, the page form allows the

user to provide the new address information.

 

If the user indicates a change of address, the application needs to provide the

information to the ProcessAddressChange.aspx page for processing as soon as the

user submits the payment page information. The ProcessAddressChange.aspx page

processes the request for a change of address but does not provide any display

information for the user.

 

When the requested processing is complete. Payment.aspx displays status results

to the user. You need to add a line of code to Payment.aspx to perform the

functionality in ProcessAddressChange.aspx.

 

Which line of code should you use?

 

 

a. Response.Redirect(_ProcessAddressChange.aspx_)

 

b. Response.WriteFile(_ProcessAddressChange.aspx_)

 

c. Server.Transfer(_ProcessAddressChange.aspx_,True)

 

d. Server.Execute(_ProcessAddressChange.aspx_)

 

 

 

Ans: D

 

 

 

 

 

25. You are creating an ASP.NET application for your company. Your code uses the

System.Data namespace. The marketing managers at Your company use a page on your

Web site to edit the prices of the company's products.

 

You retrieve product part numbers, named, and prices from a database. You store

this information in a DataSet object named productInfo, and you display the data

on the Web page. The marketing managers use your page to edit one or more

prices, and you record these change in productInfo. The marketing managers click

a Save button to save their changes.

 

You write code in the Click event handler for the Save button to save the edited

prices to the database. You want to extract the edited rows in productInfo

before performing the update.

 

You create a second DataSet object named productChanges to hold only edited

product data.

 

Which line of code should you use to copy the edited rows from productInfo into

productChanges?

 

a. productChanges =<br>

productInfo.GetChanges(DataRowState.Detached);

 

b. productChanges =<br>

productInfo.GetChanges();

 

c. productChanges.Merge(<br>

productInfo, true);

 

d. productChanges.Merge(<br>

productInfo, false);

 

Ans: B

 

 

 

 

 

26. You are creating an ASP.NET application to keep track of your company's

employees. Employees will use the application to indicate whether they are

currently in the office or out of the office.

 

The main page of the application is named ShowBoard.aspx. This page contains a

Repeater control named employeeStatus that is bound to the results of a stored

procedure in the backend database. The stored procedure provided all employee

identification numbers (IDs), all employee names, and each employee's current

status of either In if the employee is in the office or Out if the employee is

out of the office.

 

The HTML code for employeeStatus is as follows:

 

<asp:repeater id=_employeeStatus_ runat=_server_>

<ItemTemplate>

<%# Container.DataItem(_EmployeeName_)%>

(<%# Container.DataItem(_Status_)%>)<br/>

</ItemTemplate>

</asp:repeater>

 

The code-behind file for ShowBoard.aspx contains a private procedure named

ChangeInOutStatus that toggles the status for an employee by using the

employee's ID.

 

You need to add a button for each employee listed by employeeStatus. When an

employee clicks the button, you want the button to call ChangeInOutStatus and

pass the employee ID to toggle the status of the employee.

 

What are two possible ways to achieve this goal? (Each Ans: presents a complete

solution. Choose two)

 

a. Add the following HTML code to the ItemTemplate element of

employeeStatus:<br>

& LT;input type=_button_ id=_changeStatusButton_<br>

alt=<%# Container.DataItem(_EmployeeID_)%><br>

OnClick=_changeStatusButton_ Runat=_server_<br>

Value=_Change Status_/><br>

Add the following subroutine to the code-behind file for ShowBoard.aspx:<br>

Public Sun changeStatusButton(_<br>

ByVal sender As System.Object,_<br>

ByVal e As System.EventArgs)<br>

ChangeInOutStatus(CInt(sender.Attributes(_alt_)))<br>

End Sub

 

b. Add the following HTML code to the ItemTemplate element of

employeeStatus:<br>

& LT;input type=_button_ id=_changeStatusButton_<br>

alt=<%# Container.DataItem(_EmployeeID_)%><br>

OnServerClick=_changeStatusButton_ Runat=_server_<br>

Value=_Change Status_/><br>

Add the following subroutine to the code-behind file for ShowBoard.aspx:<br>

Public Sub changeStatusButton(_<br>

ByVal sender As System.Object,_<br>

ByVal e As System.EventArgs)<br>

ChangeInOutStatus(CInt(sender.Attributes(_alt_)))<br>

End Sub

 

c. Add the following HTML code to the ItemTemplate element of

employeeStatus:<br>

<asp:Button id=_changeStatusButton_ Runat=_server_<br>

Text=_Change Status_<br>

CommandArgument=<%# Container.DataItem(_EmployeeID_)%><br>

/><br>

Add the following code to the ItemCommand event of employeeStatus:<br>

If source.id = _changeStatusButton_ Then<br>

ChangeInOutStatus(CInt(e.CommandSource.CommandArgument)))<br>

End If

 

d. Add the following HTML code to the ItemTemplate element of

employeeStatus:<br>

<asp:Button id=_changeStatusButton_ Runat=_server_<br>

Text=_Change Status_<br>

CommandArgument=<%#Container.DataItem(_EmployeeID_)%><br>

/><br>

Add the following code to the ItemCommand event of employeeStatus:<br>

If e.CommandSource.id = _changeStatusButton_ Then<br>

ChangeInOutStatus(CInt(e.CommandArgument))<br>

End If

 

 

 

Ans: B-D

 

 

 

 

 

27. You are creating an ASP.NET application for your company. Users will use the

application to produce reports. The data for the application is stored in a

Microsoft SQL Server 2000database.

 

You expect many users to use the application simultaneously. You want to

optimize the response time when the users are retrieving data for the reports.

 

You create a procedure to retrieve the data from the database. You store a valid

connection string in a variable named connString in the procedure.

 

You need to add code to the procedure to connect to the database.

Which code segment should you use?

 

a. Dim cnn As New OleDb.OleDbConnection(connString)

 

b. Dim cnn As New SqlClient.SqlConnection(connString)

 

c. Dim cnn As New ADODB.Connection()

 

d. Dim cnn As New SQLDMO.Database()

 

 

 

Ans: B

 

 

 

 

28. You are creating a Web site for Your company. You receive product lists in

the form of XML documents. You are creating a procedure to extract information

from these XML documents according to criteria that your users will select.

 

When a user makes a request, you want the results of these requests to be

returned as quickly as possible.

What should you do?

 

a. Create an XmlDataDocument object and load it with the XML dat

Use the DataSet property of the object to create a DataSet object.

Use a SQL SELECT statement to extract the requested dat

 

b. Create an XmlDataDocument object and load it with the XML data.

Use the SelectNodes method of the object to extract the requested data.

 

c. Create an XPathDocument object and load it with the XML data.

Call the CreateNavigator method to create an XPathNavigator object.

Call the Select method of the XPathNavigator object to run an XPath query that

extracts the requested data.

 

d. Create an XmlReader object. Use the Read method of the object to stream

through the XML data and to apply an XPath expression to extract the requested

data.

 

 

Ans: C

 

 

 

 

 

29. You are creating a DataGrid control named myGrid for a travel service. Each

row in myGrid contains a travel reservation and an Edit command button. In each

row, the fields that contain travel reservation information are read-only

labels. You want all the fields to change to text boxes when a user clicks the

Edit command button in the row.

 

You are writing the following event handler for the EditCommand event. (Line

numbers are included for reference only.)

~1 Sub DoItemEdit(sender As Object, e As DataGridCommandEventArgs)_

Handles MyGrid.EditCommand

~2

~3 End Sub

 

Which code should you add at line 2 of the event handler?

 

a. myGrid.EditItemIndex = e.Item.ItemIndex

 

b. myGrid.DataKeyField = e.Item.AccessKey

 

c. myGrid.SelectedIndex = e.Item.ItemIndex

 

d. myGriCurrentPageIndex = e.Item.ItemIndex

 

 

 

Ans: A

 

 

 

 

 

30. You are creating an ASP.NET application for your company. An earlier version

of the application uses ActiveX components that are written in Visual Basic 6.0.

The new ASP.NET application will continue to use the ActiveX components.

 

You want the marshaling of data between your ASP.NET application and the ActiveX

components to occur as quickly as possible.

 

Which two actions should you take? (Each Ans: presents part of the solution.

Choose two)

 

a. Use ODBC binding.

 

b. Use late binding.

 

c. Set the AspCompat attribute of the Page directive to true.

 

d. Set the AspCompat attribute of the Page directive to false.

 

 

 

Ans: B-D

 

 

 

 

31. You are creating an e-commerce site for your company. Your site is

distributed across multiple servers in a Web farm.

 

Users will be able to navigate through the pages of the site and select products

for purchase. You want to use a DataSet object to save their selections. Users

will be able to view their selections at any time by clicking a Shopping Cart

link.

 

You want to ensure that each user's shopping cart DataSet object is saved

between requests when the user is making purchases on the site.

 

What should you do?

 

a. Create a StateBag object. Use the StateBag object to store the DataSet object

in the page's ViewState property.

 

b. Use the HttpSessionState object returned by the Session property of the page

to store the DataSet object. Use the Weconfig file to configure an

out-of-process session route.

 

c. Use the Cache object returned by the page's Cache property to store a DataSet

object for each user. Use an HttpCachePolicy object to set a timeout period for

the cached data.

 

d. Use the Session_Start event to create an Application variable of type DataSet

for each session. Store the DataSet object in the Application variable.

 

 

 

Ans: B

 

 

 

 

32. You create an ASP.NET server control to display date and time information.

You want to enable other programmers who use your control to customize the style

properties of a Label control named timeLabel. The timeLabel control displays

the date and time.

 

You create two custom property procedures to accomplish this goal. One procedure

modifies the BackCoior property of the constituent controls. The other procedure

modifies the ForeColor property of the constituent controls.

 

In addition to these two custom property procedures, you want to allow users to

apply one of two predefined styles. The predefined styles are created in the

following function:

 

Function GetStyle(styleType As Integer) As Style<br>

Dim myStyle As Style = New Style()<br><br>

 

Select Case styleType<br>

Case 1<br>

myStyle.ForeColor = System.Drawing.Color.White<br>

myStyle.BackColor = System.Drawing.Color.Black<br><br>

 

Case 2<br>

myStyle.ForeColor = System.Drawing.Color.Black<br>

myStyle.BackCoior = System.Drawing.Color.White<br>

End Select<br>

Return myStyle<br>

End Function<br><br>

 

You want to write a public method that will apply these styles. You do not want

to overwrite the ForeColor property<br>

and BackColor property of the Label control if these properties are already set

by using the custom property procedures.

 

Which code should you use for this method?

 

a. Public Sub PickStyle(styleType As Integer)<br>

Dim myStyle As Stile = GetStyle(styleType)<br>

timeLabel.ApplyStyle(myStyle)<br>

End Sub

 

b. Public Sub PickStyle(styleType As Integer)<br>

Dim myStyle As Style = GetStyle(styleType)<br>

timeLabel.MergeStyle(myStyle)<br>

End Sub

 

c. Public Sub PickStyle(styleType As Integer)<br>

Dim myStyle As Style = GetStyle(styleType)<br>

timeLabel.ForceColor = myStyle.ForeColor<br>

timeLabel.BackColor = myStyle.BackColor<br>

End Sub

 

d. Public Sub PickStyle(styleType As Integer)<br>

Dim myStyle As Style = GetStyle(styleType)<br>

timeLabel.CssClass = myStyle.CssClass<br>

End Sub

 

 

 

Ans: B

 

 

 

 

 

33. You create an ASP.NET application that produces sales reports. The sales

data is stored in a Microsoft SQL Server database that is used for transaction

processing. The application consists of complex Transact-SQL statements.

 

Many users report that the report generation is taking longer to run each day.

You need to improve response times.

 

What are two possible ways to achieve this goal? (Each Ans: presents a complete

solution. Choose two)

 

 

a. Use an OleDbDataAdapter indexes exist on the SQL Server tables.

 

b. Ensure that appropriate indexes exist in the SQL Server tables.

 

c. Rewrite your SQL statements to use aliases for all table names.

 

d. Rewrite your direct SQL statements as stored procedures and call the stored

procedures from your application.

 

e. Configure queries to run in the security context of the user who is running

the query.

 

 

Ans: B-D

 

 

 

 

34. You are creating an ASP.NET application for Coho Vineyard & Winery. The

application will be used to identify potential customers.

 

Your application will call an XML Web service run by Wide World Importers. The

XML Web service will return an ADO.NET DataSet object containing a list of

companies that purchase wine. You want to merge this DataSet object into a

DataSet object containing a list of companies that are potential customers.

 

You specify wideWorld as the name of the DataSet object form Wide World

Importers, and you specify customerProspects as the name of the DataSet object

containing potential customers. After the merge, customerProspects will include

the company names in wideWorld.

 

The two DataSet objects contain tables that have the same names and primary

keys. The tables in the two DataSet objects contain columns that have the same

names and data types. A table in wideWorld also contains additional columns that

you do not want to add to customerProspects. If customerProspects included any

tables containing rows with pending changes, you want to preserve the current

values in those rows when the merge occurs. Which lime of code should you use to

merge the wideWorld DataSet object into customerProspects DataSet object?

 

a. customerProspects.Merge (wideWorld, true, MissingSchemaAction.Ignore);

 

b. customerProspects.Merge (wideWorld, true, MissingSchemaAction.AddWithKey);

 

c. wideWorld.Merge (customerProspects, true, MissingSchemaAction.Ignore);

 

d. wideWorlMerge (customerProspects, true, MissingSchemaAction.Add);

 

 

Ans: A

 

 

 

 

 

35. You create an ASP.NET application to provide corporate news and information

to your company's employees. The application is used by employees in New

Zealand.

 

Default.aspx has a Web Form label control named currentDateLabel. The Page.Load

event handler for Default.aspx included the following line of code:

 

currentDateLabel.Text = DateTime.Now.ToString(_D_)

 

You need to ensure that the data is displayed correctly for employees in New

Zealand. What

should you do?

 

a. In the Web.config file for the application, set the culture attribute of the

globalization element to en-NZ.

 

b. In the Weconfig file for the application, set the uiCulture attribute of the

globalization element to en-NZ.

 

c. In Visual Studio .NET, set the responseEncoding attribute in the page

directive for Default.aspx to UTF-8.

 

d. In Visual Studio .NET, save the Default.aspx page for both versions of the

application by selecting Advanced Save Options from the File menu and selecting

UTF-8.

 

 

Ans: A

 

 

 

 

 

36. You create a class named MyFormat that has two public properties. One of the

properties is named Size, and the other property is named Color. You want to use

the MyFormat class in custom server controls to expose format properties to

container pages.

 

You add the following statements to a server control named MessageRepeater:

 

<p>Private_formatter As MyFormat = New MyFormat()</p><br>

Public ReadOnly Property Format As MyFormat<br>

Get<br>

Return_formatter<br>

End Get<br>

End Property<br><br>

 

You create a container page named MessageContainer.aspx to test your custom

control. You register the control as follows:

 

& LT%@ Register Tagprefix=_myctl_ Namespace=_MessageControls_<br>

Assembly=_MessageControls_%><br><br>

 

You want to add an instance of the control to a test page so that the size

property is set to 10 and the color property is set to red.

 

Which code should you use?

 

a. & LT;myctl:MessageRepeater Format-Color=_red_<br>

Format-Size=_10_/>

 

b. & LT;myctl:MessageRepater Format-Color=_red_<br>

Format-Size=_10_ runat=_server_/>

 

c. & LT;myctl:MessageRepeater Color=_red_<br>

Size=_10_ runat=_server_/>

 

d. & LT;myctl:MessageRepeater Format=_color:red;size:10_/>

 

 

 

Ans: B

 

 

 

 

 

37. You are creating an ASP.NET application for Coho Vineyard & Winery. Your

application will can an XML Web service run by Wide World Importers. The XML Web

service will return an ADO.NET DataSet object containing a list of companies

that purchase wine.

 

You need to make the XML Web service available to your application.

What should you do?

 

a. On the .NET tab of the Reference dialog box, select System.Web.Services.dll.

 

b. In the Web References dialog box, type the address of the XML Web service.

 

c. Add a using statement to your Global.asax.cs file, and specify the address of

the XML Web service.

 

d. Write an event handler in the Global.asax.cs file to import the .wsdl and

..disco files associated with the XML Web service.

 

 

Ans: B

 

 

 

38. You create an ASP.NET application to provide online order processing to

customers. A page named ShippingInformation.aspx contains a Web Form with

controls for collecting shipping location information. The Web Form contains the

following elements:

 

" Four TextBox controls for entry of name, street address, city, and postal

code.

" A DropDownList control that consists of the full name of 150 countries.

" A Button control named shipItButton.

 

The Click event handler for shipItButton is located in the code-behind file for

ShippingInformation.aspx. None of the other controls on the Web Form define

server-side event handlers.

 

The Click event handler for ShipItButton redirects the user to a page named

ShippingConfirmation.aspx. The ShippingConfirmation.aspx page provides the

confirmation status of the shipping request submission to the user.

 

Users who access the application by using dial-up connections report that

ShippingInformation.aspx processes very slow after the user clicks the

shipItButton. Users on high-bandwidth network connections do not report the same

issue.

 

You need to decrease the delay experienced by the dial-up users. What should you

do?

 

a. Add the following attribute to the Page directive for

ShippingInformation.aspx: EnableViewState=_False_

 

b. Add the following attribute to the Page directive for

ShippingInformation.aspx: SmartNavigation=_True_

 

c. Add the following attribute to the OutputCache directive for

ShippingInformation.aspx: Location=_server_

 

d. Add the following attribute to the OutputCache directive for

ShippingInformation.aspx. Location=_client_

 

 

 

Ans: A

 

 

 

 

 

39. You create a Web custom control named Toggle that users can turn on and off.

The Toggle control includes a Button control named toggleButton. You write an

event handler named toggleButton_Click for the toggleButton.Click event. This

event adjusts the BorderStyle property to signify whether the Button is toggled

on or off.

 

You want to add code to the Toggle class so that when toggleButton is clicked,

pages that contain instances of Toggle can process custom event handling code.

You add the following code to the Toggle class:

 

Public Event ChangedValue(sender As Object, e As EventArgs)<br>

Protected OnChangedValue(e As EventArgs)<br>

RaiseEvent ChangedValue(Me, e As EventArgs)<br>

End Sub<br><br>

 

You need to add code to toggleButton_Click so that pages that contain instances

of Toggle can handle the ChangedValue event and process custom event handling

code. Which code should you use?

 

a. AddHandler sender.click, AddressOfChangedValue

 

a. AddHandler sender.Click, AddressOfOnChangedValue

 

a. OnChangedValue(EventArgs.Empty)

 

a. ChangedValue(Me, EventArgs.Empty)

 

 

 

Ans: C

 

 

 

 

 

40. You create an ASP.NET page that allows a user to enter a requested delivery

date in a TextBox control<br>

named requestDate. The date must be no earlier than two business days after the

order date, and no later <br>

that 60 business days after the order date. You add a CustomValidator control to

your page. In the Properties

<br>window, you set the ControlToValidate property to requestDate.

 

You need to ensure that the date entered in the requestDate TextBox control

falls within the acceptable range of values. In addition, you need to minimize

the number of round trips to the server.

 

What should you do?

 

a. Set the AutoPostBack property of requestDate to False.<br>

Write code in the ServerValidate event handler to validate the date.

 

b. Set the AutoPostBack property of requestDate to True.<br>

Write code in the ServerValidate event handler to validate the date.

 

c. Set the AutoPostBack property of requestDate to False.<br>

Set the ClientValidationFunction property to the name of a script function

contained in the<br>

HTML page that is sent to the browser.

 

d. Set the AutoPostBack property of requestDate to True.<br>

Set the ClientValidationFunction property to the name of a script function

contained in the<br>

HTML page that is sent to the browser.

 

 

 

Ans: C

 

 

 

 

 

41. You are a member of a team of developers creating several ASP.NET

applications for your company. You want to create a reusable toolbar that will

be used in each of the applications.

 

The toolbar will be displayed at the top of each page viewed by the user. The

contents of the toolbar will vary depending on options each user selects when

creating a profile.

 

You want to be able to add the toolbar to the ASP.NET toolbox for each of the

developers on your team.

 

What should you do?

 

a. Create a new Web Control Library project.<br>

Create the toolbar within a Web custom control.

 

b. Add a new Web user control to your ASP.NET project.<br>

Create the toolbar within the Web user control.

 

c. Add a new Web Form to your ASP.NET project.<br>

Design the toolbar within the Web Form and save the Web Form with an .ascx

extension.

 

d. Add a new component class to your ASP.NET project.<br>

Design the toolbar within the designer of the component class.

 

 

 

Ans: A

 

 

 

 

 

42. You are creating an ASP.NET page for selling movie tickets. Users select a

region, and then they select from a list of cities in that region. The site

displays the names and locations of movie theaters in the city selected by the

user.

 

Your company maintains a list of theaters in a database table that includes the

city, name, and street address of each theater. You want to minimize the time

required to retrieve and display the list of theater names after a user selects

the region and city.

 

What should you do?

 

a. Modify the connection string to add the packet size property and set its

values to 8192.

 

b. Add the following directive to the page:<br>

OutputCache VaryByParam=_city_

 

c. Add the following directive to the page:<br>

OutputCache VaryByControl=_region;city_

 

d. Modify the connection string to keep your database's connection pool as small

as possible.

 

 

 

Ans: B

 

 

 

 

43. You create an ASP.NET page that uses images to identify areas where a user

can click to initiate actions. The users of the application use Internet

Explorer.

 

You want to provide a pop-up window when the user moves the mouse pointer over

an image. You want the pop-up window to display text that identifies the action

that will be taken if the user clicks the image.

 

What should you do?

 

a. For each image, set the AlternateText property to specify the text you want

to display, and set the ToolTip property to True.

 

b. For each image, set the ToolTip property to specify the text you want to

display.

 

c. In the onmouseover event handler for each image, add code that calls the

RaiseBubbleEvent() method of the System.Web.UI.WebControls.Image class.

 

d. In the onmouseover event handler for each image, add code that calls the

ToString() method of the System.Web.UI.WebControls.Image class.

 

 

 

Ans: B

 

 

 

 

 

44. You create an ASP.NET page named Subscribe.aspx for users to to

e-mail lists. You include an existing user control named ListSubscribe in your

page. ListSubscribe has two constituent controls. One control is a TextBox

control named listNameText, and the other control is Button control named

Button. ListSubscribe is defined in the ListSubscribe.ascx file.

 

To add ListSubscribe to Subscribe.aspx, you add the following tag:

 

& LT;email:ListSubscribe id=_ctlSubscribe_ runat=_server_/ & GT;

 

You add a Label control named ListNameLabel to the container page. When a user

s to a list by entering a list name in listNameText and clicking the

Button button, you want the page to display the list name in

ListNameLabel.

 

Which two actions should you take? (Each Ans: presents part of the solution.

Choose two)

 

a. Add the following statement to the declaration section of ListSubscribe.aspx:

<br>

Public listNameText As TextBox

 

B. Add the following statement to the declaration section of Subscribe.aspx:<br>

Public listNameText As TextBox

 

C. Add the following statement to the Page.Load event handler for

Subscribe.aspx:<br>

If Not Page.IsPostBack Then<br>

listNameLabel.Text = ctlSubscribe.listNameText.Text<br>

End If

 

D. Add the following statement to the Page.Load event handler for

Subscribe.aspx:<br>

If Page.IsPostBack Then<br>

listNameLabel.Text = ctlSubscribe.listNameText.Text<br>

End If

 

E. Add the following statement to the PagLoad event handler for

ListSubscribascx:<br>

If Not PagIsPostBack Then<br>

listNameLabel.Text = listNameText.Text<br>

End If

 

F. Add the following statement to the Page.Load event handler for

ListSubscribe.ascx:<br>

If Page.IsPostBack Then<br>

listNameLabel.Text = listNameText.Text<br>

End If

 

 

 

Ans: A-D

 

 

 

 

45. You are maintaining an ASP.NET application named SalesForecast. The

application is written in Visual Basic .NET. The application includes a page

named FirstQuarter.aspx that resides within the Sales namespace. The page class

is named FirstQuarter. You discover that another developer inadvertently deleted

the Page directive for FirstQuarter.aspx. You want to create a new Page

directive to allow FirstQuarter.aspx to work properly.

 

Which directive should you use?

 

a. & LT;%@ Page Language=_vb_<br>

Codebehind=_FirstQuarter.aspx.vb_<br>

Inherits=_FirstQuarter_%>

 

b. & LT;%@ Page Language=_vb_<br>

Codebehind=_FirstQuarter.aspx.vb_<br>

ClassName=_Sales.FirstQuarter_%>

 

c. & LT;%@ Page Language=_vb_<br>

Codebehind=_FirstQuarter.aspx.vb_<br>

Inherits=_Sales.FirstQuarter_%>

 

d. & LT;%@ Page Language=_vb_<br>

Codebehind=_FirstQuarter.aspx.vb_<br>

ClassName=_Sales.FirstQuarter_<br>

Inherits=_FirstQuarter_%>

 

 

 

Ans: C

 

 

 

 

 

46. You create an ASP.NET application named MYProject. You write code to specify

the namespace structure of MYProject by including all class declarations within

a namespace named MYNamespace.

 

You want to compile MYProject so that the fully qualifies namespace of each

class is MYNamespace. You want to prevent the fully qualifies namespace of each

class from being MYProject.MYNamespace.

 

You need to make changes in the Common Properties folder of the Property Pages

dialog box for MyProject.

 

What should you do?

 

a. Change the value of the AssemblyName property to MYNamespace.

 

b. Clear the value of the AssemblyName property and leave it blank.

 

c. Change the value of the RootNamespace property to MYNamespace.

 

d. Clear the value of the RootNamespace property and leave it blank.

 

 

Ans: D

 

 

 

 

47. You are creating an ASP.NET page that enables users to select a country and

view information on tourist attractions in that country. Users select a country

from a list box named countryList.

 

The list box displays country names. The list box also contains hidden country

codes. You code retrieves a cached DataTable object that contains tourist

attraction s and numeric country code named CountryID. The DataTable object is

named attractionsTable. You want to extract an array of DataRow objects from the

DataTable object. You want to include tourist attractions for only the selected

country.

 

Which code segment should you use?

 

a. DataRow[. result = attractionsTable.Select(<br>

_CountryID = _+ countryList.SelectedItem.Text);

 

b. DataRow[. result = attractionsTable.Select(<br>

_CountryID = _+ countryList.SelectedItem.Value);

 

c. DataRow result =<br>

attractionsTable.Rows.Find(<br>

_CountryID = _+ countryList.SelectedItem.Value);

 

d. DataRow result =<br>

attractionsTable.Rows.Find(<br>

countryList.SelectedItem.Value);

 

 

 

Ans: B

 

 

 

 

48. You are creating an ASP.NET application that will be used by companies to

quickly create information portals customized to their business. Your

application stored commonly used text strings in application variables for use

by the page in your application.

 

You need your application to initialize these text strings only when the first

user accesses the application. What should you do?

 

 

a. Add code to the Application_OnStart event handler in the Global.asax file to

set the values of the text strings.

 

b. Add code to the Application_BeginRequest event handler in the Global.asax

file to set the values of the text strings.

 

c. Add code to the Session_OnStart event handler in the Global.asax file to set

the values of the text strings.

 

d. Include code in the Page.Load event handler for the default application page

that sets the values if the text strings when the IsPostback property of the

Page object is False.

 

e. Include code in the PagLoad event handler for the default application page

that sets the values of the text strings when the IsNewSession property of the

Session object is set to tru

 

 

 

Ans: A

 

 

 

 

4. You create a user control named Address that is defined in a file named

Address.ascx. Address displays

address fields in an HTML table.

 

Some container pages might contain more than one instance of the Address user

control. For example, a page

might contain a shipping address and a billing address. You add a public

property named Caption to the

Address user control. The caption property will be used to distinguish the

different instances.

 

You want the caption to be displayed in the first element of the table of

address fields. You

need to add code to the element of the table to display the caption.

 

Which code should you use?

 

 

a. & LT;td><%=Caption%></td & GT;

 

b. & LT;td><script runat=_server_>Caption</script></td & GT;

 

c. & LT;td><script>document.write(_Caption_);</scripts></td & GT;

 

d. & LT;td>=Caption</td & GT;

 

 

 

Ans: A

 

 

 

 

50. You are a Web developer for an online research service. You are creating an

ASP.NET application that will display research results to users of your Web

site.

 

You use a DataGrid control to display a list of research questions and the

number of responses received for each question. You want to modify the control

so that the total number of responses received is displayed in the footer of the

grid. You want to perform this task with the minimum amount of development

effort.

 

What should you do?

 

a. Override the OnPreRender event and display the total when the footer row is

created.

 

b. Override the OnItemCreated event and display the total when the footer row is

created,

 

c. Override the OnItemDataBound event and display the total when the footer row

is bound.

 

d. Override the OnLayout event and display the total in the footer row.

 

 

 

Ans: C

 

 

 

 

 

51. You company is developing an ASP.NET application for producing comparative

insurance quotes from multiple insurance carries. The company wants the

application to provide quotes to a user after the s questions about individual

insurance needs. You deploy a copy of the application to your company's testing

environment so that you can perform unit testing.

 

The Machine.config file on the testing server contains the following element:

 

& LT;trace enabled=_false_ pageOutput=_false_/ & GT;

The Web.config file for your application contains the following element:

& LT;trace enabled=_false_ pageOutput=_false_/ & GT;

 

When you run the application, you find that not all insurance carries are being

displayed on the quote result page. You attempt to view the trace output

information for the quote results page by browsing to the trace.axd URL for your

application. No trace information is shown.

 

You want to be able to examine trace output information by using trace.axd. What

are two possible ways to achieve this goal? (Each Ans: presents a complete

solution. Choose two)

 

a. Modify the element in the Machine.config file as follows:<br>

& LT;trace enabled=_true_ pageOutput=_false_/ & GT;

 

b. Modify the element in the Machine.config file as follows:<br>

& LT;trace enabled=_true_ pageOutput=_true_/ & GT;

 

c. Modify the element in the Web.config file as follows:<br>

& LT;trace enabled=_true_ pageOutput=_false_/ & GT;

 

d. Modify the element in the Web.config file as follows:<br>

& LT;trace enabled=_true_ pageOutput=_true_/ & GT;

 

e. Modify the Page directive for the quote results page so that it contains the

following entry:<br>

Trace=_true_

 

 

 

Ans: C-D

 

 

 

 

 

52. You are creating an ASP.NET application that delivers customized news

content over the Internet. Users make selections from an ASP.NET page. Your code

creates a DataSet object named newsItems, which contains the news items that

meet the criteria selected by the user.

 

You create a style sheet named NewsStyle.xsl that renders the data in newsItems

in HTML format. You write the following code segment:

 

XmlDataDocument doc = new XmlDataDocument(newsItems);<br>

XslTransform tran = new XslTransform();<br>

tran.Load(_NewsStyle.xsl_);<br>

 

You want to display the transformed data as HTML text. Which line of code should

you add the to end if the code segment?

 

a. tran.Transform(doc, null, Response.outputStream);

 

b. tran.Transform(doc, null, Request.InputStream);

 

c. newsItems.WriteXml(Response.OutputStream);

 

d. newsItems.WriteXml(tran.ToString();

 

 

 

Ans: A

 

 

 

 

 

53. You create an ASP.NET page named Receivables.aspx for an accounting

application. The application uses a Microsoft SQL Server database.

 

Receivables.aspx includes a DataGrid control named AgedReceivables. The

AgedReceivables control is used to display the accounts receivable aging

information. You define AgedReceivables in the following HTML code:

 

& LT;asp:DataGrid id=_AgedReceivables_ Runat=_server_

AutoGenerateColumns=_True_></asp:DataGrid & GT;

 

In the Page.Load event handler for Receivables.aspx, AgedReceivables is bound to

the results of the following SQL statement:

 

SELECT AccountName, TotalAmountDue, DaysPastDue FROM

tblReceivables ORDER BY AccountName

 

During testing, users ask you to change the display formatting of

Receivables.aspx to make it easier to identify accounts that are more than 60

days past due. These users want all entries in AgedReceivables that are older

than 60 days to have the DaysPastDue value displayed in red.

 

What should you do to meet this requirements?

 

a. Add the following code to the ItemDataBound event handler for

AgedReceivables:<br>

If CType(CType(e.Item.Controls(2), TableCell.Text,_<br>

Integer)>60 Then<br>

CType(e.Item.Controls(2), TableCell).ForeColor=_<br>

System.Drawing.Color.Red<br>

End If

 

b. Add the following code to the DataBinding event handler for

AgedReceivables:<br>

Dim dg As DataGrid<br>

dg = CType(sender,DataGrid)<br>

If CType(CType(dg.Controls(2), TableCell).Text,_<br>

Integer)>60 Then<br>

CType(dg.Controls(2), TableCell).ForeColor=_<br>

System.Drawing.Color.Red<br>

End If

 

c. In the asp:DataGrid HTML element for AgedReceivables, set the AutoGenerate

attribute to<br>

_False_.<br>

Add the following HTML code within the open and close tags of

AgedReceivables:<br>

<Columns><br>

<asp:BoundColumn DataField=_AccountName_/><br>

<asp:BoundColumn DataField=_TotalAmountDue_/><br>

<asp:BoundColumn DataField=_DaysPastDue_<br>

DataFormatString=_If DataItem(2).Value>60 Then<br>

ForeColor=System.Drawing.Color.Red_/><br>

</Columns>

 

d. In the asp:DataGrid HTML element for AgedReceivables, set the AutoGenerate

attribute to _False_.<br>

Add the following HTML code within the open and close tags of

AgedReceivables:<br>

<Columns><br>

<asp:BoundColumn DataField=_AccountName_/><br>

<asp:BoundColumn DataField=_TotalAmountDue_/><br>

<asp:TemplateColumn><br>

<ItemTemplate><br>

<%# DataBinder.Eval(Container.DataItem, _DaysPastDue_,<br>

_If DataItem.Value>60 Then ForeColor=<br>

System.Drawing.Color.Red_)%><br>

<ItemTemplate><br>

</asp:TemplateColumn><br>

</Columns>

 

 

 

Ans: A

 

 

 

 

54. You are creating an ASP.NET application for your company's human resources

(HR) department. Users in the HR department will use the application to process

new employees. The application automates several activities that include

creating a network login account, creating an e-mail account, registering for

insurance benefits, and other activities.

 

During integration testing of your application, you need to verify that the

individual activities run successfully and in the proper order.

 

Each page in your application includes the following elements in the Page

directive:

Debug=_True_

Trace=_True_

 

You want each page to provide execution information in the Web browser

immediately after the page's normal display output. You need to add

instrumentation to the code in your pages to accomplish this goal.

 

Which statement should you use?

 

a. Trace.Write

 

b. Debug.Print

 

c. System.Diagnostics.Trace.Write

 

d. System.Diagnostics.Debug.Write

 

e. System.Diagnostics.Debugger.Log

 

 

Ans: A

 

 

 

 

 

55. You are creating an ASP.NET accounting application that stores and

manipulates data in a Microsoft SQL Server database. One of the pages in the

application will be used for performing month-end operations to calculate the

balance of all accounts.

 

When a user clicks a button on the page, you want your code to run several

stored procedures to calculate the month-end balances. These procedures must all

succeed before the calculated balances can be stored in the database. If any of

the procedures fail, then you do not want to store any of the month-end

calculated balances. While the procedures are running, you do not want any users

to be able to edit, add, or delete the tables affected by the procedures.

 

What should you do?

 

a. Create a class derived from System.EnterpriseServices.ServicesComponent to

run the stored procedures.<br>

Annotate the class by using a TransactionAttribute type of attribute.<br>

Set the Value property of the attribute to TransactionOption.RequiresNew.

 

b. Create a master stored procedure.<br>

Use this master stored procedure to call the other stored procedures that

perform the monthend operations.<br>

Add WITH REPEATABLEREAD to the master stored procedure.

 

c. Use structured exception handling to catch a SqlException if one of the

stored procedures fails.<br>

Use the Procedure property of the SqlException to identify which stored

procedure generated the exception, <br>

and call a stored procedure to reserve the previous calculations.

 

d. Set the IsolationLevel property of a SqlTransaction object to

IsolationLevel.Serializable.<br>

Assign the SqlTransaction object to the Transaction property of the SqlCommand

object.<br>

Use a SqlCommand object to run the stored procedures.

 

 

Ans: D

 

 

 

 

56. You create an ASP.NET application that will run on your company's Internet

Web site. Your application contains 100 Web pages. You want to configure your

application so that it will display customized error messages to users when an

HTTP code error occurs.

 

You want to log the error when an ASP.NET exception occurs. You want to

accomplish these goals with the minimum amount of development effort.

 

 

Which two actions should you take? (Each Ans: presents part of the solution.

Choose two)

 

a. Create an Application_Error procedure in the Global.asax file for your

application to handle ASP.NET code errors.

 

b. Create an applicationError section in the Weconfig file for your application

to handle ASP.NET code errors.

 

c. Create a CustomErrors event in the Global.asax file for your application to

handle HTTP errors.

 

d. Create a customErrors section in the Web.config file for your application to

handle HTTP errors.

 

e. Add the Page directive to each page in the application to handle ASP.NET code

errors.

 

f. Add the Page directive to each page in the application to handle HTTP errors.

 

 

 

Ans: A-D

 

 

 

 

57. You are creating an ASP.NET page for your company. Employees at the company

will use the page to enter suggested names for new products. Each suggestion is

saved in a Microsoft SQL Server database. The table in the database for

suggestion includes the following three columns.

 

Column name Content<br>

EmployeeID identification number of employee making a suggestion<br>

ProductID identification number for the product being named<br>

Suggestion suggested name for product<br><br>

 

To add a suggestion to the ASP.NET page, an employee logs on by entering the

appropriate EmployeeID and password. The employee then uses a drop-down list box

to select a ProductID and uses a grid to enter suggested names for that product.

The employee can enter multiple suggestions for a single products before

submitting the page.

 

The database table has a unique index that includes the EmployeeID, ProductID,

and Suggestion columns. The unique index does not allow the same suggested name

to be recorded twice for the same product by the same employee.

 

You are using a SqlDataAdapter object to insert the suggestions into the

database. If one of the suggested names for a product is a duplicate, the

database returns an error to your code. You do not want such errors to

interrupts processing. You want your code to continue inserting any remaining

suggestions entered by the employee. You also want to be able to access a list

of any suggested names that were skipped due to errors.

 

What should you do?

 

a. Set the SqlDataAdapter object's ContinueUpdateOnError property to true before

calling the object's Update method.

 

b. Enclose your call to the SqlDataAdapter object's Update method in a try/catch

block. In the Catch code, set the object's ContinueUpdateOnError property to

true.

 

c. Create an event handler for the SqlDataAdapter object's RowUpdated event. In

the event handler, if the SqlRowUpdatedEventArgs object's UpdateStatus property

has a value of UpdateStatus.ErrorsOccured, then set the SqlDataAdapter object's

ContinueUpdateOnErrorProperty to true.

 

d. Create an event handler for the SqlDataAdapter object's RowUpdated event. In

the event handler, if the SqlRowUpdatedEventArgs object's Errors property

returns a nonnull value, then set the SqlDataAdapter object's

ContinueUpdateOnError property to true.

 

 

 

Ans: A

 

 

 

 

 

58. You are creating an ASP.NET application for an insurance company. Customers

will use this application to manage their own insurance policies. For example, a

customer can use the application to renew policies.

 

An existing COM component named PolicyLibrary.dll contains the logic for

calculating the renewal premium. PolicyLibrary.dll is written in Visual Basic

6.0. The class that performs the calculations is named cPolicyActions. The

CalculateRenewal function of cPolicyActions accepts a policy identification

number and returns a premium as a Double.

 

You need to use PolicyLibrary.dll in your ASP.NET application. You also need to

enable the application to use the cPolicyActions class.

 

What should you do?

 

a. Run the following command in a command window:<br>

TLBIMP.EXE PolicyLibrary.DLL /out:PolicyLibrary.NET.DLL<br>

Copy the original PolicyLibrary.dll to the /bin directory of your ASP.NET

application.

 

b. Run the following command in a command window:<br>

TLBEXP.EXE PolicyLibrary.DLL /out:PolicyLibrary.NET.DLL<br>

Copy the original PolicyLibrary.dll to the /bin directory of your ASP.NET

application.

 

c. Select Add Existing Item from the Project menu in Visual Studio .NET and

browse to PolicyLibrary.dll.

 

d. Select Add Reference from the Project menu in Visual Studio .NET, select the

COM tab, and browse to PolicyLibrary.dll.

 

 

 

Ans: D

 

 

 

59. You are creating an ASP.NET application for an online banking site. You need

to allow customers to transfer funds between accounts. You write a component in

Visual Basic .NET to handle transfers of founds. This component is used by the

page named FundsTransfer.aspx.

 

For unit testing, you add the following code segment to the TransferFunds method

of your component. (Line numbers are included for reference only.

 

1 Dim ctx As HttpContext

2 ctx =HttpContext.Current

3 ctx.Trace.Write(_Founds transfer requested._)

 

You want to be able to view the trace output on the FoundsTransfer.aspx page.

What should you do?

 

a. Add code to the FoundsTransfer.aspx page that instantiates a Trace listener.

 

b. Enable tracing in the Page directive for the FundsTransfer.aspx page.

 

c. Add the following attribute to the Machine.config file: <trace

enabled=_true_>

 

d. Modify line 3 of the code segments as follows:

System.Diagnostics.Trace.WriteIf(ctx.IsDebuggingEnabled, _Funds transfer

requeste_)

 

 

 

Ans: B

 

 

 

 

60. You create English, French, and German versions of your ASP.NET application.

You have separate resource files for each language version. You need to deploy

the appropriate resource file based on the language settings of the server.

 

What should you do?

 

a. Create an installer and set the Installer.Context property for each version

of your application.

 

b. Create an installer that has a launch condition to verify the locale

settings.

 

c. Create an installer that has a custom action to install only

location-specific files.

 

d. Create an installer that has an MsiConfigureProduct function to install the

appropriate version.

 

 

 

Ans: C

 

 

 

 

61. You company hosts an ASP.NET application that provides customer demographic

information. Some of the demographics data is presented by using images.

 

The target audience for the application includes a significant number of users

who have low vision. These individuals use various browsers that vocalize the

textual content of Web pages. These users need to receive the content of the

images in vocalized form.

 

You need to modify the application to make it accessible for your target

audience. You need to accomplish this task with the minimum amount of

development effort.

 

How should you modify the application?

 

a. Modify all ASP.NET pages in the application so that the view state is

enabled.

 

b. Modify all ASP.NET pages in the application to add custom logic that conveys

the demographic information in either textual or graphical format.

 

c. Modify all images in the application so that the ToolTip property conveys the

same demographic information as the image.

 

d. Modify all images in the application so that the AlternateText property

conveys the same demographic information as the image.

 

 

Ans: D

 

 

 

 

62. You are planning the deployment of an ASP.NET application. The application

uses a Visual Studio .NET component named DataAccess that will be shared with

other applications on your Web server.

 

You are using Visual Studio .NET to create a Windows Installer package. You need

to deploy DataAccess and the ASP.NET application so that they can be uninstalled

later of necessary.

 

What should you do?

 

a. Create a setup project for DataAccess.<br>

Add the ASP.NET application in a custom action.

 

b. Create a setup project for the ASP.NET application.<br>

Create another setup project for DataAccess.

 

c. Create a Web setup project for the ASP.NET application.<br>

Add a project output for DataAccess.

 

d. Create a Web setup project for the ASP.NET application.<br>

Add a merge module for DataAccess.

 

 

 

Ans: D

 

 

 

 

 

63. You are debugging an ASP.NET application that was written by other

developers at your company. The developers used Visual Studio .NET to create the

application. A TextBox control on one of the .aspx pages incorrectly identifies

valid data values as being invalid.

 

You discover that the validation logic for the TextBox control is located within

a method that is defined in client-side code. The client-side code is written in

Visual Basic Scripting Edition. You want to verify that the validation method is

receiving valid input parameters when the page is running. You need to perform

this task by stepping through the client-side code as it runs.

 

Which four courses of action should you take? (Each Ans: presents part of the

solution. Choose two)

 

a. In Internet Explorer, cleat the Disable script debugging check box in the

advanced options and browse to the page that contains the client-side code.

 

b. In Visual Studio .NET, select Debug Processes from the Tools menu and attach

to the local copy of IExplore.exe. In the Running Document window, select the

..aspx page that you want to debug.

 

c. Create a new active solution configuration named Client and copy the settings

from the Release configuration. Select the new configuration in the

Configuration Manager.

 

d. Set the following attribute in the application's Web.config file:

debug=_true_

 

e. In Solution Explorer, open the source for the .aspx file that you want to

debug and select Start from the Debug menu.

 

f. In Visual Studio .NET, set a breakpoint or add a Stop statement in the

client-side code where you want to begin interactive debugging.

g. In Internet Explorer, perform the actions that cause the client-side code to

run.

 

 

 

Ans: A-B-F-G

 

 

 

 

 

64. You are creating an order entry application. You set Orders.aspx as the

start page. You want users to log on to Orders.aspx by supplying a user name and

password. You create a Login.aspx page to validate the user name and password.

 

You need to ensure that users log on by using Login.aspx before they are allowed

to access Orders.aspx. Which two courses of action should you take? (Each Ans:

presents part of the solution. Choose two)

 

a. In the authentication section of the Web.config file, set the mode attribute

of the authentication element to Forms. Set the name attribute of the forms

element to Login.aspx.

 

b. In the authentication section of the Weconfig file, set the mode attribute of

the authentication element to Forms. Set the loginUrl attribute of the forms

element to Login.aspx.

 

c. In the authorization section of the Web.config file, set the users attribute

of the deny element to _?_:

 

d. In the credentials section of the Web.config file, set the users attribute of

the dent element to _?_.

 

e. In the credentials section of the Machinconfig file, set the users attribute

of the deny element to _*_.

 

f. In the authorization section of the Machine.config file, set the mode

attribute of the authentication element to Forms. Set the policyFile attribute

of the trust element to Login.aspx.

 

g. Create a Page directive in Orders.aspx to load the Login.aspx page.

 

 

 

Ans: B-C

 

 

 

 

 

65. You create an ASP.NET application that will be sold to your company's

corporate customers. The corporate customers will buy your application and run

it on their intranets.

 

You create a Web setup project for your application and add it to your ASP.NET

solution. You also add a file named Readme.txt to the Web setup project.

 

You create the deployment package and install it on a test server. You notice

that the deployment package installed Readme.txt in the Web application folder.

You want the deployment package to add a shortcut to Readme.txt to the desktop

on the server computer.

 

What should you do?

 

a. Add Readme.txt to your solution and rebuild the deployment package.

 

b. Select Readme.txt in the Web setup project. Change the TargetName property to

DESKTOP\Readme.txt.

 

c. In the Web setup project, add the User's Desktop folder to the File System on

Target Machine node. Add a shortcut to Readme.txt in the User's Desktop folder.

 

d. In the Web setup project, add a custom folder to the File System on Target

Machine node. Name the folder Server Desktop and add a shortcut to Readme.txt in

that folder.

 

 

 

Ans: C

 

 

 

 

 

66. You create an ASP.NET application for a bank. The application provides

account management functionality.

 

A page named AccountWithdrawal.aspx contains a method named WithdrawFunds. The

WithdrawFunds method is defined in the following code segment. (Line numbers are

included for reference only.)

 

1 Private Function WithdrawFunds(Amount As Double) as Double

2

3 m_dAccountBalance-= Amount

4 Return m_dAccountBalance

5 End Function

 

The callers of this method need to verify that sufficient funds exist in the

account before attempting to withdrawal. During unit testing, you want to

receive notification when a call is made requesting a withdrawal amount for

which the account does not have sufficient funds available.

 

You plan to build the production version of your application by using the

Release Build Configuration in Visual Studio .NET. You need the testing

instrumentation to be included but not enabled in the application when the

application is deployed to production. You need to have the ability to enable

the instrumentation after deploying it to production without requiring the

application to be rebuilt.

 

Which code should you insert at line 2 of the code segment?

 

a. Debug.Assert(m_dAccountBalance - Amount >=0,_<br>

_Insufficient funds for withdrawal._)

 

b. Trace.Assert(m_dAccountBalance - Amount >=0,_<br>

_Insufficient funds for withdrawal._)

 

c. Debug.WriteLineIf(m_dAccountBalance - >=0,_<br>

_Insufficient funds for withdrawal._)

 

d. Trace.WriteLineIf(m_dAccountBalance - Amount >=0,_<br>

Insufficient funds for withdrawal._)

 

 

 

Ans: B

 

 

 

 

 

67. You are configuring security for your ASP.NET application. The folders for

your pages are located in a hierarchy as shown in the exhibit.

 

You need to allow all uses to access pages located in the Products folder and

the Orders folder. You need to allow any members of the Accounting role to

access pages located in the Accounting folder.

 

What are two possible waves achieve this goal? (Each Ans: presents a complete

solution. Choose two)

 

a. Add code to the Global.asax file to dynamically configure access to the

Accounting folder.

 

b. Place the authorization settings for all roles in the Weconfig file located

in the Products folder.

Use the location tag in the Weconfig file to deny access to the Accounting

folder for all roles except the Accounting role.

 

c. Place the authorization settings for all roles in the Web.config file located

in the Products folder. Allow access for only members of the Accounting role in

the Web.config file located in the Accounting folder.

 

d. Create two custom roles in the Machine.config file for the application.

Configure one role for all users, and one role for the Accounting users. Deny

access to the Accounting folder for all users except members of the Accounting

role.

 

 

Ans: B-C

 

 

 

68. You create an assembly to access data in a relational database. This

assembly will be used by several ASP.NET applications on your Web server.

 

You need to ensure that all your applications can access the assembly. Which two

actions should you take? (Each Ans: presents part of the solution. Choose two)

 

a. Run the Assembly Registration tool (Regasm.exe).

 

b. Run the String Name tool (Sn.exe).

 

c. Run the Installer tool (Intallutil.exe).

 

d. Run the Global Assembly Cache tool (Gacutil.exe).

 

 

 

Ans: B-D

 

 

 

69. You create an ASP.NET application for an online shopping site. The

application uses a Microsoft SQL Server 2000 database. The database contains a

stored procedure named getProductsByCategory that returns all products that

match a specified category code. The category code is supplied as a parameter

named @ProdCode.

 

The application includes a page named ShowProducts.aspx. You are using Visual

Studio .NET to debug ShowProducts.aspx.

 

ShowProducts.aspx uses the getProductsByCategory stored procedure to populate a

DataSet object. You set a breakpoint within getProductsByCategory so that you

can step through the stored procedure within the debugger.

 

Which you are debugging getProductsByCategory, you need to view the current

value of @ProdCode.

 

What should you do?

 

a. Open the Locals debugging window.

 

b. Open the Modules debugging window.

 

c. Add the following line of code to getProductsByCategory:

Print @ProdCode

Open the Output debugging window and select Debug as the source from the

drop-.down list

box.

 

d. Add the following line of code to getProductsByCategory:

SELECT @ProdCode As DebugOutput

Open the Output debugging window and select Database Output as the source from

the dropdown list box.

 

 

 

Ans: A

 

 

 

 

 

70. You are configuring your ASP.NET application. The application will be hosted

on a Web server that also runs other applications.

 

You want to prevent any changes to the configuration settings of your

application after the application is deployed.

 

What should you do?

 

a. In the Machine.config file, set the allowOverride attribute in the location

element to False.

Make no other changes to the Machine.config file.

 

b. In the Weconfig file, set the allowOverride attribute in the location element

to False.

Make no other changes to the Weconfig file.

 

c. In the Machine.config file, set the allowOverride attribute in the

appSettings element to False.

Make no other changes to the Machine.config file.

 

d. In the Web.config file, set the allowOverride attribute in the appSettings

element to False.

Make not other changes to the Web.config file.

 

 

 

Ans: B

 

 

 

 

71. You create an ASP.NET application for online ordering. You need to store a

small amount of page-specific information on pages that are submitted to the

server. This information does not need to be secured. The page must work

properly for browsers that do not support cookies.

 

You anticipate that the volume of orders on the site will be high, and you need

to conserve server resources.

 

What should you do?

 

a. Store the information in application state variables.

 

b. Store the information in session state variables.

 

c. Store the information in a Microsoft SQL Server database.

 

d. Store the information in hidden fields on the page.

 

 

Ans: D

 

 

 

 

72. You are creating a new ASP.NET page named ItemList that displays item and

price information for many different items. When a user logs on to the Web site,

the page retrieves the current list of prices from a database. ItemList will be

accessed by several thousand registered users.

 

When a price list is retrieved for a user, the prices remain valid for as long

as the user continues to access the page. Users are allowed to keep the same

price list for several days.

 

When ItemList is posted back to the server, you want to ensure that the price

list was not altered on the user's computer. You also want to minimize the

memory resources consumed on the Web server.

 

Which three parameters should you add to the Page directive in ItemList? (Each

Ans: presents part of the solution. Choose three.)

 

a. EnableSessionState= " True "

 

b. EnableSessionState= " False "

 

c. EnableSessionState= " ReadOnly "

 

d. EnableViewState= " True "

 

e. EnableViewState= " False "

 

f. EnableViewStateMac= " True ''

 

g. EnableViewStateMac= " False "

 

 

 

Ans: B-D-F

 

 

 

 

73. You are a Web developer for Lucerne Publishing. You are performing a

migration of your company's ASP-based Web page named Booklist.asp to ASP.NET.

You want to deploy the ASP.NET version of your Web page with the minimum amount

of development effort. You also want the migration to be accomplished as quickly

as possible.

 

The page contains a COM component named Luceme.BookList. The component is

written in Visual Basic 6.0. When you open the new page, you receive the

following error message: " Server Error - The component 'Luceme.BookList' cannot

be created. "

 

You need to ensure that you can open the Web page successfully. What should you

do?

 

a. Write a managed component to perform the tasks that the Lucerne.BookList

component currently performs.

 

b. Set the AspCompat attribute of the Page directive to true.

 

c. Add the following line of code to the Page.Load event handler:<br>

RegisterRequiresPostBack( " Lucerne.BookList " )

 

d. Add the following attribute to the processModel element of the Web.config

file:<br>

comlmpersonationLevel --- Delegate

 

 

 

Ans: B

 

 

 

 

74. You are creating an ASP.NET page for a travel service. The page contains a

CheckBoxList control that contains travel destinations.

 

Customers can select favorite destinations to receive weekly e-mail updates of

travel packages. The CheckBoxList control is bound to a database table of

possible destinations. Each destination is ranked according to its popularity.

 

You modify the page to sort the destination list by rank, from the most popular

to the least popular. The list has three columns.

 

You want the most popular destinations to be on the top row of the check box

list at run time. Which property setting should you use for the CheckBoxList

control?

 

a. Set the RepeatDirection property to Vertical.

 

b. Set the RepeatDirection property to Horizontal.

 

c. Set the RepeatLayout property to Flow.

 

d. Set the RepeatLayout property to Table.

 

 

 

Ans: B

 

 

 

 

75. You are creating an ASP.NET application for your company's intranet.

Employees will use this application to schedule conference rooms for meetings.

The scheduling page includes a Calendar control that employees can use to choose

a date to reserve a room. The Calendar control is defined as follows:

 

& LT;asp:calendar id= " WorkDays " runat=- " server "

OnDayRender= " WorkDays_DayRender " / & GT;

 

You want to display a message that reads " Staff Meeting " below every Friday

displayed in the calendar. You also want to find all the weekdays for the

current month displayed in the calendar and show them with a yellow highlight.

 

You are writing code for the WorkDays.DayRender event handler to perform these

tasks. You write the following code. (Line numbers are included for reference

only.)

 

1 Sub WorkDays_DayRender(sender As Object, e As DayRenderEventArgs)

2

3 End Sub

Which code should you add at line 2 of the event handler?

 

a. If e.Day.Date.DayOfWeek =_<br>

DayOfWeek.Friday Then<br>

e Cell.Controls.Add( _<br>

New LiteralControi( " Staff Meeting " ))<br>

End If<br>

If Not e.Day.lsWeekend Then<br>

e CelI.BackCoior = _<br>

System.Drawing.Color.Yellow<br>

End If

 

b. lfe.Day.Date.Day = 6 _<br>

And e.Day.lsOtherMonth Then<br>

e CelI.Controls.Add( _<br>

New LiteralControl( " Staff Meeting " ))<br>

e CelI.BackColor = _<br>

System.Drawing.Color.Yellow<br>

End If

 

c. If e.Day.Date.Day = 6 Then<br>

e CelI.Controls.Add( _<br>

New LiteralControl( " Staff Meeting " ))<br>

End If<br>

If Not e.Day.lsWeekend And Not _<br>

e Day.lsOtherMonth Then<br>

e Cell.BaekColor =<br>

System.Drawing.Color.Yellow<br>

End If

 

d. If e.Day.Date.DayOfWeek =_

DayOfWeek.Friday Then

e CelI.Controls.Add( _

New LitemlControl( " Staff Meeting " ))

End If

lfNot e.Day.lsWeekend And Not _

e Day.lsOtherMonth Then

e Cell.BackColor = _

System.Drawing.Color.Yellow

End If

 

 

 

Ans: D

 

Comment: I deleted a dot between the e and the Celi because trandumper read the

like answer <br>

e.Celi.control.Add(

 

 

 

76. You are a Web developer for an airline company. You are developing a Web

site for customers who participate in the company's frequent flyer program.

 

The frequent flyer program includes three levels of award for customers. The

levels are named Emerald, Ruby, and Diamond. For each award level, the page

contains content specific to that award level. The page contents are contained

in three user controls, which are named Emerald.ascx, Ruby.ascx, and

Diamond.ascx.

 

You want to dynamically load and display the proper page header based on the

value contained in a variable named awardLevel. The awardLevel variable is a

property of the page. In addition, you want to minimize the amount of memory

resources each page uses.

 

Which code should you use in the Page.Load event handler?

 

a. Dim headerControl As UserControl<br>

Select Case awardLevel<br>

Case " Emerald " <br>

headeiControl = LoadControl( " Emerald.ascx " )<br>

Case " Ruby " <br>

headerControl = LoadControl( " Ruby.ascx " )<br>

Case " Diamond " <br>

headerControl = LoadControl( " Diamond.ascx " )<br>

End Select<br>

Controls.Add(headerControl)

 

b. Dim headerControl As UserControl<br>

Select Case awardLevel<br>

Case " Emerald " <br>

headerControl = LoadControl( " Emerald.ascx " )<br>

Case " Ruby " <br>

headerControi = LoadControl( " Ruby.ascx " )<br>

Case " Diamond " <br>

headerControl = LoadControl( " Diamond.ascx " )<br>

End Select

c. emeraldHeaderControl.Visible = False<br>

rubyHeaderControI.Visible = False<br>

diamondHeaderControl.Visible = False<br>

Select Case awardLevel<br>

Case " Emerald " <br>

emeraldHeaderControl.Visible = True<br>

Case " Ruby " <br>

rubyHeaderControl.Visible = True<br>

Case " Diamond " <br>

diamondHeaderControl.Visible = True<br>

End Select

 

d. Dim emeraldHeaderControl As UserControi<br>

Dim rubyHeaderControl As UserControl<br>

Dim diamondHeaderControl As UserControl<br>

emeraldHeaderControl = LoadControl( " Emeralascx " )<br>

rubyHeaderControl = LoadControl( " Ruby.ascx " )<br>

diamondHeaderControl = LoadControl( " Diamonascx " )<br>

Select Case awardLevel<br>

Case " Emerald " <br>

Controls.Add(emeraldHeaderControl)<br>

Case " Ruby " <br>

Controls.Add(rubyHeaderControl)<br>

Case " Diamond " <br>

Controls.Add(diamondHeaderControl)<br>

End Select

 

 

 

Ans: A

 

 

 

 

 

77. You are maintaining an ASP.NET application. Another developer wrote the

following code for the WebForml.aspx file:

 

& LT;%@ Page language= " vb '' Codebehind= " WebForml .aspx.vb " <br>

lnherits= " WebForm 1 " %><br>

& LT;HTML & GT;<br>

& LT;body MS_POSIT1ONING= " GridLayout " & GT;<br>

& LT;form id= " Forml " method= " post " runat= " server " & GT;<br>

& LT;asp: Button id =''Button 1 " style= " Z-INDEX: 101;<br>

LEFT: 203px, POSITION: absolute; TOP: 206px " <br>

runat=- " server " Text=- " Submit " Width= " 132px " <br>

Height= " 25px " & GT; & LT/asp:Button & GT;<br>

& LT;/form & GT;<br>

& LT;/body & GT;<br>

& LT;/HTML & GT;

 

You are debugging the application, and you set a breakpoint in the Page.Load

event handler. You notice that when you click the Submit button, the application

stops at your breakpoint twice for each time that you click the button.

 

You need to ensure that you stop at the breakpoint only once for each time that

you click the Submit button. What should you do?

 

a. Add the following attribute to WebForml .aspx:<br>

smartNavigation= " True "

 

b. Add the following attribute to WebForml .aspx:<br>

smartNavigation= " False ''

 

c. Add the following attribute to the Page directive:<br>

AutoEventWireup= " Tme "

 

d. Add the following attribute to the Page directive:<br>

AutoEventWireup= " False "

 

 

 

Ans: D

 

 

 

 

 

78. You create an ASP.NET application for your company's intranet. All employees

on the intranet use Interact Explorer.

 

A page named UserAccount.aspx contains several controls that require postbacks

to the server for event processing. The event handlers for these controls

require access to a database in order to complete their processing.

 

Each time UserAccount.aspx performs a postback, there is a brief period of time

in which the browser window is blank while the page is refreshed. The control

that had the focus prior to the postback does not have the focus after the page

is re-rendered. This factor results in confusion and invalid data entry by some

of the users.

 

You need to modify UserAccount.aspx to prevent the browser window from going

blank after a postback and to maintain the correct control focus after events

are processed. You need to accomplish this task with the minimum amount of

development effort.

 

What should you do?

 

a. Add the following attribute to the HTML code for the controls that cause the

postbacks:<br>

RunAt=- " client "

 

b. Add the following attribute to the HTML code for the controls that cause the

postbacks:<br>

EnableViewState= " True "

 

c. Add the following attribute to the Page directive for UserAccount.aspx:<br>

SmartNavigation= " True "

 

d. Add the following attribute to the OutputCache directive for

UserAccount.aspx:<br>

Location= " client "

 

 

 

Ans: C

 

 

 

 

 

79. You create an ASP.NET page named CorporateCalendar.aspx that shows

scheduling information for projects in your company.

 

The page is accessed from various other ASP and ASP.NET pages hosted throughout

the company's intranet. All employees on the intranet use Intemet Explorer.

 

CorporateCalendar.aspx has a Calendar control at the top of the page. Listed

below the Calendar control is detailed information about project schedules on

the date selected. When a user selects a date in the calendar, the page is

refreshed to show the project schedule details for the newly selected date.

 

Users report that after viewing two or more dates on CorporateCalendar.aspx,

they need to click the browser's Back button several times in order to return to

the page they were viewing prior to accessing CorporateCalendar.aspx.

 

You need to modify CorporateCalendar.aspx so that the users need to click the

Back button only once.

 

What should you do?

 

a. Add the following statement to the Page.Load event handler for

CorporateCalendar.aspx: Response.Expires(0)

 

b. Add the following statement to the Page.Load event handler for

CorporateCalendar.aspx: Response.Cache.SetExpires (DateTime.Now0)

 

c. Add the following attribute to the Page directive for CorporateCalendar.aspx:

EnableViewState= " True "

 

d. Add the following attribute to the Page directive for CorporateCalendar.aspx:

SmartNavigation= " True "

 

 

 

Ans: D

 

 

 

 

80. You are creating an ASP.NET page to enroll new members in a health care

program. One of the requirements for membership is that a participant must be at

least 65 years old.

 

You need to ensure that each prospective member enters a name in a TextBox

control named nameTextBox and a date of birth in a TextBox control named

birthdayTextBox. In addition, you need to verify that prospective members meet

the age requirement.

 

What should you do?

 

a. Add a CustomValidator control to the page.<br>

In the Properties window, set the ControiToValidate property to

birthdayTextBox.<br>

Write code to validate the date of birth.<br>

Add a RegularExpressionValidator control to the page.<br>

In the Properties window, set the ControlToValidate property to nameTextBox, and

create a regular expression to validate the name.

 

b. Add a CompareValidator control to the page.<br>

In the Properties window, set the ControlToValidate property to

birthdayTextBox.<br>

Write code that sets the Operator and ValueToCompare properties to validate the

date of birth.<br>

Add a RequiredFieldValidator control to the page.<br>

In the Properties window, set the ControiToValidate property to nameTextBox.

 

c. Add a RangeValidator control to the page.<br>

In the Properties window, set the ControlToValidate property to

birthdayTextBox.<br>

Write code that sets the MinimumValue and MaximumValue properties to validate

the date of birth.<br>

Add a CompareValidator control to the page.<br>

In the Properties window, set the ControlToValidate property to nameTextBox.<br>

Add a second CompareValidator control to the page.<br>

In the Properties window, set the ControlToValidate property to

birthdayTextBox.<br>

Write code that sets the Operator and ValueToCompare properties of the two

CompareValidator <br>

controls to validate the name and date of birth.

 

d. Add a CustomValidator control to the page.<br>

In the Properties window, set the ControlToValidate property to birthdayTextBox,

and write code to validate the date of birth.

Add a RequiredFieldValidator control to the page.<br>

In the Properties window, set the ControlToValidate property to nameTextBox.<br>

Add a second RequiredFieldValidator control to the page.<br>

In the Properties window, set the ControlToValidate property to birthdayTextBox.

 

 

Ans: D

 

 

 

 

81. You are creating an ASP.NET page for recording contact information. The page

contains a TextBox control named emailTextBox and a TextBox control named

phoneTextBox. Your application requires users to enter data in both of these

text boxes.

 

You add two RequiredFieldValidator controls to the page. One control is named

emailRequired, and the other control is named phoneRequired. You set the

ControlToValidate property of emailRequired to emailTextBox. You set the

ControlToValidate property of phoneRequired to phoneTextBox. In addition, you

add a ValidationSummary control at the bottom of the page.

 

If the user attempts to submit the page after leaving email TextBox blank, you

want the word " Required " to appear next to the text box. If the user leaves

phoneTextBox blank, you also want the word " Required " to appear next to the text

box.

 

If the user attempts to submit the page after leaving emailTextBox or

phoneTextBox blank, you also want to display a message at the bottom of the

page. You want to display a bulleted list, showing which required entries are

missing. If emailTextBox is blank, you want the bulleted list to include the

following phrase: " E-mail is a required entry. " If phoneTextBox is blank, you

want the bulleted list to include the following phrase: " Telephone number is a

required entry. "

 

What should you do?

 

a. Set the InitialValue property of each RequiredFieldValidator control to

" Required " .<br>

Set the ErrorMessage property of emailRequired to " E-mail is a required

entry. " <br>

Set the ErrorMessage property of phoneRequired to " Telephone number is a

required entry. "

 

b. Set the Display property of each RequiredFieldValidator control to

Dynamic.<br>

Set the ErrorMessage property of emailRequired and phoneRequired to

" Required " .<br>

Set the Text property of emailRequired to " E-mail is a required entry. " <br>

Set the Text property of phoneRequired to " Telephone number is a required

entry. "

c. Set the lnitialValue property of each RequiredFieidValidator control to

" Required " .<br>

Set the Text property of emailRequired to " E-mail is a required entry. " <br>

Set the Text property of phoneRequired to " Telephone number is a required

entry. "

 

d. Set the Text property of each RequiredFieidValidator control to

" Required " .<br>

Set the ErrorMessage property of emailRequired to " E-mail is a required

entry. " <br>

Set the ErrorMessage property of phoneRequired to " Telephone number is a

required entry. "

 

 

 

Ans: D

 

 

 

 

 

82. You are creating an ASP.NET application for an online store that sells

movies on videocassette. Each user is assigned a profile based on the user's

previous purchases. You write a procedure named DisplayRecommendations that

calls the LoadUserProfile function and displays a list of movie recommendations

when a user logs on. The LoadUserProfile function throws a FileNotFoundException

if the user profile cannot be found.

 

When the FileNotFoundException is thrown, you want to throw a more descriptive

error. The text of the error message is stored in a variable named String. You

also want the FileNotFoundException error to be accessible programmatically for

debugging purposes.

 

You need to program the catch block for the exception. Which code should you

use?

 

a. Catch ex As ApplicationException<br>

Throw New ApplicationException(String, ex)

 

b. Catch ex As FileNotFoundException<br>

Throw New ApplicationException(String, ex)

 

c. Catch ex As ApplicationException<br>

Throw New ApplicationException(String, _

ex.lnnerException)

 

d. Catch ex As FileNotFoundExeeption<br>

Throw New ApplicationException (String, _

ex.InnerException)

 

 

 

Ans: B

 

 

 

 

83. You deploy an ASP.NET application. When an error occurs, the user is

redirected to a custom error page that is specified in the Web.config file.

 

Users report that one particular page is repeatedly generating errors. You need

to gather detailed error information for the page. You need to ensure that users

of the application continue to see the custom error page if they request pages

that generate errors.

 

What should you do?

 

a. In the Web.config file, set the mode attribute of the customErrors element to

RemoteOnly and access the page from a browser on your client computer.

 

b. In the Weconfig file, set the mode attribute of the customErrors element to

RemoteOnly and access the page from a browser on the server.

 

c. Modify the Page directive so that the Trace attribute is set to True and the

LocalOnly attribute is set to true, and then access the page from a browser on

the server.

 

d. Modify the Web.config file to include the following element:<br>

& LT;trace enabled= " true '' LocalOnly= " false ''<br>

PageOutput= " true " / & GT;<br>

Access the application from a browser on your client computer.

 

 

Ans: B

 

 

 

 

84. You create an ASP.NET page that displays customer order information. This

information is displayed in two separate DataGrid controls on the page. The

first DataGrid control displays the current year orders, and the second DataGrid

control displays all orders from previous years. The page uses both the

System.Data.SqlClient namespace and the System.Dab namespace.

 

The information is stored in a Microsoft SQL Server database. A customer's

complete order history information is obtained from the database by calling a

stored procedure named GetOrders and passing the customer's identification

number as a parameter.

 

The Page.Load event handler populates a DataView object named myDataView with

the results of calling the GetOrders stored procedure. The following code

segment in the Page.Load event handler is then used to bind the two DataGrid

controls to myDataView:

 

dataGridCurrentYear.DataSource = myDataView<br>

myDataView.RowFilter = " OrderDate >= #01/01/ " & _<br>

Now.Year & " # " <br>

dataGridCurrentYear.DataBind0<br>

dataGridPreviousYears.DataSource = myDataView<br>

myDataView.RowFilter = " OrderDate < #01/01/ " & _<br>

Now.Year & " # " <br>

dataGridPreviousYears.DataBindO<br>

Page.DataBind0<br><br>

 

During testing, you discover that both DataGrid controls are displaying order

information for the previous years only. What should you do to correct this

problem?

 

a. Remove the Page.DataBind0 statement.

 

B. Remove the dataGridPreviousYears.DataBind0 statement.

 

C. Add a Response.Flush0 statement immediately before the Page.DataBind0

statement.

 

D. Add a Response.Flush0 statement immediately before the

dataGridPreviousYears.DataBind0 statement.

 

 

 

Ans: A

 

 

 

 

 

85. You are creating an ASP.NET application that will display facts about the

solar system. This application will support localization for users from France,

Germany, Japan, and the United States. To see information about a particular

planet, the user will select the planet from a drop-down list box on

SolarSystem.aspx.

 

You want to display the planet names in the drop-down list box in the language

appropriate to the individual who is using the application.

 

What should you do?

 

a. Create a database table named Planets.<br>

Create three columns named PlanetlD, LocalelD, and .<br>

Use SqlCommand.ExecuteReader to query the table for the locale specified in the

request.<br>

Using the locale specified in the request, translate the values by using the

Textlnfo.OEMCodePage property.<br>

Populate the drop-down list box with the translated text.

B. Create a DataTable object named Planets.<br>

Populate the Planets DataTable object by using string constants.<br>

Using the locale specified in the request, translate the values by using a

UnicodeEncoding object.<br>

Bind the DataSouree property of the drop-down list box to the DataTable object.

 

C. Create a database table named Planets.<br>

Create two columns named PlanetlD and .<br>

Use a SqlDataAdapter to load the planet information into a DataSet object.<br>

Using the locale specified in the request, use the String format provider to

translate the values.<br>

Bind the DataSource property of the drop-down list box to the

DataSet.DefaultView object.

 

D. Create string resource assemblies for each locale.<br>

Using the locale specified in the request, use a ResourceManager to load the

appropriate assembly.<br>

Populate an array with the string values from the assembly.<br>

Bind the DataSource property of the drop-down list box to the array.

 

 

 

Ans: D

 

 

 

 

 

86. You are creating an ASP.NET application for your company. The company

deploys an XML Web service that returns a list of encyclopedia articles that

contain requested keywords. You want to create a class that calls the XML Web

service. What should you do?

 

a. Select Add Web Service from the Project menu in Visual Studio .NET and browse

to the XML Web service.

 

b. Select Add Reference from the Project menu in Visual Studio .NET and browse

to the XML Web service.

 

c. Select Add Web Reference from the Project menu in Visual Studio .NET and

browse to the XML Web service.

 

d. Run the Type Library Importer (Tibimp.exe) and provide it with the URL for

the XML Web service.

 

e. Run the Web Services Discovery tool (Disco.exe) and provide it with the URL

for the XML Web servic

 

 

 

Ans: C

 

 

 

 

87. You are creating an ASP.NET application for the mortgage services department

of Woodgrove Bank. The application will be used for generating documents that

are required during the closing process of a home purchase.

 

Woodgrove Bank already has a component written in Visual Basic .NET that

identifies which forms are required to be printed based on a set of criteria

specified by the closing agent. The name of the component namespace is

Woodgrovebank.Mortgage. The name of the class is Closing.

 

You create an ASP.NET page named Purchase.aspx. You add a reference to the

assembly that contains the Woodgrovebank.Mortgage namespace. The code-behind

file for Purchase.aspx includes the following code:

 

Imports Woodgrovebank.Mortgage

 

You add a method to the code-behind file to instantiate the Closing class. Which

code segment should you include in the method to instantiate the class?

 

a. Dim myClosing As New Closing()

 

b. Dim myClosing As Closing<br>

closing = Server.CreateObject( " Closing " )

 

c. Dim myClosing As System.Object<br>

closing = Server.CreateObject( " Closing " )

 

d. Dim myType As Type = _<br>

Type.GetTypeFromProglD( " Woodgrovebank.Mortgage.Closing " -<br>

, " localhost " , True)

 

 

 

Ans: A

 

 

 

 

 

88. You are a Web developer for Wide World Importers. You are creating an online

inventory Web site to be used by employees in Germany and the United States.

When a user selects a specific item from the inventory, the site needs to

display the cost of the item in both United States currency and German currency.

The cost must be displayed appropriately for each locale.

 

You want to create a function to return the currency in the correct format based

on the input parameter.

 

Which code should you use?

 

a. Function MyGetDisplayValue(value As Double, _<br>

inputRegion As String) As String<br>

Dim display As String<br>

Dim region As Regionlnfo<br>

region = New Regionlnfo(inputRegion)<br>

display = value.ToString( " C " )<br>

display += region.CurrencySymbol<br>

Return display<br>

End Function

 

b. Function MyGetDisplayValue(value As Double, _<br>

inputCulture As String) As String<br>

Dim display As String<br>

Dim LocalFormat As NumberFormatlnfo =<br>

CType(NumberFormatlnfo.Currentlnfo.Clone0, _<br>

NumberFormatlnfo)<br>

display = value.ToString( " C " , LocalFormat)<br>

Return display<br>

End Function

 

c. Function MyGetDisplayValue(value As Double, _<br>

inputRegion As String) As String<br>

Dim display As String<br>

Dim region As Regionlnfo<br>

region = New Regionlnfo(inputRegion)<br>

display = value.ToString( " C " )<br>

display += region.lSOCurrencySymbol<br>

Return display<br>

End Function

d. Function MyGetDisplayValue(value As Double, _<br>

inputCulture As String) As String<br>

Dim display As String<br>

Dim culture As Culturelnfo<br>

culture = New Culturelnfo(inputCuiture)<br>

display = value.ToString( " C " , culture)<br>

Return display<br>

End Function

 

 

 

Ans: D

 

 

 

89. You create an ASP.NET application for an insurance company. The application

is used to generate automobile insurance quotes. One page in the application

allows the user to enter a vehicle identification number (VIN). The page

provides manufacturing information on the identified vehicle, and that

information is used in rating the vehicle for insurance.

 

The only control on the page is a TextBox control for entering the VIN. You

define an event handler for the change event of the TextBox control. The event

handler performs the vehicle lookup in the database. The AutoPostBack attribute

of the TextBox control is set to True.

 

During testing, you attempt to browse to the page by using Internet Explorer on

one of your test computers. You discover you do not receive vehicle information

after entering a valid VIN and using the TAB key to move out of the text box.

This problem does not occur when you use other test computers that are running

Internet Explorer.

 

What should you do?

 

a. Configure Intemet Explorer to allow scripting.

 

b. Configure lnternet Explorer to allow page transitions.

 

c. In the Page directive, set the SmartNavigation attribute to <b> " True " </b>.

 

d. In the Page directive, set the AutoEventWireup attribute to <b> " True " <b/>.

 

 

 

Ans: A

 

 

 

 

90. You create an ASP.NET application for an online sales site. A page named

OrderVerify.aspx displays a detailed listing of the items ordered, their

quantity, and their unit prices. OrderVerify.aspx then displays the final order

total at the end of the page.

 

The Web Form within OrderVerify.aspx includes a Web server control button for

order submission. The control includes the following HTML element generated by

Visual Studio .NET:

 

<asp:button id= " submitOrderButton " runat=- " server "

Text=- " Submit Order " ></asp:button>

 

The primary event handler for submitOrderButton is named submitOrderButton_Ciick

and runs on the server. A client-side function named verifyBeforeSubmit0

displays a dialog box that asks the user to verify the intent to submit the

order.

 

You need to ensure that verifyBeforeSubmit0 runs before submitOrderButton_Click.

What should you do?

 

a. Modify the HTML element as follows:<br>

<asp:button id= " submitOrderButton " runat= " server " <br>

Text=- " Submit Order " <br>

onClick= " verifyBeforeSubmit0; " & GT; & LT;/asp:button & GT;

 

a. Modify the HTML element as follows:<br>

& LT;asp:button id= " submitOrderButton " runat= " server " <br>

Text=- " Submit Order " <br>

ServerClick= " verifyBeforeSubmit0; " & GT; & LT;/asp:button & GT;

 

a. Add the following code to the Page.Load event handler for

OrderVerify.aspx:<br>

submitOrderButton.Attributes.Add( " onclick " , _<br>

" verifyBeforeSubmit0; " )

 

a. Add the following code to the Page.Load event handler for

OrderVerify.aspx:<br>

submitOrderButton.Attributes.Add( " ServerClick " , _<br>

" verifyBeforeSubmit0; " )

 

 

Ans: C

 

 

 

 

 

91. You create an ASP.NET application for an online insurance site. A page named

Vehiclelnformation.aspx has the following Page directive:

 

& LT;%@ Page Language= " vb ''

CodeBehind= " Vehiclelnformation.aspx.vb "

AutoEventWireup= " False " Inherits= " lnsApp.Vehiclelnfo " % & GT;

 

Vehiclelnformation.aspx has a TextBox control named vehiclelDNumber in which the

user can enter a vehicle identification number (VIN). The HTML code for this

control is as follows:

 

& LT;asp:TextBox ID= " vehiclelDNumber '' Columns= " 20 ''

Runat= " server ''/ & GT;

 

You need to implement a TextChanged event handler for vehiclelDNumber. You want

this event handler to retrieve information about a vehicle by using an XML Web

service that charges for each access. The page will then be redisplayed with

additional information about the vehicle obtained from the XML Web service.

 

You are implementing the TextChanged event handler. Which two courses of action

should you take? (Each Ans: presents part of the solution. Choose two.)

 

a. In the Page directive for Vehiclelnformation.aspx, ensure that the

AutoEventWireup attribute is set to " True " .

 

B. In the Page directive for Vehielelnformation.aspx, ensure that the

EnableViewState attribute is set to " True " .

 

C. In the vehiclelDNumber HTML element, ensure that the AutoPostback attribute

is set to " False " .

Include code for the onserverchange event to query the XML Web service.

 

D. In the vehiclelDNumber HTML element, ensure that the AutoPostback attribute

is set to " True " .

Include code in the TextChanged event handler to query the XML Web service.

 

 

 

Ans: B-D

 

 

 

 

92. You create an ASP.NET application for an insurance company. The application

allows users to purchase automobile insurance policies online. A page named

InsuredAuto.aspx is used to gather information about the vehicle being insured.

 

InsuredAuto.aspx contains a TextBox control named vehiclelDNumber. The user

enters the vehicle identification number (VIN) of the vehicle into

vehiclelDNumber and then clicks a button to submit the page. The Button control

is named submitButton. Upon submission of the page, additional vehicle

information is obtained for the VIN, and the page is redisplayed showing the

vehicle information.

 

You define vehiclelDNumber by using the following HTML tag:

 

& LT;asp:TextBox id= " vehiclelDNumber " runat=- " server "

EnableViewState= " True " / & GT;

 

Valid V1Ns are composed of numbers and uppercase letters. You need to include

code that converts any lowercase letters to uppercase letters so that the

properly formatted VIN is displayed after the page is submitted and redisplayed.

 

What are two possible ways to achieve this goal? (Each Ans: presents a complete

solution. Choose two.)

 

a. Add the following code to the vehiclelDNumber.TextChanged event handler for

InsuredAuto.aspx:

vehiclelDNumber.Text = vehiclelDNumber.Text.ToUpper 0

B. Add the following code to the submitButton.Click event handler for

InsuredAuto.aspx:

vehiclelDNumber.Text = vehiclelDNumber.Text.ToUpper0

 

C. Add the following code to the Page.Init event handler for InsuredAuto.aspx:

vehiclelDNumber.Text = vehiclelDNumber.Text.ToUpper0

 

D. Add the following code to the Page.Render event handler for InsuredAuto.aspx:

vehiclelDNumber.Text = vehiclelDNumber.Text.ToUpper0

 

 

 

Ans: A-B

 

 

 

 

93. You create an ASP.NET application to display sales analysis information for

your company. A page named SalesSummary.aspx displays three separate sections of

information.

 

For each section, you write code that calls a stored procedure in a database.

The code for each section calls a different stored procedure. After the stored

procedure runs, the results are immediately written in HTML format to the

Response object for the application.

 

You do not want users to wait until the results are returned from all three

stored procedures before they begin to receive content rendered in their

browser. What are two possible ways to achieve this goal?

 

(Each Ans: presents a complete solution. Choose two.)

 

a. Set the SuppressContent property of the Response object to False.

 

B. Set the BufferOutput property of the Response object to False.

 

C. Set the CacheControl property of the Response object to Publi

 

D. Insert the following statement after each section is written to the Response

object for the application:<br>

Response.Clear 0

 

E. Insert the following statement after each section is written to the Response

object for the application:<br>

ResponsClearContent0

F. Insert the following statement after each section is written to the Response

object for the application:<br>

Response.Flush0

 

 

Ans: B-F

 

 

 

 

94. You are a Web developer for a bookstore. You create a Web user control named

BookTopics that is defined in a file named BookTopics.ascx. BookTopics displays

a list of book topics based on an author's profile identification number. The

profile identification number is stored in a public property of BookTopies named

AuthorProfile.

 

You create an ASP.NET page named AuthorPage.aspx that contains an instance of

the BookTopics Web user control. AuthorPage.aspx is opened by an HTTP-GET

request that has two parameters. The parameters are named publisherlD and

authorProfilelD. The value of authorProfilelD is a profile identification

number.

 

You want to enable output caching for the BookTopies Web user control. You need

to ensure that the cached control is varied only by an author's profile

identification number.

 

What should you do?

 

a. Add the following element to the OutputCache directive for

AuthorPage.aspx:<br>

VaryByParam= " BookTopics.AuthorProfile "

 

b. Add the following element to the OutputCache directive for

AuthorPage.aspx:<br>

VaryByControl= " BookTopics.AuthorProfile "

 

c. Add the following element to the OutputCache directive for

BookTopics.ascx:<br>

VaryByParam= " none "

 

d. Add the following element to the OutputCaehe directive for

BookTopics.ascx:<br>

VaryByControl= " authorProfilelD "

 

 

 

Ans: D

 

 

 

 

95. You create an ASP.NET page named Location.aspx. Location.aspx contains a Web

user control that displays a drop-down list box of counties. The Web user

control is named CountyList, and it is defined in a file named CountyList.ascx.

The name of the DropDownList control in CountyList.ascx is myCounty.

 

You try to add code to the Page.Load event handler for Location.aspx, but you

discover that you cannot access myCounty from code in Location.aspx. You want to

ensure that code within Location.aspx can access properties of myCounty.

 

What should you do?

 

a. In the code-behind file for CountyList.ascx, add the following line of

code:<br>

Protected myCounty As DropDownList

 

b. In the code-behind file for CountyList.ascx, add the following line of

code:<br>

Public myCounty As DropDownList

 

c. In the code-behind file for Location.aspx, add the following line of

code:<br>

Protected myCounty As DropDownList

d. In the code-behind file for Location.aspx, add the following line of

code:<br>

Public myCounty As DropDownList

 

 

 

Ans: B

 

 

 

 

96. You are creating a Web Form for your company's human resources department.

You create a Web user control named Employee that allows the user to edit

employee information. Each instance of the control on your Web Form will contain

information about a different employee.

 

You place the Employee control on the Web Form and name the control Employeel.

You also add the Employee control to the ItemTemplate of a Repeater control

named repeaterEmployees. Each Employee control in repeaterEmployees contains

several TextBox controls. You want your Web Form to handle TextChanged events

that are raised by these TextBox controls.

 

Which event handler should you use?

 

a. Private Sub Employeel_TextChanged_<br>

(ByVal sender as Object, _<br>

ByVal e as EventArgs) _<br>

Handles Empioyeel.TextChanged

 

b. Private Sub repeaterEmployees_ltemDataBound _<br>

(ByVal sender as Object, _<br>

ByVai e as RepeaterltemEventArgs) _<br>

Handles repeaterEmployees.ltemDataBound

c. Private Sub repeaterEmployees_DataBinding _<br>

(ByVal sender as Object, _<br>

ByVal e as RepeaterltemEventArgs) _<br>

Handles repeaterEmployees.DataBinding

 

d. Private Sub repeaterEmployees_ltemCommand -<br>

(ByVal source as Object, _<br>

ByVal e as RepeaterCommandEventArgs) _<br>

Handles repeaterEmpioyees.ItemCommand

 

 

 

Ans: D

 

 

 

 

 

97. You create an ASP.NET application for Tailspin Toys to sell toys online. One

of the requirements is that every page must display the company name at the top.

You create a Web custom control that encapsulates the company name in a heading

element. Your control class named CompanyName inherits from the Control class.

 

The following HTML code displays the company name:

 

& LT;h2>Tailspin Toys</h2 & GT;

 

You need to write code in the CompanyName class to display the company header.

Which code should you use?

 

a. Protected Overrides Sub Render(ByVal output As _<br>

System.Web.UI.HtmlTextWriter)<br>

output.Write( " & LT;h2>Tailspin Toys</h2 & GT; " )<br>

End Sub

 

b. Protected Overrides Sub OnPreRender(ByVal e As<br>

System.EventArgs)<br>

Me.Controls.Add<br>

(New LiteralControl( " & LT;h2>Tailspin Toys</h2 & GT; " ))<br>

End Sub

 

c. Protected Overrides Sub RenderChildren(writer As<br>

System.Web.U1.HtmlTextWriter)<br>

writer. Write( " & LT;h2>Tailspin Toys</h2 & GT; " )<br>

End Sub

 

d. Protected Overrides Sub Onlnit(e As EventArgs)<br>

Me.Controls.Add<br>

(New LiteraiControl( " & LT;h2>Tailspin Toys</h2 & GT; " ))<br>

End Sub

 

 

 

Ans: A

 

 

 

 

98. You write code to perform standard financial calculations that are required

by your company. The code accepts input parameters such as interest rate and

investment amount. It then calculates values based on different predetermined

scenarios.

 

You want to create a control that encapsulates this functionality. You want to

be able to easily use this control by dragging it from the toolbox onto your Web

Forms. You also plan to include full support for visual design tools.

 

You want to create a project to test the control. Which two courses of action

should you take? (Each Ans: presents part of the solution. Choose two.)

 

a. Create a Web user control.

 

b. Create a Web custom control.

 

c. Create a new Web Form project.<br>

Use the COM Components tab of the Customize Toolbox dialog box to specify the

new control.

 

d. Create a new Web Form project.<br>

Use the .NET Framework Components tab of the Customize Toolbox dialog box to

specify the new control.

 

a. Create a new Web Form project.<br>

Select Add Reference from the Project menu and browse to the new control.

 

 

Ans: B-D

 

 

 

 

 

99. You create an ASP.NET page that retrieves product information from a

Microsoft SQL Server database. You want to display the list of products in a

Repeater control named repeaterProducts. Your code uses the System.Data

namespace and the System.Data.SqlCiient namespace.

 

You write the following procedure to retrieve the data:

 

Private Sub RepeaterBind( _<br>

ByVal ConnectionStfing As String, _<br>

ByVal SQL As String)<br>

Dim da As SqlDataAdapter<br>

Dim dt As DataTable<br>

da = New SqiDataAdapter(SQL, ConnectionString)<br>

dt = New DataTable0<br>

 

You need to add code that will fill repeaterProducts with data retrieved from

the database. Which code segment should you use?

 

a. repeaterProducts.DataSource = dt<br>

repeaterProducts.DataBind0<br>

dFill(dt)

 

a. da.Fill(dt)<br>

repeaterProducts.DataBind0<br>

repeaterProducts.DataSource = dt

 

a. repeaterProducts.DataBind0<br>

da.Fill(dt)<br>

repeaterProducts.DataSource = dt

 

a. da.Fill(dt)<br>

repeaterProducts.DataSource = dt<br>

repeaterProducts.DataBind0

 

 

 

Ans: D

 

 

 

 

 

100. You create an ASP.NET application named MyProject on your client computer.

The application has a page

named ProjectCalendar.aspx. This page is located in a virtual directory named

Scheduling, which is a child

of the MyProject root directory.

 

ProjectCalendar.aspx uses cookies to track modifications to the schedule during

a user's session so that the

user can undo modifications if necessary. You deploy your application on a

computer named Serverl. Users

report that the undo functionality stops working after they execute a specific

sequence of actions. You need

to view the cookie values after the sequence of actions to help identify the

cause of the problem.

 

You add the following element to the Web.config file:<br>

 

& LT;trace enabled= " true " pageOutput= " false ''/_<br>

 

You want to display the trace output information on your client computer. Which

URL should you use?

 

 

a. HTTP://Serverl/MyProject/Scheduling/ProjectCalendar.aspx?Trace=true

 

b. HTTP://Server1/MyProj ect/Scheduling/Proj ectCalendar.aspx?trace.axd

 

c. HTTP://Serverl/MyProject/Scheduling/ProjectCalendar.aspx

 

d. HTTP://Server1/MyProj ect/Scheduling/trace.axd

 

e. HTTP://Server1/MyProject/ProjectCalendar.aspx?tracaxd

 

f. HTTP://Server1/MyProj ect/trace.aspx

 

 

 

Ans: D

 

 

 

 

101. You are using your computer to debug an ASP.NET application. Your login

account has administrative permissions for your computer. The application

contains several existing ASP pages that use server-side scripts. These

server-side scripts are written in Visual Basic Scripting Edition.

 

You locate a line of VBScript code in an existing ASP page that might be

incorrect. You add a breakpoint on the line. When you run the application,

everything appears to work properly, but the breakpoint is not invoked. When you

examine the breakpoint in the VBScript code, you see the following ToolTip: " The

breakpoint will not currently be hit. No symbols have been loaded for this

document. "

 

You want the breakpoint to be invoked when you run the application in Debug

mode. What should you do?

 

a. Open the Configuration Manager and set the Active Solution Configuration

option to Debug.

 

b. Select the ASP page in Solution Explorer. Set the Build Action property to

Compile.

 

c. Open the property pages for the ASP.NET application and select the ASP

Debugging check box.

 

d. Select Options from the Tools menu. Select the Debugging folder. In the

General category, select the Insert breakpoints in Active Server Pages for

breakpoints in client script check box.

 

 

 

Ans: C

 

 

 

 

 

102. You create an ASP.NET application. You implement tracing and debugging

instrumentation. The application is deployed on your company's intranet.

 

After working with the application for several days, users report that some

pages are displaying errors that incorrectly identify valid date values as being

invalid.

 

You need to gather debugging information from the application while it is

running in the production environment. You need to perform this task with the

least impact on the performance of the application.

 

What should you do?

 

a. Enable Debug mode in the application's Web.config file on the production

server. Use Visual Studio .NET on your client computer to select Debug Processes

from the Tools menu and attach to the aspnet_wp.exe process on the production

server.

 

b. Enable Debug mode in the application's Weconfig file on the production

server. Use Visual Studio .NET on your client computer to open the application

project on the production server and select Start from the Debug menu.

 

c. Enable application tracing and disable tracing page output in the

application's Web.config file on the production server. View the debugging

information on the trace.axd page.

 

d. Enable application tracing and disable tracing page output in the

application's Web.config file on the production server. Run DbgClr.exe and

attach to the aspnet_wp.exe process on the production server.

 

 

Ans: C

 

 

 

 

 

103. You create an ASP.NET application for a consulting company. The company

uses the application to perform time tracking and to generate billing invoices.

The accounts receivable department uses a page named Preparelnvoiees.aspx to

issue invoices to clients at the end of each month.

 

During testing of the application, you discover that some invoices are being

generated with negative values for the total amount due. The total amount due is

calculated within a function named CalculateTotalDue, which is defined in the

Preparelnvoices.aspx page.

 

The call to CalculateTotalDue is contained in the following code segment from

Preparelnvoices.aspx. (Line numbers are included for reference only.)

 

1 Dim totalAmountDue As Double<br>

2 totalAmountDue = CalculateTotalDue0<br>

3 totaiAmountDue -= totalAmountDue * discountRate<br>

 

You are using Visual Studio .NET to debug your application. You need to stop

execution of the code within Preparelnvoices.aspx and enter the interactive

debugger when CalculateTotalDue returns a negative value.

 

What should you do?

 

a. Modify the code segment as follows:<br>

Dim totalAmountDue As Double<br>

totalAmountDue = CalculateTotalDue0<br>

System.Diagnostics.Debug.Assert(totalAmountDue >= 0)<br>

totalAmountDue -= totalAmountDue * discountRate

 

b. Modify the code segment as follows:<br>

Dim totalAmountDue As Double<br>

totalAmountDue = CalculateTotalDue0<br>

totalAmountDue -= totalAmountDue * diseountRate<br>

System.Diagnostics.Debug.Assert(totaiAmountDue >= 0)

 

c. In the Watch window, add a watch expression of totalAmountDue < 0, and select

the Break When Value Is True option.

 

d. Set a breakpoint on line 3 of the code segment.<br>

Define a condition for the breakpoint to break when totalAmountDue < 0 is true.

 

e. Set a breakpoint on line 2 of the code segment.<br>

Define a condition for the breakpoint to break when totaiAmountDue < 0 is tru

 

 

 

Ans: D

 

 

 

 

 

104. You use Visual Studio .NET on your client computer to develop an ASP.NET

application on a remote server. The application provides asset management

functionality. Another developer in your company uses Visual Basic .NET to

develop a custom component named AssetManagement. Your ASP.NET application uses

this custom component. The AssetManagement component defines an Assets class

that exposes a public method named DepreciateAssets 0. You deploy

AssetManagement to the remote server that hosts your ASP.NET application. You

add the source files of AssetManagement to your ASP.NET application.

 

You are debugging an .aspx page in your application by using the Visual Studio

..NET interactive debugger. The code in the page creates an instance of the

Assets class and then calls the DepreciateAssets0 method of that instance. You

attempt to step into a call to the DepreciateAssets0 method. Instead of showing

the first line of code in the DepreciateAssets0 method, the interactive debugger

moves to the next line of code in the .aspx page.

 

You need to enable the interactive debugger to step into the code within the

Assets class. What should you do in Visual Studio .NET?

 

a. Configure Visual Studio .NET to enable just-in-time debugging for native

programs.

 

b. Configure Visual Studio .NET to allow editing of Visual Basic files while

debugging.

 

c. In the Configuration Manager, select the Debug configuration and rebuild the

AssetManagement component.

 

d. In the Configuration Manager, select the Debug configuration and rebuild the

ASP.NET application.

 

 

 

Ans: C

 

 

 

 

105. You create an ASP.NET application for your company. Your application

contains a method named nextBusinessDay. This method uses a date parameter and

returns the next date that is not a holiday or weekend day.

 

You are debugging a page named ProjectTimeline.aspx. You need the execution to

break on the following line of code when the value of the dStartDate variable

changes:

 

dStartDate = nextBusinessDay(dStartDate)

 

What should you do?

 

a. Set a breakpoint on the line of code and open the BreakPoint Properties

dialog box.

Specify the following breakpoint condition:

dStartDate _ dStartDate

Select the is true option.

 

b. Set a breakpoint on the line of code and open the BreakPoint Properties

dialog box.<br>

Specify the following breakpoint condition:<br>

dStartDate<br>

Select the has changed option.

 

c. Add the following statement immediately after the call to

nextBusinessDay:<br>

System.Diagnostics.Debug.Assert( _<br>

dStartDate ,_ dStartDate, " dStartDate has changed. " )

 

d. Add the following statement immediately after the call to

nextBusinessDay:<br>

System.Diagnostics.Trace.Assert( _<br>

dStartDate _ dStartDate, " dStartDate has change " )

 

 

 

Ans: B

 

 

 

 

106. You are creating an ASP.NET application for an insurance company. The

company will use your ASP.NET application to record insurance claims. Another

development team creates a redistributable component that will be used by your

ASP.NET application. The component requires several registry entries to be

created during installation so that the component will run properly. The same

component might be used by other ASP.NET applications in the future.

 

The development team gives you the source code to the component as well as all

of the project files for the component. You add the component project to your

ASP.NET application. You need to create a deployment package for your

application. You want to include the redistributable component with your

deployment package.

 

What should you do?

 

a. Create a setup project for the redistributable component.<br>

Create a Web setup project for your ASP.NET application.

 

b. Create a merge module project for your ASP.NET application.<br>

Create a setup project for the redistributable component and add the merge

module for your ASP.NET application to the project.

 

c. Create a merge module project for both your ASP.NET application and the

redistributable component.<br>

Create a Web setup project and add both merge modules to the project.

 

d. Create a merge module project for the redistributable component.<br>

Create a Web setup project for your ASP.NET application and add the merge module

for the redistributable component to the project.

 

 

 

Ans: D

 

 

 

 

107. You create an ASP.NET application named MyApp that will be installed on a

Web server named Serverl. You create a Web setup project to deploy your ASP.NET

application and add it to your solution. You set the Configuration Manager to

Release mode and create a deployment package for your application. You copy the

deployment package to a CD-ROM and take it to Serverl.

 

You log on to Serverl and run the deployment package from your CD-ROM. During

the setup process, you receive the following error message:

 

" The specified path 'http://Serverl/MyApp' is unavailable. The Internet

Information Server might not be running or the path exists and is redirected to

another machine. Please check the status of the virtual directory in the

lnternet Services Manager. "

 

You verify that Intemet Information Services (IIS) is running on Serverl and

that the specified path does not exist. You want to install the application on

Serverl.

 

What should you do?

 

a. Launch the deployment package in Administrative mode by using the/a command

line option.

 

b. Log off and log on again by using an account that has Administrator

privileges on Serverl.

 

c. Create an IIS virtual directory named MyApp and configure it with Write

permissions.

 

d. Copy the deployment package from the CD-ROM to a local folder on Serverl and

then run the deployment package.

 

 

 

Ans: B

 

 

 

 

 

108. You create a new ASP.NET application named SalesReports on your development

computer. You add code to the default WebForml. To test the code's

functionality, you copy the entire SalesReports folder from the

C:\inetpub\wwwroot folder on your computer to the C:\inetpub\wwwroot folder on a

separate Microsoft Windows 2000 Server computer named Serverl. Serverl hosts

several ASP.NET applications.

 

When you use the browser on your computer to open the copy of the application

hosted on Server 1, you receive the following error message: " It is an error to

use a section registered as allowDefinition='MachineToApplication' beyond

application level. "

 

You want to correct this error without altering the other Web sites that are

hosted on Serverl. What should you do?

 

a. Use lnternet Information Services (IIS) to create a virtual directory that

points to the SalesReports folder on Serverl.

 

b. Remove the following element from the Weconfig file in

C:\inetpub\wwwroot\SalesReports on Serverl:<br>

& LT;authentication mode= " Windows " /%

 

C. Remove the following element from the Web.config file in C:\inetpub\wwwroot

on Serverl :<br>

& LT;authentication mode= " Windows " / & GT;

 

D. Move the SalesReports folder on Serverl up one level, so that it is a

subfolder of the inetpub folder.

 

 

Ans: A

 

 

 

 

 

109. You are creating an ASP.NET page for your company. The page contains a

DataGrid control that displays all the current prices for the commodities that

the company purchases. The page also contains a Button control that refreshes

the data in the DataGrid control.

 

The DataGrid control needs to be repopulated each time the page is displayed.

The data is accessed through a DataView object stored in the Session object. You

want to ensure the fastest load time for the page.

 

What should you do?

 

a. Set the DataSource property and call the DataBind method of the DataGrid

control in the Click event handler for the Button control.

 

B. Set the DataSource property and call the DataBind method of the DataGrid

control in the Start event handler for the Session object.

 

C. Set the EnableViewState property of the DataGrid control to false.

 

D. Set the EnableViewState property of the DataGrid control to true.

 

 

Ans: C

 

 

 

110. You are creating an ASP.NET page for your company. You create a DataGrid

control that displays past purchases made by the user. The DataGrid control is

populated from an existing database when the page is created.

 

The page contains TextBox controls that allow users to update their personal

information, such as address and telephone number. You need to ensure that the

page is refreshed as quickly as possible when users update their contact

information. What should you do?

 

a. Set the Enabled property of the DataGrid control to false.

 

B. Set the EnableViewState property of the DataGrid control to false.

 

C. Write code in the Page.Load event handler that populates the DataGrid control

only when the IsPostBack property of the page is false.

 

D. Write code in the Page.Load event handler that populates the DataGrid control

only when the lsPostBack property of the page is

true.

 

 

 

Ans: C

 

 

 

 

111. You are creating an ASP.NET page for your company. The page uses string

concatenation to gather data from multiple e-mail messages and format the data

for display on the page. You want to ensure that the page displays as quickly as

possible. What should you do?

 

a. Write code that uses the Append method of the StringBuilder object.

 

B. Write code that uses the Substring method of the String object.

 

C. Write code that uses the ampersand ( & ) operator to concatenate the strings.

 

D. Write code that uses the plus-sign (+) operator to concatenate the strings.

 

 

 

Ans: A

 

 

 

 

112. You create an ASP.NET application for tracking student examinations at a

school. You use Microsoft Windows authentication. Students are members of a

group named Students, and teachers are members of a group named Teachers.

 

The root folder for your application is named Exams. The Exams folder displays

information about pending examinations. The Exams folder has a subfolder named

Grades. Both students and teachers can access pages in Exams. Only teachers can

access pages in Grades.

 

You create the following entries in the Web.config file in Exams. (Line numbers

are included for reference only.)

 

 

1 & LT;authentication mode= " Windows ''/ & GT;

2 & LT;authorization>

3 & LT;allow roles= " Students, Teachers " / & GT;

4 & LT;deny users= " * " / & GT;

5 & LT;/authorization & GT;

 

You create the following entries in the Web.config file in Grades. (Line numbers

are included for reference only.)

 

1 & LT;authentication mode= " Windows " / & GT;

2 & LT;authorization>

3 & LT;allow roles= " Teachers ''/ & GT;

4 & LT;deny users =''*''/ & GT

5 & LT;/authorization & GT

 

When teachers try to access pages in the Grades folder, they receive an error

message that reads in part: " An error occurred during the processing of a

configuration file required to service this request. "

 

You need to ensure that teachers can access pages in the Grades folder. What

should you do?

 

a. Remove line 1 in the Web.config file in Grades.

 

B. Modify line 4 in the Weconfig file in Grades as follows:

& LT;allow users =''*''/ & GT;

 

C. Add the following line between line 1 and line 2 in the Web.config file in

Exams:<br>

& LT;identity impersonate= " true ''/ & GT;

 

D. Add the following line between line 1 and line 2 in the Web.config file in

Grades:<br>

& LT;identity impersonate= " true " / & GT;

 

E. Add the following line between line 1 and line 2 in the Web.config file in

Grades:<br>

& LT;identity impersonate= " faise " / & GT;

 

 

 

Ans: A

 

 

113. You create an ASP.NET application. The application uses integrated security

to retrieve information from a Microsoft SQL Server database named SalesOrder.

You need to provide a connection string for the application to use to connect to

SalesOrder. You decide to store the connection string in the Web.config file.

 

How should you set up the Web.config file?

 

a. In the configuration section, create an element named appSettings.<br>

Create an add element that has a key attribute set to SQLConnection, and a value

attribute set to the connection string.

 

B. In the configuration section, create an element named SQLConnection.<br>

Create a key element that has a value attribute set to the connection string.

 

C. In the authorization section, create an element named SQLConnection.<br>

Create a key element that has a value attribute set to the connection string.

 

D. In the authentication section, create an element named appSettings.<br>

Create an element named SQLConnection that has a value attribute set to the

connection string.

 

 

 

Ans: A

 

 

 

 

114. You create an ASP.NET application named Inventory. This application will be

used by customers on the Intemet. During the beta test period, you ensure that

the actual ASP.NET error message is displayed whenever an error is encountered.

Both developers and beta testers see the actual text of the error message.

 

You perform beta testing of other applications on the same beta test server

during the beta testing period for Inventory. All of the other applications

display ASP.NET error messages. After the beta testing period is complete, the

beta test server is promoted to a production server. You want all applications

to display a single, user-friendly error message.

 

You want to configure Inventory and the production server to meet these goals.

You want to perform this task by using the minimum amount of administrative

effort.

 

Which two actions should you take? (Each Ans: presents part of the solution.

Choose two.)

 

a. Set the mode parameter of the customErrors element in the Web.config file for

Inventory to " On " .

 

B. Remove the customErrors element from the Weeonfig file for Inventory.

 

C. Set the mode parameter of the customErrors element in the Inventory.config

file to " On " .

 

D. Remove the customErrors element from the Inventory.config file.

 

E. Set the mode parameter of the customErrors element in the Machinconfig file

to " On " .

 

F. Remove the customErrors element from the Machine.config file.

 

 

Ans: B-E

 

 

 

 

 

115. You create an ASP.NET application that contains confidential information.

You use form-based authentication to validate users. You need to prevent

unauthenticated users from accessing the application. What should you do?

 

A. Set a Page directive in the start page of your application to redirect users

to a login page.

 

B. Set a Page directive in the start page of your application to disallow

anonymous users.

 

C. In the authorization section of the Machine.config file, set the users

attribute of the allow element to " ? " .

 

D. In the authorization section of the Web.config file, set the users attribute

of the deny element to " ? " .

 

 

 

Ans: D

 

 

 

 

116. You create an ASP.NET application named TimeSheet for your company's

intranet. The application will be used only by employees of your company. You

want the application to recognize the user without forcing the user to enter a

name and password. You write the following code to save the user's Microsoft

Windows Iogin name in the Session object:

 

Session.ltem( " User " )=User.ldentity.Name

 

When you run TimeSheet, the Session.Item( " User " ) variable returns an empty

string. You want to configure lnternet Information Services (IIS) and your

application to be able to retrieve the user name automatically.

 

What should you do?

 

a. Disable Anonymous Access for the application in IIS.

 

B. Enable Basic authentication for the application in IIS.

 

C. Add the following element to the Web.config file for TimeSheet:

& LT;identity impersonate= " True " / & GT;

 

D. Add the following element to the Web.config file for TimeSheet:

& LT;identity impersonate= " False " / & GT;

 

 

 

Ans: A

 

 

 

 

117. You plan to deploy your ASP.NET application over your company's intranet.

The application uses data retrieved from a Microsoft SQL Server database. You

want to use SQL Server connection pooling to optimize performance. You also need

to protect confidential data stored on the server while minimizing

administrative costs.

 

You need to configure security for your application. What should you do?

 

a. Use Microsoft Windows authentication in the application. Enable impersonation

for users to access the SQL Server database from your application.

 

a. Use Microsoft Windows authentication in the application. Use a single Windows

account for users to access the SQL Server database from your application.

 

a. Use form-based authentication in the application. Use the system

administrator (sa) SQL Server iogin for users to access the SQL Server database

from your application.

 

a. Use form-based authentication in the application. Assign each user a separate

SQL Server Iogin to use to access the SQL Server database from your application.

 

 

 

Ans: B

 

 

 

 

118. You create an ASP.NET application for your company's intranet. The

application stores static data in a flat file. The file is located in a separate

directory on the Web server. You want to allow only your application to access

this directory.

 

Your application uses Microsoft Windows authentication. The application runs

successfully on your computer. However, when the application is deployed to the

test server, testers report a permissions error when the application attempts to

access the flat file.

 

You need to ensure that the application can load the data from the fiat file.

You want to prevent users from using the file system to read the file.

 

What should you do?

 

a. Add the following element to the authorization section of the Web.config

file:<br>

& LT;identity impersonate= " true " / & GT;

 

B. Add the following element to the system.web section of the Weconfig file:<br>

& LT;allow users= " system " /_

 

C. Grant the ASPNET account Read permissions on the directory where the file is

located.

 

D. In the Machine.config file, set the userName attribute in the processModel

section to " system " .

 

 

 

Ans: C

 

 

 

119. You are creating an ASP.NET application. The application will be deployed

on your company's intranet. Your company uses Microsoft Windows authentication.

You want the application to run in the security context of the user. What should

you do?

 

a. Add the following element to the authorization section of the Web.config

file:<br>

& LT;allow users= " ? " / & GT;

 

B. Add the following element to the system.web section of the Wecon fig

file:<br>

<identity impersonate= " true " /_

 

C. Use the Configuration Manager for your project to designate the user's

security context.

 

D. Write code in the Application_AuthenticateRequest event handler to configure

the application to run in the user's security context.

 

 

 

Ans: B

 

 

120. You create a reporting application for Margie's Travel. You create several

reports, each of which resides in its own folder under the Reports folder. Each

subfolder has the appropriate security rights sets for Microsoft Windows users.

 

You write a function named ListReports that generates a list of available

reports. You want to configure the application and the ListReports function to

find out which reports are available to the current user. If a user is logged in

by using Windows authentication, you want ListReports to apply that user's

rights. If the user is not logged in by using Windows authentication, you want

ListReports to use the fights granted to the margiestravelhqeportingAccount user

account.

 

The password for this user account is " p 1W2o3r4d. "

 

Which two actions should you take? (Each Ans: presents part of the solution.

Choose two.)

 

a. Add the following element to the Web.config file: <br>

& LT;identity impersonate= " false " >

 

B. Add the following element to the Weconfig file:<br>

& LT;identity impersonate= " true " >

 

C. Add the following element to the Web.config file:<br>

& LT;identity impersonate= " true "

userName= " margiestravelhRep°rtingAcc°unt "

password= " p 1W2o3r4d " & GT;

 

D. Add the following element to the Web.config file:<br>

& LT;authorization & GT;

& LT;allow user= " margiestravelhR'ep°rtingAcc°unt '' & GT;

& LT;/authorization & GT;

 

E. Add code to the ListReports function to create and use a WindowsPrincipai

object based on the margiestravelLReportingAccount user account only if no user

is authenticated.

 

F. Add code to the ListReports function to always create and use a

WindowsPrincipal object based on the margiestravelLReportingAccount user

account.

 

 

Ans: B-E

 

 

 

 

 

121. You create an ASP.NET application for Contoso, Ltd. The company uses

Microsoft Windows authentication. All users are in the contoso domain.

 

You want to configure the application to use the following authorization rules:

 

" Anonymous users must not be allowed to access the application.

" All employees except Marie and Pierre must be allowed to access the

application.

 

Which code segment should you use to configure the application?

 

a. & LT;authorization>

& LT;deny users= " contosoh'narie, contoso\pierre " & GT;

& LT;allow users =''*'' & GT;

& LT;deny users= " ? " & GT;

& LT;/authorization & GT;

 

B. & LT;authorization & GT;

& LT;allow users= " * " >

& LT;deny users= " contosohnarie, contoso\pierre " & GT;

& LT;deny users= " ? " >

& LT;/authorization>

 

C. & LT;authorization>

& LT;deny users= " contosokmarie, contoso\pierre " & GT;

& LT;deny users= " ? " >

& LT;allow users= " * " >

& LT;/authorization>

 

D. & LT;authorization>

& LT;deny users= " contosoh'narie, contoso\pierre " & GT;

& LT;allow users= " * " >

& LT;/authorization>

 

E. & LT;authorization>

& LT;allow users= " * " >

& LT;deny users= " contosoLmarie, contoso\pierre " & GT;

& LT;/authorization>

 

 

 

Ans: C

 

 

 

122. Your ASP.NET application uses the Microsoft .NET Framework security classes

to implement role-based security. You need to authorize a user based on

membership in two different roles. You create a function named ValidateRole that

has three arguments. The argument named User is the user name, the argument

named Rolel is the first role to verify, and the argument named Role2 is the

second role to verify. You want ValidateRole to return a value of true if the

specified user has membership in either of the specified roles.

 

You write the following code:<br><br>

 

Dim principalPerm 1 As New<br>

PrincipalPermission( " User " , " Role 1 " )<br>

Dim principalPerm2 As New<br>

PrincipalPermission( " User " , " Role2 " )<br>

Which code segment should you use to complete the function?

 

a. Return principalPerm 1.1sUnrestricted0 And _<br>

principalPerm2.lsUnrestricted0

 

B. Return principalPerm 1.IsSubsetOf(principalPerm2)

 

C. Return principaiPerml .Intersect(principalPerm2).Demand0

 

D. Return principalPerm 1 .Union(principalPerm2).Demand0

 

 

Ans: D

 

 

 

 

123. Your ASP.NET application displays sales data on a page. You want to improve

performance by holding the page in memory on the server for one hour. You want

to ensure that the page is flushed from memory after one hour, and that the page

is re-created when the next request for the page is received.

 

What should you do?

 

a. Initialize a new instance of the Cache class in the Application.Start event

handler.

 

B. Initialize a new instance of the Timer class in the Page.Load event handler.

 

C. Set the Duration attribute of the OutputCache directive in the page.

 

D. In the Web.config file, set the timeout attribute of the sessionState

element.

 

 

Ans: C

 

 

 

 

124. You create an ASP.NET page that contains a DataGrid control. The control

displays data that is retrieved from a database. You want your users to be able

to sort the data in either ascending or descending order.

 

You write code to sort the data in the DataGrid control by using the SortOrder

property when a user clicks in a column. The values stored for the SortOrder

property are " ASC " for ascending order, and " DESC " for descending order. You

want to preserve the value during postbacks.

 

A user selects descending order. Which code should you use to save and retrieve

the value?

 

a. ' Save<br>

Application( " SortOrder " ) = " DESC " <br>

' Retrieve<br>

Dim val As String = CStr(Application( " SortOrder " ))

 

B. ' Save<br>

Cache( " SortOrder " ) = " DESC " <br>

' Retrieve<br>

Dim vai As String = CStr(Cache( " SortOrder " ))

 

C. ' Save

ViewState( " SortOrder " ) = " DESC " <br>

' Retrieve<br>

Dim SortOrder As String = CStr(ViewState( " SortOrder " ))

 

D. ' Save<br>

Cache( " SortOrder " ) = " SortOrder " <br>

' Retrieve<br>

Dim val As String = CStr(Cache( " DESC " ))

 

 

Ans: C

 

 

 

 

 

125. You create an ASP.NET application for a hotel. The application contains a

page that displays current weather conditions for the city in which the hotel is

located. The application calls an XML Web service every 10 minutes to update the

current weather conditions. A new page is then displayed for subsequent

requests.

 

You want the same page to be cached and retrieved from the cache during the time

between calls to the XML Web service. You decide to use a Page directive to

accomplish this goal.

 

Which Page directive should you use?

 

 

a. & LT;%@ Cache Seconds= " 600 '' VaryByParam= " Page " % & GT;

 

B. & LT;%@ OutputCache Time= " 600 " % & GT;

 

C. & LT;%@ OutputCache Duration= " 600 " VaryByParam= " None " % & GT;

 

D. & LT;%@ OutputCache Duration= " 600 " % & GT;

 

 

 

Ans: C

 

126. You are creating an ASP.NET application for an insurance company. Customers

will use the application to file claim forms online.

 

You plan to deploy the application over multiple servers. You want to save

session state information to optimize performance.

 

What are two possible ways to achieve this goal? (Each Ans: presents a complete

solution. Choose two.)

 

a. Modify the Web.config file to support StateServer mode.

 

B. Modify the Weconfig file to support SQLServer mode.

 

C. Modify the Web.config file to support InProc mode.

 

D. In the Session_Start procedure in the Global.asax file, set the EnableSession

property of the WebMethod attribute to true.

 

E. In the Session_Start procedure in the Global.asax file, set the property of

the WebMethod attribute to sessionStat

 

 

Ans: A-B

 

 

 

 

127. You are creating a shopping cart application for your company. The

application loads the category and product data only once in each user's

session. You create two DataTable objects. One DataTable object is named

Categories, and the other DataTable object is named Products. The Categories

object remains static, but the Products object is modified when the user selects

products and enters quantities to purchase.

 

You want to minimize the time it takes the page to reload after each change.

Which pair of statements should you use?

 

a. Cache( " Categories " ) = Categories<br>

Session( " Products " ) = Products

 

B. SessionCCategories " ) = Categories<br>

Cache( " Products " ) = Products

 

C. Session( " Categories " ) = Categories<br>

Session( " Products " ) = Products

 

D. Cache( " Categories " ) = Categories<br>

CacheCProducts " ) = Products

 

 

 

Ans: A

Link to comment
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...