PrepAway - Latest Free Exam Questions & Answers

Author: seenagape

Which approach should you recommend?

You have an asp net web application thai is deployed on muttiple identical web servers the web servers retrieve data from multiple, identical Microsoft SQL Server databases.
Each user maintains an active Web application session during the entire business day You notice that some. Web servers consume 100 percent of their CPU resources and return timeout errors, while other web servers are idle.
You need to design a plan to load-balance the Web application across the available Web servers.
Which approach should you recommend?

Which code elements needs to be added in the empty lines?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You create a stored procedure to insert a new record in the Categories table according to following code segment.

CREATE PROCEDURE dbo.InsertCategory
@CategoryName navrchar(15),
@Identity int OUT
AS
INSERT INTO Categories(CategoryName) VALUES (@CategoryName)
SET @Identity = SCOPE_IDENTITY()
RETURN @@ROWCOUNT

You add the following code fragment. (Line numbers are included for reference only.)

01 private static void ReturnIdentity(string connectionString)
02 {
03 using(SqlConnection connection = new SqlConnection(connectionString))
04 {
05 SqlDataAdpater adapter = new SqlDataAdapter(“SELECT CategoryID, CategoryName FROM dbo.Categories”, connection);
06 adapter.InsertCommand = new SqlCommand(“InsertCategory”, connection);
07 adapter.InsertCommand.CommandType = CommandType.StoredProcedure;
08 SqlParameter rowcountParameter = adapter.InsertCommand.Parameters.Add(“@RowCount”, SqlDbType.Int);
09 …
10 adapter.InsertCommand.Parameters.Add(“@CategoryName”, SqlDbType.NChar, 15, “CategoryName”);
11 SqlParameter identityParameter = adapter.InsertCommand.Parameters.Add(“@Identity”, SqlDbType.Int, 0, “CategoryID”);
12 …
13 DataTable categories = new DataTable();
14 adapter.Fill(categories);
15 DataRow ctegoryRow = categories.NewRow();
16 categoryRow[“CategoryName”] = “New beverages”;
17 categories.Rows.Add(categoryRow);
18 adapter.Update(categories);
19 Int32 rowCount = (Int32)adapter.InsertCommand.Parameters[“@RowCount”].Value;
20 }
21 }

Which code elements needs to be added in the empty lines?

Which approach should you recommend?

You have a Web application that has been migrated from ASP.NET 3.5 to ASP.NET 4. While testing the migrated Web application, developers notice that the non-input Web controls with the property Enabled=”false” are rendenng as enabled.
You need to ensure that the controls in the migrated Web application render correctly, and that other Web applications hosted on the same Web server are not affected by the solution.
Which approach should you recommend

Which code segment should you insert at the empty phrase in line 01?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application retreives data from Microsoft SQL Server 2008 database named AdventureWorks.
The AdventureWorks.dbo.ProductDetails table contains a column names ProductImages that uses a varbinary(max) data type.

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

01 SqlDataReader reader = command.ExecureReader(– empty phrase here –);
02 while(reader.Read())
03 {
04 pubID = reader.GetString(0);
05 stream = new FileStream(…);
06 writer = new BinaryWriter(stream);
07 startIndex = 0;
08 retval = reader.GetBytes(1, startIndex, outByte, 0, bufferSize);
09 while(retval == bufferSize)
10 {
11 …
12 }
13 writer.Write(outbyte, 0, (int)retval-1);
14 writer.Flush();
15 writer.Close();
16 stream.Close();
17 }

You need to ensure that the code supports streaming data from the ProductImages column.
Which code segment should you insert at the empty phrase in line 01?

What are two possible code segments that you can use to achieve the goal?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server 2008 database. You add the following store procedure to the database.

CREATE PROCEDURE GetProducts
AS
BEGIN
SELECT ProductID, Name, Price, Cost
FROM Product
END

You create a SqlDataAdapter named adapter to execute the stored procedure. You need to fill a DataTable instance with the first 10 rows of the result set.
What are two possible code segments that you can use to achieve the goal?