Practice Exam






Practice Exam

Question 1

You are developing an ASP.NET application using Visual C# .NET. In your ASPX page, you want to invoke and display a Visual C# .NET method named DisplayProductNames() when the page is rendered to the client. Which of the following code blocks should you choose to call the DisplayProductNames() method?

  • A.

    <script language="C#" runat="server">
        Response.Write(DisplayProductNames());
    </script>
    
  • B.

    <script language="C#" runat="client">
        Response.Write(DisplayProductNames());
    </script>
    
  • C.

    <script language="C#">
        Response.Write(DisplayProductNames());
    </script>
    
  • D.

    <%= DisplayProductNames()%>
    
  • E.

    <%= DisplayProductNames();%>
    
Question 2

You've used Visual C# .NET to develop an ASP.NET Web form named Login.aspx. This Web form allows users to enter their credentials for accessing the Web site. You have defined a code-behind class named Login under the MyCompany namespace in a file named Login.aspx.cs that contains the business logic. You now want to link the user interface file with the code-behind file; you do not want to precompile the code-behind class each time you make modifications. Which of the following Page directives would you use in the Login.aspx file?

  • A.

    <%@ Page Language="c#" Codebehind="Login.aspx.cs"
    ClassName="MyCompany.Login"%>
    
  • B.

    <%@ Page Language="c#" Codebehind="Login.aspx.cs"
    Inherits="MyCompany.Login"%>
    
  • C.

    <%@ Page Language="c#" Src="Login.aspx.cs"
    Inherits="MyCompany.Login"%>
    
  • D.

    <%@ Page Language="c#" Src="Login.aspx.cs"
    ClassName="MyCompany.Login"%>
    
Question 3

Your Web form allows users to enter a telephone number into a TextBox ASP.NET Web server control named txtPhone. You use the RegularExpressionValidator control to ensure that the phone numbers are in the correct format.

The Web form also includes a Button ASP.NET Web server control, btnReset, to reset the data entry values. You do not want the validations to occur when the button is clicked. What should you do to ensure this?

  • A. Set the CausesValidation property of the TextBox control to true.

  • B. Set the CausesValidation property of the Button control to true.

  • C. Set the CausesValidation property of the TextBox control to false.

  • D. Set the CausesValidation property of the Button control to false.

Question 4

You have designed a Web form that uses a DropDownList control to allow a user to select a state containing her shipping address. You've implemented an event handler for the SelectedIndexChanged event to update the sales tax amount displayed on the Web form when a new state is selected.

Users report that the sales tax amount is not updated no matter which state they choose in the DropDownList control. What must you do to fix this problem?

  • A. Move the code to the PreRender event of the DropDownList control.

  • B. Set the AutoPostBack property of the DropDownList control to true.

  • C. Replace the DropDownList control with a ListBox control.

  • D. Set the EnableViewState property of the DropDownList control to true.

Question 5

You have designed a Web form that includes a DropDownList control with an ID of ddlSize. The Items property of the ddlSize control contains the following items:

-
9
10
11

The Web form also contains a RequiredFieldValidator control named rfvSize. You have set the ControlToValidate property of rfvSize to ddlSize. Your goal is to ensure that a nondefault value is chosen from ddlSize before the Web form is posted back to the server. What other property setting must you make on the rfvSize control?

  • A. rfvSize.InitialValue = "-";

  • B. rfvSize.Display = ValidatorDisplay.Dynamic;

  • C. rfvSize.Visible = true;

  • D. rfvSize.EnableClientScript = false;

Question 6

You have developed an ASP.NET Web page that consists of several Web server controls for data entry. You have placed validation controls to validate the data entered in the Web server controls and have used the Text property of the validation controls to display the error messages inline within the validation control. You have deployed the Web page to the testing Web server so that the testers can test your Web page. One of the testers who uses Internet Explorer 4.0 reports that the Web page does not display the error message when he tabs from the control after providing an invalid value. The error messages are displayed only when he clicks the Submit button. How can you solve this problem?

  • A. Set the Enabled attribute of the validation controls to true.

  • B. Set the SmartNavigation attribute to true in the Page directive.

  • C. Ask the tester to enable client-side scripting before accessing the Web page.

  • D. Ask the tester to upgrade to Internet Explorer 6.0 before accessing the Web page.

Question 7

When a page is restricted in your ASP.NET application (that is, when a 403 error occurs), you want to display a page named Forbidden.aspx. For all other errors, you want to display a page named GeneralError.aspx to the user. Which settings should you make in the web.config file to ensure this?

  • A.

    <customErrors mode="On"
     defaultRedirect="GeneralError.aspx">
        <error statusCode="403" redirect="Forbidden.aspx" />
    </customErrors>
    
  • B.

    <customErrors mode="RemoteOnly"
     defaultRedirect="GeneralError.aspx">
        <error statusCode="403" redirect="Forbidden.aspx" />
    </customErrors>
    
  • C.

    <customErrors mode="On">
        <error statusCode="403" redirect="Forbidden.aspx" />
        <error statusCode="all" redirect="GeneralError.aspx" />
    </customErrors>
    
  • D.

    <customErrors mode="RemoteOnly">
        <error statusCode="403" redirect="Forbidden.aspx" />
        <error statusCode="all" redirect="GeneralError.aspx" />
    </customErrors>
    
