Searching for "he"

Q:

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, XYZ Brothers, 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: OutputCache VaryByParam=?
C) Add the following directive to the page: OutputCache VaryByControl=?region;city? D) Modify the connection string to keep your database's connection pool as small as possible.
 
Answer & Explanation Answer: B) Add the following directive to the page: OutputCache VaryByParam=?

Explanation:

You can vary user control output to the cache by specifying the user control name and the parameter. We use the VaryByParam attribute of the  OutputCache  

 

Incorrect Answers: 

 

A: The Packet Size property of the Connection string is the size in bytes of the network packets sed to communicate with an instance of data provider. It is not an optimal property to change to optimize data retrieval.

 

C: The company database does not seem to include a region column.

 

D: If we keep the connection pool small we would allow less simulation connections. However, this would not minimize the required to retrieve and display the data.

Report Error

View Answer Report Error Discuss

Q:

You are a member of a team of developers creating several ASP.NET applications for XYZ. 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. Create the toolbar within a Web custom control. B) Add a new Web user control to your ASP.NET project. Create the toolbar within the Web user control.
C) Add a new Web Form to your ASP.NET project. 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. Design the toolbar within the designer of the component class.
 
Answer & Explanation Answer: A) Create a new Web Control Library project. Create the toolbar within a Web custom control.

Explanation:

Web custom controls are compiled code, which makes them easier to use but more difficult to create. You can add a Web custom control to the Toolbox and display it in a visual designer with full Properties window support and all the other design-time features of ASP.NET server controls. 

 

Incorrect Answers:

B: Web user controls are easy to make, but they can be less convenient to use in advanced scenarios such as this. Because Web user controls are compiled dynamically at run time they cannot be added to the Toolbox


C: A Web form would be inadequate.

 

D: The Component class Provides the base implementation for the IComponent interface and enables object-sharing between applications. It does not fit in this scenario.

Report Error

View Answer Report Error Discuss

Q:

You create an ASP.NET application to provide corporate news and information to XYZ’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 Web.config 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.
 
Answer & Explanation Answer: A) In the Web.config file for the application, set the culture attribute of the globalization element to en-NZ.

Explanation:

The culture attribute of the globalization element specifies the default culture for processing incoming Web requests.

 

Incorrect Answers:

 

B: The uiculture attribute of the globalization specifies the default culture for processing locale dependent resource searches. It does not apply in this scenario.

 

C, D: The UTF8Encoding Class class encodes Unicode characters using UCS Transformation Format, 8-bit form (UTF-8). This encoding supports all Unicode character values and surrogates. However, it does not help in displaying data in New Zealand format.

Report Error

View Answer Report Error Discuss

Q:

You ASP.NET application manages order entry data by using a DataSet object named EXorderEntry. The EXorderEntry object includes two 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.Cascade. 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.
 
Answer & Explanation Answer: D) The current value of OrderDetails.KeyDeleteRule is Rule.None.

Explanation:

The rule enumeration indicates the action that occurs when a ForeignKeyConstraint is enforced.None specifies that no action will occur, but exceptions are generated. This is what has occurred in this scenario.

 

Incorrect Answers:

 

A: Cascade specifies that all rows containing that value are also deleted.

B: SetNull specifies that values in all child columns are set to null values.

C: SetDefault specifies that all child columns be set to the default value for the column.

Report Error

View Answer Report Error Discuss

Q:

You are a Web developer for XYZ. 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 XYZ01.


The company purchases a factory automation software application. The application is installed on XYZ01, 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 XYZ01. Which string should you use?

A) ?Server=XYZ01;Data Source=Factory; Initial Catalog=FactoryDB;Integrated Security=SSPI? B) ?Server=XYZ01;Data Source=Factory; Database=FactoryDB;Integrated Security=SSP1?
C) ?Data Source=XYZ01\Factory; Initial Category=Factory; Integrated Security=SSP1? D) ?Data Source=XYZ01\Factory; Database=FactoryDB; Integrated Security=SSP1?
 
Answer & Explanation Answer: D) ?Data Source=XYZ01\Factory; Database=FactoryDB; Integrated Security=SSP1?

Explanation:

The Data Source attribute of the connection string contains the name, instance or network address of the instance of SQL Server to which to connect. In this scenario we are to connect to the Factory Instance on XYZ01 so we use XYZ01\Factory as data source. To specify the database we should either use the Database or the Initial Catalog attribute. Here we use Database=FactoryDB.

 