Question 8

You have written a Visual C# .NET method that opens a database connection using a SqlConnection object, which retrieves some information from the database and then closes the connection. The information is retrieved using a stored procedure that might not always be available because of the maintenance schedules. You have wrapped the code to call the stored procedure in a try-catch-finally block. You use two catch blocks—one to catch the exceptions of type SqlException and the second to catch the exceptions of type Exception. Which of the following places should you choose for closing the SqlConnection object?

  • A. Inside the try block, before the first catch block

  • B. Inside the catch block that catches SqlException objects

  • C. Inside the catch block that catches Exception objects

  • D. Inside the finally block

Question 9

Your ASP.NET application includes a Web page named Errors.htm that is displayed in response to any error. This page is configured using the following code in the web.config file:

<customErrors mode="Off"
 defaultRedirect="Errors.htm">
</customErrors>

The application includes a detail page named AccountSummary.aspx. When an error occurs on the login page, you want to log those errors in the custom log file, Custom.txt. What should you do?

  • A. Add an <error> element as a child of the <customErrors> element in web.config. Specify the page name as AccountSummary.aspx and the redirect page as Custom.txt in the new element.

  • B. Add an ErrorPage attribute to the Page directive for AccountSummary.aspx. Set the value of this attribute to Custom.txt.

  • C. Implement the logic in the Page_Error() event handler in AccountSummary.aspx to store errors into Custom.txt.

  • D. Implement the logic in the Application_Error() event handler in AccountSummary.aspx to store errors into Custom.txt.

Question 10

You are developing an application to take orders over the Internet. When a user posts back the order form, you first check to see whether she is a registered customer of your company. If not, you must transfer control to the Register.html page. Which method should you use to transfer it?

  • A. Response.Redirect("Register.html");

  • B. Server.Transfer("Register.html");

  • C. Server.Execute("Register.html");

  • D. Server.CreateObject("Register.html");

Question 11

You have deployed an ASP.NET application on your company's intranet. Your company has standardized on Internet Explorer 6.0 as the corporate browser. Users complain that when they use the Submit button to send their expense reports via the application, the focus moves to the first control on the reporting form. This makes it difficult for users to edit their expense reports.

What is the easiest way to maintain focus across postback operations in this application?

  • A. Store the name of the current control in session state when the page is posted back, and use this name to set the focus when the page is re-created.

  • B. Store the name of the current control in view state when the page is posted back, and use this name to set the focus when the page is re-created.

  • C. Write client-side code that stores the focus control in a hidden field and retrieves this information when the page is re-created.

  • D. Set the SmartNavigation attribute of the Page directive to true.

Question 12

Your ASP.NET Web application uses session state to track usernames and other user-specific details. Your Web application contains a Web page that displays a greeting to the user—"Welcome <UserName>"—and the product catalog from a SQL Server database. The product catalog is displayed in a DataGrid control that is populated at every page load. Which of the following options should you use in this application to maximize performance? (Select two.)

  • A. Disable view state for the page.

  • B. Disable session state for the page.

  • C. Make the session state read-only for the page.

  • D. Store the session state in SQL Server.

Question 13

Your ASP.NET application stores sensitive data in the session state. You need to maintain the session state even if the Web server crashes and needs to be restarted. Which mode attribute should you use to configure the <sessionState> element for this application?

  • A. mode="Inproc"

  • B. mode="StateServer"

  • C. mode="SqlServer"

  • D. mode="Off"

Question 14

You are developing an online bookstore application in Visual C# .NET. Your application needs to store the most recent book viewed by the user and show the recently viewed book's details in the lower part of the Web pages whenever the user accesses the Web site. You do not want to use server-side resources to store the book ISBN. Which of the following state-management techniques will help you accomplish this?

  • A. Hidden fields

  • B. View state

  • C. Cookies

  • D. Sessions

Question 15

You have created an ASP.NET Web page, Catalog.aspx, that allows users to purchase products from the catalog. The catalog displays the previously selected item in the lower part of the Web page. This product detail is encapsulated in a Product object and is not accessed outside the Web page. The Product class is defined as follows:

[Serializable]
public class Product
{
    public int ProductCode;
    public string ProductName; 
}

Which of the following objects should you use to store the Product object?

  • A. Application state

  • B. Session state

  • C. View state

  • D. Cache object

Question 16

You have developed an ASP.NET Web form that displays product information from a SQL Server 2000 database. The database contains information for about 100 products. Each time the page is displayed, it retrieves information on one product specified by the user. These pages are requested very frequently by users.

Which type of caching can you use to speed up the delivery of this page?

  • A. Output

  • B. Varying output

  • C. Application data

  • D. Fragment output

Question 17

You are creating an ASP.NET Web page that reads data from a large XML file (CustomerInformation.xml), processes and loads the data in a DataSet object, and displays the results to the browser in a DataGrid control. The processing of the file data consumes server resources and delays the loading of the Web page. The Web page displays the same data at every request unless the data in the file changes. Which of the following code segments should you use for caching to improve performance?

  • A.

    <%@ OutputCache VaryByCustom="CustomerInformation.xml" %>
    
  • B.

    <%@ OutputCache VaryByParam="CustomerInformation.xml" %>
    
  • C.

    Cache["FileData"] = dsCustomers;
    
  • D.

    Cache.Insert("CacheValue",
       dsCustomers,
       new CacheDependency(Server.MapPath(
        " CustomerInformation.xml")));
    
Question 18

You are an ASP.NET developer of a company that has a chain of stores selling leather products in the United States. You have developed a user control named StoreLocator.ascx that is placed in the main page of the company's Web site. The user control contains a text box named txtState that accepts a state name from the user and displays the list of stores in that state. You want to cache different versions of the user control for 600 seconds for each state. Which of the following OutputCache directives should you choose to enable caching on the user control?

  • A. <%@ OutputCache Duration="600" VaryByControl="txtState" %>

  • B. <%@ OutputCache Duration="600" VaryByParam="txtState" %>

  • C. <%@ OutputCache Duration="600" VaryByControl="*" %>

  • D. <%@ OutputCache Duration="600" VaryByParam="*" %>

Question 19

In your ASP.NET application, you use the data cache to store a DataSet object containing a single DataTable object named Customers. The Customers DataTable has all the rows and columns from the Customers table in your database. You want to bind only selected columns from the Customers table to a DataGrid control. You also want a solution that requires minimum programming and that has minimum impact on the functionality and performance of other applications accessing the same SQL Server database. How should you proceed?

  • A. Create a second DataTable object in the DataSet object. Copy the desired data to the second DataTable object, and bind the second DataTable object to the DataGrid control.

  • B. Create a Command object to retrieve the desired columns from the DataTable object, and bind the Command object to the DataGrid control.

  • C. Delete the undesired columns from the DataTable object.

  • D. Create a DataView object that retrieves only the desired columns from the DataTable object, and bind the DataGrid control to the DataView object.

Question 20

Your ASP.NET Web application includes a SqlDataAdapter object named sqlDataAdapter1 that was created by dragging and dropping the Customers table from a database to your form. Your application also includes a DataSet named dsCustomers1, based on this SqlDataAdapter. Which line of code should you use to load the data from the database into the DataSet?

  • A. dsCustomers1= sqlDataAdapter1.Fill("Customers");

  • B. sqlDataAdapter1.Fill("dsCustomers1", "Customers");

  • C. sqlDataAdapter1.Fill(dsCustomers1, "Customers");

  • D. sqlDataAdapter1.Fill(dsCustomers1);

Question 21

You have recently deployed an expense reporting system in your company, and the application relies heavily on its SQL Server database. All employees in the company have similar access permissions to the database. You have created the application in such a way that it uses an employee's logon name and password in the connection string to connect to SQL Server. Users of the application are consistently reporting slow performance of the application. Your task is to optimize the performance of this application. You've noted that another application which uses the same SQL Server database is having good performance. Which of the following steps should you take?

  • A. Compile the application to native code using ngen.exe.

  • B. Run the SQL Server Index Tuning Wizard.

  • C. Increase the maximum size of the connection pool.

  • D. Use the same connection string for all users.

Question 22

You are developing an ASP.NET Web application, named VerifyOrders, that receives data from the Orders application in XML format. The VerifyOrders application enables its users to review the orders and make any changes required. When the users are finished reviewing the orders, the VerifyOrders application must create an output XML file, which is returned to the Orders application. The output XML file must contain the original as well as the changed values. Which option should you choose to create such an output XML file?

  • A. Call the DataSet.WriteXmlSchema() method and pass an XmlWriter object as a parameter.

  • B. Call the DataSet.WriteXml() method and set the value for the XmlWriteMode parameter to IgnoreSchema.

  • C. Call the DataSet.WriteXml() method and set the value for the XmlWriteMode parameter to WriteSchema.

  • D. Call the DataSet.WriteXml() method and set the value for the XmlWriteMode parameter to DiffGram.

Question 23

You are writing a Visual C# .NET Web application that executes several stored procedures to update a SQL Server database. You use database transactions to ensure that either all updates to the database succeed or the changes are rolled back in case of an error. You used the following code segment to create the database connection and the transaction object in your program:

SqlConnection sqlConnection1 = new SqlConnection(strConnString);
sqlConnection1.Open();

SqlCommand sqlCommand1 = new SqlCommand();
SqlTransaction sqlTrans;

You need to prevent other users from updating or inserting rows into the database until the transaction is complete. Which of the following statements enable you to fulfill this requirement?

  • A.

    sqlTrans = sqlConnection1.BeginTransaction(
       IsolationLevel.ReadCommitted);
    
  • B.

    sqlTrans = sqlConnection1.BeginTransaction(
       IsolationLevel.Serializable);
    
  • C.

    sqlTrans = sqlCommand1.BeginTransaction(
       IsolationLevel.ReadCommitted);
    
  • D.

    sqlTrans = sqlCommand1.BeginTransaction(
       IsolationLevel.Serializable);
    