Incorrect Answers:

 

A, B: There is no Server attribute in the connection string. Instead we should use the Data Source attribute to specify the server and the instance.

 

C: There is no Initial Category attribute in the connection string. We can use Database or the Initial Catalog attribute to specify the database.

Report Error

View Answer Report Error Discuss

Q:

You are creating an ASP.NET page for a travel service. The page contains a CheckBoxList control that contains travel destinations. Customer 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 destination 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.
 
Answer & Explanation Answer: B) Set the RepeatDirection property to Horizontal.

Explanation:

The DataList.RepeatDirection property is used to get or select whether the DataList control displays vertically or horizontally. If this property is set to RepeatDirection.Horizontal, the items in the list are displayed in rows loaded from left to right, then top to bottom, until all items are rendered.

 

Incorrect Answers:

A: If the DataList.RepeatDirection property is set to RepeatDirection.Vertical, the items in the list are displayed in columns loaded from top to bottom, then left to right, until all items are rendered.


C, D:DataList.RepeatLayout Property gets or sets whether the control is displayed in a table or flow layout. It does not affect the order in which the items are displayed.

Report Error

View Answer Report Error Discuss

Q:

You develop an inventory management application called XYZManagement that will call a Microsoft SQL Server stored procedure named sp_GetDailyXYZSales. The stored procedure will run a query that returns your daily sales total as an output parameter. This total will be displayed to users in a message box.


Your application uses a SqlCommand object to run sp_GetDailyXYZSales. You write the
following code to call sp_GetDailyXYZSales:
SqlConnection cnn = new SqlConnection(myConnString);
SqlCommand cmd = new SqlCommand(“sp_GetDaily XYZ Sales”, cnn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter prm = cmd.Parameters.Add(“@ItemTotal”,SqlDbType.Int);
prm.Direction = ParameterDirection.Output;
cnn.Open();
cmd.ExecuteNonQuery();


Now you must write additional code to access the output parameter. Which code segment should you use?

A) MessageBox.Show(?Total is: ? + cmd.Parameters[?@Output?].Value.ToString()); B) MessageBox.Show(?Total is: ? + cmd.Parameters[?@Output?].ToString());
C) MessageBox.Show(?Total is: ? + cmd.Parameters[?@ItemTotal? D) MessageBox.Show(?Total is: ? + cmd.Parameters[?@ItemTotal?
 
Answer & Explanation Answer: C) MessageBox.Show(?Total is: ? + cmd.Parameters[?@ItemTotal?

Explanation:

The @ItemTotal parameter is declared as an output parameter with SQL Server data type INT.We use the Value property of the SQLParameter class to retrieve the value of this parameter. We must also convert the INT value to a string value with the ToString method. We then supply this string to the MessageBox.Show method. 

 

Incorrect Answers


Option A, B:
The @ItemTotal parameter is the output parameter. Using @Output this way is incorrect. Output is a keyword and no variable named @Output has been declared.


Option D:
We must use the Value method to retrieve the value of the parameter..

Report Error

View Answer Report Error Discuss

Q:

You develop an enterprise application, called XYZApplication that includes a Windows Form presentation layer, middle-tier components for business logic and data access, and a Microsoft SQL Server database.


You are in the process of creating a middle-tier component that will execute the data access routines in your application. When data is passed to this component, the component will call several SQL Server stored procedures to perform database updates. All of these procedure calls run under the control of a single transaction.


The code for the middle-tier component will implement the following objects:
SqlConnection cn = new SqlConnection();
SqlTransaction tr;


If two users try to update the same data concurrently, inconsistencies such as phantom reads will occur. You must now add code to your component to specify the highest possible level of protection against such inconsistencies.
Which code segment should you use?

A) tr = cn.BeginTransaction(?ReadCommitted?); B) tr = cn.BeginTransaction(IsolationLevel.ReadCommitted);
C) tr = cn.BeginTransaction(IsolationLevel.Serializable); D) tr = cn.BeginTransaction(?Serializable?);
 
Answer & Explanation Answer: C) tr = cn.BeginTransaction(IsolationLevel.Serializable);

Explanation:

Serializable is the highest isolation transaction level. It provide the highest possible level of protection against concurrent data errors. The correct syntax to begin a transaction with this transaction isolation level is: cn.BeginTransaction(IsolationLevel.Serializable)

Report Error

View Answer Report Error Discuss