Question 24

You need to develop a Web application that exports the contents of the Customers table to an XML file. The exported XML file will then be used by a marketing company for various customer relations programs. The marketing company requires that customer data be exported to the XML file in the following format:

<Customers CustomerID="ALFKI" ContactName="Maria Anders" Phone="030-0074321" />
<Customers CustomerID="ANATR" ContactName="Ana Trujillo" Phone="(5) 555-4729" />

Which of the following code segments would you use to export the Customers table to the XML format in the specified format?

  • A.

    foreach(DataColumn c in dataSet1.Tables["Customers"].Columns)
    {
        c.ColumnMapping = MappingType.Attribute;
    }
    dataSet1.WriteXml("Customers.xml");
    
  • B.

    foreach(DataColumn c in dataSet1.Tables["Customers"].Columns)
    {
        c.ColumnMapping = MappingType.Element;
    }
    dataSet1.WriteXml("Customers.xml");
    
  • C.

    foreach(DataColumn c in dataSet1.Tables["Customers"].Columns)
    {
        c.ColumnMapping = MappingType.Attribute;
    }
    dataSet1.WriteXml("Customers.xml", XmlWriteMode.WriteSchema);
    
  • D.

    foreach(DataColumn c in dataSet1.Tables["Customers"].Columns)
    {
        c.ColumnMapping = MappingType.Element;
    }
    dataSet1.WriteXml("Customers.xml", XmlWriteMode.WriteSchema);
    
Question 25

You are developing a Web application that processes data from a SQL Server 7.0 database. The application reads the data from the database in a forward-only way and does not perform any update operations. You use the System.Data.SqlClient.SqlConnection object to connect to the SQL Server database and then use a System.Data.SqlClient.SqlCommand object to run a stored procedure and retrieve the results into a System.Data.SqlClient.SqlDataReader object. The data returned by the SqlCommand object consists of 1,000 rows and 1 column; the column is defined as nvarchar(20) in the database. You have written the following code to concatenate the column values of the returned result set into a string variable. What can you do to optimize the application? (Select two answers.)

SqlDataReader dr = cmd.ExecuteReader();
String s;
while(dr.Read())
{
    s = s + dr.GetValue(0);
}
  • A. Replace the stored procedure with a SQL statement.

  • B. Replace the SqlDataReader object with a DataSet object.

  • C. Replace the while loop with a for each loop.

  • D. Replace the String variable with a StringBuilder object.

  • E. Replace the GetValue() method with the GetString() method.

Question 26

Your application uses a SqlDataReader object to retrieve patient information from a medical records database. When you find a patient who is currently hospitalized, you want to read the names of the patient's caregivers from the same database. You have created a second SqlDataReader object, based on a second SqlCommand object, to retrieve the caregiver information. When you call the ExecuteReader() method of the SqlCommand object, you get an error. What is the most likely cause of this error?

  • A. You are using the same SqlConnection object for both the SqlDataReader objects, and the first SqlDataReader is still open when you try to execute the SqlCommand.

  • B. You must use a SqlDataAdapter object to retrieve the caregiver information.

  • C. You must use the OleDbDataReader object to retrieve information instead of the SqlDataReader object.

  • D. You are using the ExecuteReader() method of the SqlCommand object and should be using the ExecuteScalar() method instead.

Question 27

You've used Visual C# .NET to develop an ASP.NET Web application that will be used by the customer service department. Your application receives data from the Orders application, and users of your application get calls from customers to make changes to their orders. You've written the code that allows them to make changes to the data, but now you want to write code that sends the changed records back to the Orders application. Which of the following methods should you use to accomplish this requirement?

  • A. DataSet.Clone()

  • B. DataSet.Copy()

  • C. DataSet.GetChanges()

  • D. DataSet.Merge()

Question 28

You are a .NET developer for a large warehousing company and need to develop a Web application that helps users manage the inventory. Inventory data is stored in a SQL Server 2000 database named WareHouse2 in a database named Inventory. You use the SqlConnection object and Windows Integrated authentication to connect to the Inventory database. Which of the following connection strings should you choose in your Visual C# .NET program?

  • A.

    
    "Provider=SQLOLEDB;Data Source=WareHouse2; Initial Catalog=Inventory; Integrated 
    graphics/ccc.gifSecurity=SSPI;"
    
  • B.

    
    "Provider=SQLOLEDB;Data Source=WareHouse2; Initial Catalog=Inventory; User Id=sa;
    graphics/ccc.gifPassword=Ti7uGf1;"
    
  • C.

    "Data Source=WareHouse2; Initial Catalog=inventory; Trusted_Connection=true;"
    
  • D.

    "Data Source=WareHouse2;User Id=sa; Password=Ti7uikGf1; Initial Catalog=inventory;"
    
Question 29

You need to develop a database application that interacts with an Oracle database. You need to write code to return the total number of customers from the database, and you need to create the fastest solution. Which of the following actions should you take? (Select all that apply.)

  • A. Write ad hoc SQL query to return the total number of customers.

  • B. Create a stored procedure to return the total number of customers.

  • C. Use the OleDbCommand.ExecuteScalar() method.

  • D. Use the OleDbCommand.ExecuteReader() method.

  • E. Use the OleDbDataAdapter.Fill() method.

Question 30

A Web form in your ASP.NET application includes a ListBox control named lbCustomers that displays a list of customers. The DataTextField property of the ListBox is bound to the CompanyName column of the Customers database table. Also, the DataValueField property of the ListBox is bound to the CustomerID column of the Customers database table.

Your form also contains a TextBox control named txtCustomerID, which uses simple data binding to display the SelectedItem.Value from the ListBox control.

When a user selects a new company name in the ListBox, you want to display the corresponding CustomerID value in the txtCustomerID control. What should you do?

  • A. Call the DataBind() method of the ListBox control in the SelectedIndexChanged event of the ListBox.

  • B. Create a public property named CustomerID and return the SelectedItem.Value property of the ListBox as the value of the public property.

  • C. Use simple data binding to bind the SelectedItem.Value property of the ListBox to the CustomerID column of the Customers table.

  • D. Call the DataBind() method of the TextBox control in the SelectedIndexChanged event of the ListBox.

Question 31

You are developing a sales analysis Web page that displays monthly sales in a DataGrid control. Whenever the sales amount increases for average sales, you want to display the sales amount underlined. Which of the following events should you choose to display the sales amount underlined?

  • A. ItemCreated

  • B. ItemCommand

  • C. ItemDataBound

  • D. DataBinding

Question 32

You have to develop an ASP.NET Web application that will be used by the order-tracking system of your company. The application must contain a form that displays a list of orders placed by customers for the past year. When an employee selects an order from the list box, you need to display the order status and other information about the selected order in a DataList control. You have retrieved the order details in a DataSet object named dsOrders. The dsOrders object contains a table named Order that contains the order status and other information. You have set the DataSource property of the DataList control to dsOrders and the DataMember property to Order. Which snippet of code would you use to bind the text box control to the field named OrderStatus in the Order table?

  • A.

    <ItemTemplate>
        <asp:TextBox id="txtOrderID" runat="server"
          text='<%# dsOrders.Order.OrderStatus %>'>
    </ItemTemplate>
    
  • B.

    <SelectedItemTemplate>
        <asp:TextBox id="txtOrderID" runat="server"
          text='<%# dsOrders.Order.OrderStatus %>'>
    </SelectedItemTemplate>
    
  • C.

    <ItemTemplate>
        <asp:TextBox id="txtOrderID" runat="server"
           text='<%# DataBinder.Eval(
              Container.DataItem, "OrderID") %>'>
    </ItemTemplate>
    
  • D.

    <SelectedItemTemplate>
        <asp:TextBox id="txtOrderID" runat="server"
           text='<%# DataBinder.Eval(
              Container.DataItem, "OrderID") %>'>
    </SelectedItemTemplate>
    
Question 33

You are designing an application that will enable users to read an XML file from an orders system and convert the XML file into an HTML file using the stylesheet DisplayOrders.xsl. Which object should you use to implement this requirement?

  • A. XPathNavigator

  • B. XslTransform

  • C. XmlSchema

  • D. XmlNode

Question 34

You need to develop an ASP.NET Web application that accesses the Orders XML Web service provided by your company's business partner. You know the URL of the Web service. How can you generate client-side proxy classes for a Web service? (Select two.)

  • A. Use a proxy tool such as the .NET WebService Studio tool.

  • B. Use the Web Services Description Language tool.

  • C. Use the Web Services Discovery Tool.

  • D. Add a Web reference to point to the Web service.

Question 35

You work as a Visual C# .NET programmer for a multinational marketing company. You have been given a task to create a localized version of a Windows form for use in countries where the text is read from right to left. You need to ensure that all the controls in the form are aligned properly for the ease of local users. You need to make minimal changes. Which of the following options should you choose to accomplish this task?

  • A. Set the dir attribute of each control on the Web form to rtl.

  • B. Set the rtl attribute of each control on the Web form to true.

  • C. Set the dir attribute of the <HTML> element to rtl.

  • D. Set the rtl attribute of the <HTML> element to true.

Question 36

You are converting an existing ASP application to an ASP.NET application. The ASP application uses ADO extensively for data access, and you do not want to convert the ADO code to ADO.NET code yet. You should ensure that the ADO objects continue to function properly on the ASP.NET pages. You also want to achieve the best possible performance from your application. Which of the following solutions should you choose?

  • A. Build a runtime callable wrapper for each ADO object you use.

  • B. Use a Page directive to set ASP compatibility mode on the ASP.NET pages, like so:

    <%@ Page AspCompat="true" %>
    
  • C. Use a Page directive to set the ASP.NET page language to VBScript, like so:

    <%@ Page Language="VBScript" %>
    
  • D. Use the Type Library Importer tool to create a primary interop assembly for the ADO objects.

Question 37

You are responsible for maintaining a COM component that is used by numerous applications throughout your company. You are not ready to convert this COM component to .NET-managed code, but you need to make it available to an increasing number of other projects being developed under the .NET Framework. What should you do?

  • A. Set a direct reference to the existing COM component from each .NET project.

  • B. Use the Type Library Importer tool to create and sign an assembly that will use the COM component. Then, you should place the created assembly in the Global Assembly Cache.

  • C. Use the Type Library Importer tool to create an assembly that will use the COM component. Then, you should place the created assembly in the Global Assembly Cache.

  • D. Obtain a primary interop assembly for the COM component.

  • E. Set a direct reference from a single .NET project to the COM component, and include this project in each solution that must make use of the component.

Question 38

You are developing your company's Web site using a Visual C# .NET Web application. The product demo page of the Web site uses PNG graphics to represent the steps involved in using the product. Your company has a strict policy to make Web pages accessible to all readers. What should you do to make this page more accessible?

  • A. Use JPG graphics instead of PNG graphics for maximum browser compatibility.

  • B. Use the AccessKey property for all graphical controls to make them more accessible.

  • C. Add ALT text to all graphics to indicate their purpose through the AlternateText property.

  • D. Add ALT text to all graphics to indicate their purpose through the ToolTip property.

Question 39

You've used Visual Studio .NET to create an ASP.NET Web application that interacts with a Microsoft SQL Server database. You've also created a stored procedure, named CalculateAccessCharges, to calculate the monthly wireless Internet access charges for customers. When you run the program, the results from the stored procedure are not as expected. You want to debug the CalculateAccessCharges stored procedure to find the error. You also want to minimize the time and efforts involved in debugging; which of the following actions should you take?

  • A. Use the Tools, Debug Processes menu to attach a debugger to the SQL Server, and then step into the CalculateAccessCharges stored procedure.

  • B. Place a breakpoint in the CalculateAccessCharges stored procedure, and then use the Debug, Step Into menu option to step into the C# program that calls the stored procedure.

  • C. Use the SQL Server Print command to print the calculated values in the stored procedure.

  • D. Use the Debug.WriteLine() method to print the calculated values in the stored procedure.

Question 40

You've developed a customer contact management application using a Visual C# ASP.NET Web application. You've used the methods of the Trace and Debug classes to log serious error messages encountered during program execution. You now want to record all such errors in the Windows event log but do not want any duplicate entries for error messages in the event log. In which two ways can you add a listener to the Windows event log?

  • A.

    EventLogTraceListener traceListener =
        new EventLogTraceListener("CustomEventLog");
    Trace.Listeners.Add(traceListener);
    
  • B.

    EventLogTraceListener traceListener =
        new EventLogTraceListener("CustomEventLog");
    Trace.Listeners.Add(traceListener);
    Debug.Listeners.Add(traceListener);
    
  • C.

    EventLogTraceListener traceListener =
        new EventLogTraceListener("CustomEventLog");
    
  • D.

    EventLogTraceListener traceListener =
        new EventLogTraceListener("CustomEventLog");
    Debug.Listeners.Add(traceListener);
    
Question 41

Your Web application is failing when a particular variable equals 117. Unfortunately, you cannot predict when this will happen. You want to write minimal code; which debugging tool should you use to investigate the problem?

  • A. Locals window

  • B. Output window

  • C. Immediate window

  • D. Conditional breakpoint

Question 42

You've developed a Visual Studio .NET application that helps the shipping department in creating mix-and-match pallets. Users of the application complain that the numbers of cases in the pallet are not displayed correctly. To find the location of the error, you place a breakpoint on the GetCasesInPallet() method. However, when you execute the program from the Visual Studio .NET environment, the execution does not break at the breakpoint. Which of the following actions should you take to resolve this problem?

  • A. Select Exceptions from the Debug menu.

  • B. Select Enable All Breakpoints from the Debug menu.

  • C. Select Build, Configuration Manager and set the project's configuration to Debug.

  • D. Select Build, Configuration Manager and set the project's configuration to Release.

Question 43

You are debugging your ASP.NET Web application and are concerned about the amount of time it's taking to render a particular page. Which class can you use to obtain detailed timing information for the events on the page as it is rendered by the ASP.NET engine?

  • A. System.Diagnostics.Trace

  • B. System.Diagnostics.Debug

  • C. System.Web.TraceContext

  • D. System.Web.UI.Page

Question 44

You have developed an online shipment tracking Visual C# ASP.NET application. The ShipmentStatus.aspx page in your application is displaying incorrect shipping statuses for shipments. You want to view the tracing information for the page. What should you do?

  • A. Set the <trace> element in the application's web.config configuration file to <trace enabled="false" />.

  • B. Set the <trace> element in the application's web.config configuration file to <trace enabled="true" />.

  • C. Set the <trace> element in the application's web.config configuration file to <trace enabled="ShipmentStatus.aspx" />.

  • D. Set the Trace attribute in the Page directive of the ShipmentStatus.aspx page to <%@ Page Trace="true" />.

  • E. Set the Trace attribute in the Page directive of the ShipmentStatus.aspx page to <%@ Page Trace="false" />.

Question 45

You've developed an intranet ASP.NET Web application that helps manage production schedules for a manufacturing company. This application uses a library named Production.dll. You anticipate that in the future some other applications might use classes from the Production.dll library. You also need to maintain multiple versions of Production.dll. Which of the following options should you choose to deploy Production.dll? (Select all that apply.)

  • A. Sign Production.dll with sn.exe.

  • B. Sign Production.dll with signcode.exe.

  • C. Install Production.dll in the Windows system directory.

  • D. Install Production.dll in the application's bin directory.

  • E. Install Production.dll in the Global Assembly Cache.

Question 46

You are a programmer for a popular gaming software publishing company that has recently designed a series of games using the .NET Framework. All these new game applications share some components. Some of these components are shipped in the box with the application, and others are deployed over the Internet. Which of the following commands should you use for these components before packaging them for deployment?

  • A. Use sn.exe to sign the components.

  • B. Use signcode.exe to sign the components.

  • C. Use sn.exe followed by signcode.exe to sign the components.

  • D. Use signcode.exe followed by sn.exe to sign the components.

Question 47

You've used Visual C# .NET to develop an assembly that allows developers in your company to create pie charts in their Web applications. You named the assembly PieChart.dll and packaged it as version 1.0.0, which is deployed into the GAC. After two months, you discovered that a bug existed in the assembly. You fixed the bug by releasing a new version of the assembly, named 1.0.1. You then placed the newly created assembly in the GAC. What will happen to the applications written by other developers who use PieChart.dll?

  • A. The applications using the PieChart.dll assembly will break because the applications will notice two versions of the assembly in the GAC and won't know which one to execute.

  • B. The applications using the PieChart.dll assembly will notice a new version of the assembly and will load the new version of the assembly, causing no problems.

  • C. The applications using the PieChart.dll assembly will not be bothered by the new version of the assembly in the GAC and will continue to use the older, buggy version of the assembly.

  • D. The applications using the PieChart.dll assembly will be requested to select the desired assembly version to run for their applications.

Question 48

You've used Visual C# .NET to develop a component, named BarGraph, that enables developers to create bar graphs in their applications. The developers need to deploy the BarGraph component with each application that uses the component. How should you package the BarGraph component for deployment?

  • A. Use a Cab project to package the BarGraph component.

  • B. Use a Setup project to package the BarGraph component.

  • C. Use a Web Setup project to package the BarGraph component.

  • D. Use a Merge Module project to package the BarGraph component.

  • E. Use a Primary Interop Assembly to package the BarGraph component.

Question 49

You have created a database-driven Web application. Using Microsoft SQL Server, you have also generated an installation script for your database. This script is stored in a file named InstData.sql. You've created a Web Setup project using Visual Studio .NET to deploy this application on your production Web server. Which of the following editors should you choose to create the database when deploying your application on the client's machine?

  • A. Custom Actions Editor

  • B. Launch Conditions Editor

  • C. File System Editor

  • D. User Interface Editor

Question 50

Your ASP.NET application contains this setting in the web.config file:

<identity impersonate="true"
   userName="CORP\Auditing" password="Auditing"/>

You are allowing only digest or Windows-integrated authentication in IIS, and ASP.NET is running under the SYSTEM account. Which identity will ASP.NET use to authorize resources if a user with the Windows account Shirley in the CORP domain logs in via digest authentication?

  • A. CORP\Shirley

  • B. ASPNET

  • C. SYSTEM

  • D. IUSR_ComputerName

  • E. CORP\Auditing

Question 51

You want to give target Web servers the capability to customize your application. In particular, you want to let them specify the file path where the output files, which are generated by the application, need to be placed. You also want to write a minimum of code. How should you add this capability to your application?

  • A. Let the user edit the text in the Registry and use the Microsoft.Win32.Registry class to retrieve the value she saves.

  • B. Add another customconfiguration.xml file to store the output file path for the application.

  • C. Add an <outputFilePath> element to the application configuration file, web.config, to store the output file path for the application.

  • D. Add an <add> element to the <appSettings> element of the application configuration file, web.config, to store the output file path for the application.

Question 52

Your ASP.NET application requires users to be authenticated with a strong identity. You must allow users with any version 4.x or better browser, and you want passwords to cross the network only with secure encryption. Which authentication should you use?

  • A. Passport authentication with Anonymous IIS authentication

  • B. Windows authentication with Basic IIS authentication

  • C. Windows authentication with Digest IIS authentication

  • D. Windows authentication with Integrated IIS authentication

Question 53

You have developed an intranet ASP.NET application for your company that uses Microsoft Windows authentication to authenticate the users of the application. After the employee is authenticated, he can access all the Web pages of the intranet application. However, your application contains an Accounting directory that has details of employee salaries and paychecks. You want only users of the Accounting role to access the pages in this directory. Which of the following pieces of code should you write in the web.config file of your application? (Select all that apply.)

  • A. Add the following <authorization> element in the web.config file of the application directory:

    <authentication mode="Windows"/>
    <authorization>
       <deny users="?" />
    </authorization>
    
  • B. Add the following <authorization> element in the web.config file of the application directory:

    <authentication mode="Windows"/>
    <authorization>
       <deny roles="?" />
    </authorization>
    
  • C. Add the following <authorization> element in the web.config file of the Accounting directory:

    <authorization>
       <allow roles="Accounting" />
       <deny users="*" />
    </authorization>
    
  • D. Add the following <authorization> element in the web.config file of the Accounting directory:

    <authorization>
       <allow roles="Accounting" />
       <deny users="?" />
    </authorization>
    
Question 54

You use Visual Studio .NET to develop an ASP.NET Web application for your state university. You want only members of the Faculty or Admins role to have access to the GradesManagement.aspx Web page of your application. Which of the following options should you choose to implement the security? (Select all that apply.)

  • A.

    if (Thread.CurrentPrincipal.IsInRole("Faculty") ||
        Thread.CurrentPrincipal.IsInRole("Admins"))
    {
        Transfer();
    }
    
  • B.

    if (Thread.CurrentPrincipal.IsInRole("Faculty") &&
        Thread.CurrentPrincipal.IsInRole("Admins"))
    {
        Transfer();
    }
    
  • C.

    [PrincipalPermissionAttribute(
        SecurityAction.Demand, Role="Faculty"),
    PrincipalPermissionAttribute(
        SecurityAction.Demand, Role="Admins")]
    public void Transfer()
    {
    ...
    }
    
  • D.

    PrincipalPermission permCheckFaculty =
          new PrincipalPermission(null, "Faculty");
    PrincipalPermission permCheckAdmins =
          new PrincipalPermission(null, "Admins");
    permCheckAdmins.Demand();
    
Question 55

One of your colleagues is designing a Changed event for his control. He complains to you that his code behaves abnormally: It runs fine some of the time but generates exceptions at other times. Part of his event-handling code follows (line numbers are for reference purpose only):

01: public delegate void ChangedEventHandler(
    object sender, CustomerInfoEventArgs args);
02: public event ChangedEventHandler Changed;
03: protected virtual void OnChanged(CustomerInfoEventArgs e)
04: {
05:        Changed(this, e);
06:}

Which of the following suggestions will solve his problem?

  • A. The code in line 06 should be replaced with the following:

    if (ChangedEventHandler != null)
        ChangedEventHandler(this, e);
    
  • B. The code in line 06 should be replaced with the following:

    if (ChangedEventHandler != null)
        Changed(this, e);
    
  • C. The code in line 06 should be replaced with the following:

    if (Changed != null)
        ChangedEventHandler(this, e);
    
  • D. The code in line 06 should be replaced with the following:

    if (Changed != null)
        Changed(this, e);
    
Question 56

You are building a custom control for your company's ASP.NET Web applications. The control will contain the company's privacy policy and copyright notices in a standard set of labels. This control should be shared by multiple applications. Which type of control should you create?

  • A. Web user control

  • B. Composite Web custom control

  • C. Web custom control that inherits from the Label control

  • D. Web custom control that inherits from the WebControl control

Question 57

Your department is responsible for maintaining the accounting application of your company. You've been assigned the task of creating a standard control to represent credit and debit accounts that will be placed in the Web forms of the accounting application. The control will be made up of a collection of TextBox and ComboBox controls. You want to write a minimum of code. Which of the following options should you choose to create such a custom control?

  • A. Add a Web custom control to the project and inherit the custom control from the WebControl class.

  • B. Add a Component class to the project and inherit the custom control from the Component class.

  • C. Add a Web user control to the project and inherit the custom control from the UserControl class.

  • D. Add a Web form to the project and inherit the custom control from the Form class.

Question 58

You are creating a specialized control that will display text rotated at an angle specified at design time. This control must be installed into the Visual Studio .NET toolbox so that it can be used in many projects. The control's user interface will resemble that of a Label control, with one additional property named RotationAngle. Which type of control should you create?

  • A. Web user control

  • B. Composite Web custom control

  • C. Web custom control that inherits from the WebControl control

  • D. Web custom control that inherits from the Label control

Question 59

Your colleague has developed a user control in a file named LogIn.ascx to prompt for the username and password from the user. She wants to display the LogIn control, defined in the CMI namespace in the Welcome Web page. Which of the following options would you recommend to your colleague to make the LogIn user control available in the Welcome Web page?

  • A.

    <%@ Register TagPrefix="CMI" TagName="LogIn"
        Src="LogIn.ascx" %>
    
  • B.

    <%@ Control Namespace="CMI" ClassName="LogIn"
        Src="LogIn.ascx" %>
    
  • C.

    <%@ Register Namespace="CMI" TagName="LogIn"
        Src="LogIn.ascx" %>
    
  • D.

    <%@ Control Namespace="CMI" Inherits="LogIn"
        Src="LogIn.ascx" %>
    
Question 60

You are creating a composite control for your ASP.NET Web application that consists of a set of Label, TextBox, and DropDownList Web server controls. Which of the following methods should you override to enable custom rendering for the composite control?

  • A. CreateControl()

  • B. CreateChildControls()

  • C. RenderControl()

  • D. Render()


     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows