Practice Exam

Team-Fly    

Developing XML Web Services and Server Components with Visual C#™ .NET and the .NET Framework, Exam Cram™ 2 (Exam 70-320)
By Amit Kalani, Priti Kalani

Table of Contents
Chapter 13.  Practice Exam #1


Question 1

You have developed a .NET Remoting server that is used by employees in your organization to place vacation requests. The server makes available a Singleton SAO named VacationRequest. Clients send their employee IDs when they create the object and then later post it with their vacation requests. The server then records the information in a Jet database.

You discover that at peak times, vacation requests are being mixed. For example, the vacation request from employee ID 3235 is being saved as a request from employee ID 4238. What can you do to fix this issue?

  • A. Switch from using a Singleton SAO to using a CAO.

  • B. Switch from using a Singleton SAO to using a SingleCall SAO.

  • C. Switch the database from Jet to SQL Server.

  • D. Issue a confirmation number with each call to the object that the employee can later refer to.

Question 2

You are building a .NET Remoting server that exposes the Employee type as a server-activated object. The Employee type is defined as follows:

 public class Employee : MarshalByRefObject {     private string EmployeeName;     private DateTime m_HireDate;     public DateTime HireDate     {         get {             return m_HireDate;         }         set {             m_HireDate = value;         }     }     private double m_Salary;     public double Salary(){         return m_Salary;     }     public static string DepartmentName; } 

Which members of Employee will not be available remotely? (Select all that apply.)

  • A. EmployeeName

  • B. HireDate

  • C. Salary

  • D. DepartmentName

Question 3

You are developing a distributed application using the .NET Remoting infrastructure. The application exposes the Order object as a remote object to its client applications. The Order object consists of order details and an array of Product objects. The Product object consists of four fields: ProductID, Price, Qty, and QtyOnStock. The QtyOnStock field is not used by the client applications. You are expecting that a large number of Product objects will be created by the application. You want to write minimum code and make the network traffic as minimized as possible. What should you do? (Select two.)

  • A. Mark the ProductID, Price, and Qty fields of the Product class with the Serializable attribute.

  • B. Mark the QtyOnStock field with the NonSerialized attribute.

  • C. Mark the Product class with the Serializable attribute.

  • D. Make the Product class implement the ISerializable interface.

Question 4

You want to host a remotable class via the .NET Remoting framework so that remote clients can instantiate the class and invoke methods on it. The system standards require you to use Integrated Windows authentication to authenticate users of the object. You want a solution that minimizes additional coding requirements. Which of the following techniques should you use to host the remotable class?

  • A. Use Internet Information Services (IIS) as a Remoting host.

  • B. Use a console application as a Remoting host.

  • C. Create a Windows service and use that to host the remotable class.

  • D. Use a Web Service application to host the remotable class.

Question 5

You are developing a distributed application that allows client programs to instantiate a class named Transaction. You want the remote object to be created on the server so that it can access the corporate financial information, which is stored on an intranet. Which of the following options should you implement to make the Transaction class accessible through .NET Remoting?

  • A. Mark the Transaction class with the Serializable attribute.

  • B. The Transaction class should inherit from the MarshalByRefObject class.

  • C. The Transaction class should implement the ISerializable interface.

  • D. The Transaction class should implement the IActivator interface.

Question 6

You have designed a remotable class that allows the user to retrieve the latest weather information for his or her region. You have stored the configuration settings in a configuration file:

 <system.runtime.remoting>   <application>      <service>         <wellknown mode="Singleton"           type="RemotingWeather.WeatherInfo, WeatherInfo"           objectUri="WeatherInfo.rem"         />     </service>   </application> </system.runtime.remoting> 

Which of the following methods should you use to load the configuration details from the configuration file?

  • A. Activator.GetObject()

  • B. Activator.CreateInstance()

  • C. Activator.CreateInstanceFrom()

  • D. RemotingConfiguration.Configure()

Question 7

You work for a large chemical-manufacturing company that has four production units across the country. Your team has the responsibility of designing a distributed application that allows different production units to share and update material safety information for various products. One of your co-workers is using the following code to create a remoting host to host a server-activated object and is getting an error. What should she do to resolve this error?

 01: using System.Runtime.Remoting; 02: using System.Runtime.Remoting.Channels; 03: using System.Runtime.Remoting.Channels.Tcp; 04: using       System.Runtime.Remoting.Channels.Http; 05: [STAThread] 06: static void Main(string[] args) 07: { 08:    TcpServerChannel tcpChannel =               new TcpServerChannel(7777); 09:    HttpServerChannel httpChannel =               new HttpServerChannel(8888); 10:    RemotingConfiguration.          RegisterWellKnownServiceType          (typeof(MsdsInfo), "MsdsInfo",          WellKnownObjectMode.Singleton); 11: } 
  • A. Remove the statement at Line 9.

  • B. Add the following statements just before Line 10:

     ChannelServices.RegisterChannel(tcpChannel); ChannelServices.RegisterChannel(httpChannel); 
  • C. In the statement at Line 8, replace TcpServerChannel with TcpChannel; similarly, in the statement in Line 9, replace HttpServerChannel with HttpChannel.

  • D. Use the same port numbers in the statements in Line 8 and Line 9.

Question 8

You have used the Web Services Discovery tool to retrieve information about a Web service named OrderTracker. Which file will contain the URL for any documentation of the OrderTracker Web service?

  • A. results.discomap

  • B. OrderTracker.disco

  • C. Reference.cs

  • D. OrderTracker.wsdl

Question 9

You have created a Web service that provides the BankAccount details. One of your client application calls the Web service proxy, which is generated with the wsdl.exe tool, to retrieve bank account information. This information takes some time to generate, and your application is unresponsive while you are waiting for the results. What can you do to fix this problem?

  • A. Install a faster link to the Internet.

  • B. Install more memory in the client computer.

  • C. Use asynchronous calls to invoke the Web service.

  • D. Use the new proxy generated automatically by adding a Web reference to the Web service.

  • E. Use the new proxy generated with the wsdl.exe tool using the /proxy option.

Question 10

You want to use a Web service that supplies credit card verification services from your application. You know the URL of the .asmx file published by the Web service. What step should you take first?

  • A. Run the Web Services Discovery tool.

  • B. Open the .asmx file in a Web browser.

  • C. Run the XML Schema Definition tool.

  • D. Copy the .asmx file to your client project.

Question 11

You are designing a Web service that will return roughly 300KB of database information to clients on your intranet. How should you declare the Web method?

  • A.

     [WebMethod(BufferResponse=false)] public Object GetData() { ... } 
  • B.

     [WebMethod(CacheDuration=0)] public Object GetData() { ... } 
  • C.

     [WebMethod(CacheDuration=7200)] public Object GetData() { ... } 
  • D.

     [WebMethod(EnableSession=true)] public Object GetData() { ... } 
Question 12

You are developing a SOAP extension to run in a Web service client application. The SOAP extension includes a class named MyExtensionAttribute to flag methods to which the extension applies. The client project contains this code:

 private btnGetData_Click(System.Object sender,                          System.EventArgs e) {     // Call a Web method on the object     InvWebService.Inventory I = _new InvWebService.Inv();     objWarehouse.Inv = I.GetLatest(); } 

Where should you apply the MyExtensionAttribute attribute so that it interacts with the SOAP requests generated by this procedure?

  • A. To the btnGetData_Click() method

  • B. To the GetInitializer() method in your SOAP extension

  • C. To the GetLatest() method in the Web service proxy class

  • D. To the Load event of the form containing the button

Question 13

You have purchased a commercial SOAP extension for use with your Web service. This extension encrypts some attributes in the AfterSerialize event on the client and decrypts the attributes in the BeforeDeserialize event on the server. Now you want to add your own SOAP extension to track some statistics on the incoming XML data. This SOAP extension will need access to the decrypted attributes from the other SOAP extension. How should you implement the new SOAP extension?

  • A. Add the new SOAP extension in the BeforeDeserialize event with a higher priority than the existing SOAP extension.

  • B. Add the new SOAP extension in the BeforeDeserialize event with a lower priority than the existing SOAP extension.

  • C. Add the new SOAP extension in the AfterDeserialize event with a higher priority than the existing SOAP extension.

  • D. Add the new SOAP extension in the AfterDeserialize event with a lower priority than the existing SOAP extension.

Question 14

You need to develop a Windows 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. Set a Web Reference to point to the Web service.

Question 15

Your code is making asynchronous calls to two different Web methods. You want to execute other code until you arrive at a point where you require the results from the asynchronous calls. How should your code wait for the results of the asynchronous calls?

  • A. Use a pair of delegate callbacks, one for each Web method.

  • B. Use a WaitHandle.WaitAny() method call, specifying both Web methods.

  • C. Use a WaitHandle.WaitAll() method call, specifying both Web methods.

  • D. Use two WaitHandle.WaitOne() method calls, one for each Web method.

Question 16

You are developing a serviced component that manages book sales. Whenever a sale is made, the ProcessSale() method of the serviced component is called. The ProcessSale() method calls the ValidateCreditCard() Web method to validate the credit card number entered by the user of the CreditCard Web service and then records the sales in the database by calling the RecordSales Web method from the Sales Web service. After calling this Web method, the ProcessSale() method then records the shipping instructions and sales detail in the Shipping database. The code of the ProcessSale() method is defined as follows:

 namespace MyCompany {    public interface IBooks    {      void ProcessSale(Books[] o);    }   [Transaction(TransactionOption.Required)]    public class Books :                 ServicedComponent,                 IBooks    {       [AutoComplete]       public void ProcessSale(Books[] o)       {         CreditCard cc = new CreditCard();         If (cc.ValidateCreditCard())         {             Sales sa = new Sales();             sa.RecordSales();         }         // Record the shipping instructions and sales         // detail in the Shipping database       }    } } 

The ValidateCreditCard() and RecordSales() Web methods have their TransactionOption property set to Required and RequiresNew, respectively. When the serviced component method is executed, the method throws an exception when it tries to save the shipping instructions in the Shipping database. What would be the state of the transactions?

  • A. All the transactions are rolled back.

  • B. Only transactions in RecordSales() are committed. The transactions in ValidateCreditCard() and ProcessSale() methods are rolled back.

  • C. Transactions in the ValidateCreditCard() and RecordSales() Web methods are committed. The transaction in the ProcessSale() method is rolled back.

  • D. Only transactions in ValidateCreditCard() are committed. The transactions in RecordSales() and ProcessSale() methods are rolled back.

Question 17

You have created a Windows service that monitors e-mail messages on your company's mail server. The service will execute on the mail server, which is a Windows 2000 Advanced server machine. To perform its work, the Windows service needs administrative access to the computer. Which security context should you use as the startup account for the service?

  • A. LocalSystem

  • B. LocalService

  • C. NetworkService

  • D. User

Question 18

You have built a Windows Service application that will monitor network activity on a specified TCP/IP port. You intend to allow the user to specify the port as a parameter from the Services MMC snap-in. Where should you process the user's selection?

  • A. In the Main() method of the service

  • B. In the OnStart() method of the service

  • C. In the Run() method of the service

  • D. In the OnContinue() method of the service

Question 19

You are part of a team that is developing a Windows service application to monitor a legacy application for new data. Occasionally, your application might encounter errors. You want to develop an error-reporting mechanism that is easy to use for administrators who will monitor and maintain the application on a day-to-day basis. You also want a scheme that is robust and requires a minimal amount of code. Which of the following techniques should you choose?

  • A. Use the event log

  • B. Use SQL Server tables

  • C. Use XML-based log files

  • D. Use Plain-text log files

Question 20

You are building a class for a component that will be registered with COM+. You have defined the interface for the serviced component:

 public interface IPhysicians {     DataSet Patients(string PhysicianID); } 

You want to register the component only with the IPhysicians interface defined in the previous code snippet. How should you define the serviced component class?

  • A.

     public class Physicians : ServicedComponent, IPhysicians { } 
  • B.

     [ClassInterface(ClassInterfaceType.AutoDispatch)] public class Physicians : ServicedComponent, IPhysicians { } 
  • C.

     [ClassInterface(ClassInterfaceType.AutoDual)] public class Physicians : ServicedComponent, IPhysicians { } 
  • D.

     [ClassInterface(ClassInterfaceType.None)] public class Physicians : ServicedComponent, IPhysicians { } 
Question 21

You have created a component that uses the COM+ object-pooling service via the classes of the System.EnterpriseServices namespace. You have installed the component on the production server. You would like to monitor the usage pattern for the component to determine the optimum size for the object pool. How should you do this?

  • A. Activate component events and statistics within the Component Services administrative tool.

  • B. Add code to the class to write messages to the event log whenever an instance of the class is created or destroyed.

  • C. Add code to the class to maintain a custom performance monitor with object pool statistics.

  • D. Use a performance monitor to track the committed RAM on the server to deduce the number of instances of the object created.

Question 22

You have been given an assignment to develop the order-processing application for your organization. The application needs to support a large number of users and should perform well during the peak time for receiving and processing orders. Which of the following COM+ services would you use in your application? (Select all that apply.)

  • A. Queued components

  • B. Automatic transactions

  • C. Object pooling

  • D. Just-in-time activation

Question 23

You are creating a serviced component named DataConnector. After the component is deployed, the system administrators should be able to configure the component to connect to various data sources by specifying the connection string of the data source. The serviced component will be used by both COM and .NET applications. You want to retrieve the specified connection string in your component and change the behavior of the serviced component. Which of the following techniques should you use to achieve this?

  • A. Override the Activate() method of the serviced component.

  • B. Override the Construct() method of the serviced component.

  • C. Create a method for the serviced component that receives a connection string as its parameter. Add the method definition in the component's interface.

  • D. Create a constructor for the serviced component that receives a connection string as its parameter.

Question 24

You are creating a serviced component named Shipping that includes the following code segment:

 [Transaction(Isolation=TransactionIsolationLevel.Any,              Value=TransactionOption.RequiresNew)] public class Shipping : ServicedComponent {        //detailed class declaration } 

You want the component to lock the data in such a way that no dirty reads are possible, which means that the same read operation should not retrieve different values for different users. While the data is locked, other users should be able to insert a new row but should not be able to update an existing row. How should you modify your code?

  • A. Change the Isolation property of the Transaction attribute to IsolationLevel.ReadCommitted.

  • B. Change the Isolation property of the Transaction attribute to IsolationLevel.ReadUncommitted.

  • C. Change the Isolation property of the Transaction attribute to IsolationLevel.RepeatableRead.

  • D. Change the Isolation property of the Transaction attribute to IsolationLevel.Serializable.

Question 25

You are responsible for maintaining a COM component that is used by numerous applications throughout your company. You are not yet ready to convert this COM component to .NET managed code, but you need to make it available to an increasing number of other projects that are 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. 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. 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. Include this project in each solution that must make use of the component.

Question 26

In which of these situations should you use tlbimp, the Type Library Importer tool? (Select two.)

  • A. When you must call a COM component that you wrote from Visual C# .NET code.

  • B. When you must produce a strong-named assembly that calls methods from one of your company's COM components.

  • C. When you require objects from Microsoft Word in your .NET application.

  • D. When you need to be able to call Windows API functions in kernel.dll from your .NET code.

Question 27

You use Visual C# .NET to create an assembly named Processor.dll. The Processor.dll assembly contains several complex graphics-manipulation classes and is used by several applications managed as well as unmanaged. The COM applications are already compiled and use late binding to invoke methods from the assembly. What actions should you take to ensure that the assembly is properly deployed on the target machine? (Select all that apply.)

  • A. Create a strong name for the assembly by using the Strong Name tool (sn.exe).

  • B. Register the assembly using the Assembly Registration tool (regasm.exe).

  • C. Create a type library for the application using the Type Library Exporter tool (tlbexp.exe).

  • D. Import the COM type library definition into an assembly by using the Type Library Importer tool (tlbimp.exe).

  • E. Deploy the assembly to the Global Assembly Cache (GAC).

  • F. Deploy the assembly to the Windows system directory.

Question 28

In your .NET application, you use 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 would like to bind only selected columns from the Customers table to a DataGrid control. You want a solution that requires minimum programming, and you want to have 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. Bind the second DataTable object to the DataGrid control.

  • B. Create a Command object to retrieve the desired columns from the DataTable object. 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. Bind the DataGrid control to the DataView object.

Question 29

You have recently deployed an expense-reporting system in your company. 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 noted that another application, which uses the same SQL Server database, is having good performance. Which of the following steps will 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 in the connection string.

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

Question 30

You are developing a .NET application named VerifyOrders. The VerifyOrders application receives data from the Orders application in XML format. The VerifyOrders application enables its users to review the orders and make any changes, if required. When the users are done 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 of the following options will 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 XmlWriteMode parameter to IgnoreSchema.

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

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

Question 31

You are writing a Visual C# .NET 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 enables 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 32

You are developing a .NET application that processes data from a SQL Server database. The application reads the data from the database in a forward-only way and does not perform any update operation. You use the System.Data.SqlClient.SqlConnection object to connect to the SQL Server database. You 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.

 SqlDataReader dr = cmd.ExecuteReader(); String s; while(dr.Read()) {     s = s + dr.GetValue(0); } 

What can you do to optimize the application? (Select two answers.)

  • 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 foreach loop.

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

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

Question 33

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 instead of the SqlDataReader object to retrieve information.

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

Question 34

You are working with this XML file:

 <?xml version="1.0" encoding="UTF-8"?> <Orders>   <Order OrderNumber="142">     <Part PartNumber="12"/>     <Part PartNumber="14"/>     <Part PartNumber="22"/>   </Order>   <Order OrderNumber="143">     <Part PartNumber="22"/>     <Part PartNumber="18"/>   </Order> </Orders> 

Which XPath expressions can you use to return the second <Part> element from the first <Order> element? (Select two.)

  • A. /Orders/Order[1]/Part[2]

  • B. /Orders/Order[0]/Part[1]

  • C. (/Orders/Order/Part)[2]

  • D. (/Orders/Order/Part)[1]

Question 35

You use Visual C# .NET to develop an application that will be used by the customer service department. Your application receives data from the Orders application. Users of your application get calls from the customers to make changes to their orders. You write the code that allows them to make the 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 36

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

  • A.

    [View full width]

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

    [View full width]

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

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

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

You need to develop a database application that interacts with the Jet database. You need to write code to return the total number of customers from the database. You need to create the fastest solution. Which of the following actions should you take?

  • 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 38

You are developing a .NET application that retrieves data from a SQL Server database to perform analysis of sales history. A large number of users will use your application. The size of the sales history data is huge, and your application needs to retrieve this data at a very fast speed. Which of the following techniques would you use to get the maximum performance when retrieving data from the SQL Server database in your Visual C# .NET application?

  • A. Use the classes from the System.Data.OleDb namespace.

  • B. Use the classes from the System.Data.SqlClient namespace.

  • C. Use XML Web services to connect with the SQL Server database.

  • D. Use COM components to retrieve the data from SQL Server database.

Question 39

Your OrderManager application allows users to enter new orders and make changes to the existing orders. The application involves a DataTable named OrdersTable. The column OrderNumber defines a primary key for the OrdersTable table. Which of the following segments of code should you use to define a primary key for the OrdersTable in your Visual C# .NET program?

  • A.

     DataColumn[] c = new DataColumn[1]; c[0] = OrdersTable.Columns["OrderNumber"]; OrdersTable.PrimaryKey = c; 
  • B.

     OrdersTable.PrimaryKey = "OrderNumber"; 
  • C.

     OrdersTable.PrimaryKey.Add(OrdersTable.Columns["OrderNumber"]); 
  • D.

     OrdersTable.PrimaryKey = OrdersTable.Columns["OrderNumber"]; 
Question 40

You are attempting to retrieve all orders placed on July 19, 1996, from a SQL Server database. You have written the following SQL statement:

 SELECT * FROM Orders WHERE OrderDate = 7/19/1996 

The statement executes without error but does not return any rows. You are certain that the database contains orders from the date. How should you correct the SQL statement?

  • A.

     SELECT * FROM Orders WHERE OrderDate = #7/19/1996.htm# 
  • B.

     SELECT * FROM Orders WHERE OrderDate = July 19, 1996 
  • C.

     SELECT * FROM Orders WHERE OrderDate = '7/19/1996' 
  • D.

     SELECT * FROM Orders WHERE OrderDate = "7/19/1996" 
Question 41

Your Visual C# .NET application reads an XML file from disk into an XmlDocument object, and then it modifies some of the nodes in the document. You need to write minimal code. Which object should you use to write the modified XmlDocument object back to disk?

  • A. XmlTextWriter

  • B. FileStream

  • C. StreamWriter

  • D. BinaryWriter

  • E. TextWriter

Question 42

You are developing a .NET application for the purchasing department of your company. The department needs to view, add, edit, and delete the supplier information that is stored in a SQL Server database. You must make sure that when the user updates a supplier record, the information is successfully written to the database. Which of the following pairs of method calls should you choose to update the database?

  • A.

     DataTable.AcceptChanges(); SqlDataAdapter.Update(DataTable); 
  • B.

     SqlDataAdapter.Update(DataTable); DataTable.AcceptChanges(); 
  • C.

     DataTable.Reset(); SqlDataAdapter.Update(DataTable); 
  • D.

     SqlDataAdapter.Update(DataTable); DataTable.Reset(); 
Question 43

Your application needs to load the contents of an XML file into memory. You do not need rich navigation through the XML file; a single pass to locate the data of interest is sufficient for the application. You also want to minimize the usage of server resources. Which class should you use to implement this requirement?

  • A. XPathNavigator

  • B. XmlReader

  • C. XmlTextReader

  • D. XPathExpression

Question 44

You use a SqlDataAdapter object to fill a DataSet object with the contents of the Parts table in your database. The PartName of the first part is Windshield. You synchronize an XmlDataDocument object with the DataSet object. In the DataSet object, you change the PartName of the first part to Wipers. After that, in the XmlDataDocument object, you change the value of the corresponding node to Windshield Fluid. When you call the Update() method of the SqlDataAdapter object, what is the effect?

  • A. The PartName in the table remains Widget.

  • B. The PartName in the table is updated to Wipers.

  • C. The PartName in the table is updated to Windshield Fluid.

  • D. The CLR throws an exception because you try to update the PartName using the XmlDataDocument object.

Question 45

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

  • A. XPathNavigator

  • B. XslTransform

  • C. XmlSchema

  • D. XmlNode

Question 46

You are developing a contact-management application using Visual C# .NET. You use the methods of the Trace and Debug classes to log serious error messages encountered during program execution. You want to record all such errors in the Windows event log. You do not want any duplicate entries for error messages in the event log. In what two ways can you add a listener to the Windows event log? (Select two.)

  • 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 47

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

  • A. Set the <trace> element in the web.config configuration file of the application to this:

     <trace enabled="false" /> 
  • B. Set the <trace> element in the web.config configuration file of the application to this:

     <trace enabled="true" /> 
  • C. Set the <trace> element in the web.config configuration file of the application to this:

     <trace enabled="ShipmentStatus.aspx" /> 
  • D. Set the Trace attribute in the Page directive of the ShipmentStatus.aspx page to this:

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

     <%@ Page Trace="false" /> 
Question 48

You use Visual C# .NET to develop a component that allows developers to create bar graphs in their applications. You name the component BarGraph. 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.

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 create 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. ASP.NET is running under the SYSTEM account. What 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 have used Visual C# .NET to build a Windows service to implement a custom networking protocol. Which tool can you use to install the Windows service for testing your program?

  • A. xcopy

  • B. Services MMC snap-in

  • C. gacutil

  • D. installutil

Question 52

You develop a Visual Studio .NET application that helps the shipping department in creating mix-and-match pallets. Users of the application complain that the number of cases in the pallet is 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 53

You are debugging your ASP.NET Web application; you 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 54

You use Visual Studio .NET to create an ASP.NET Web application that interacts with a Microsoft SQL Server database. You create a stored procedure to calculate the monthly wireless Internet access charges for the customers. You name the stored procedure as CalculateAccessCharges. When you run the program, you observe that the results from the stored procedure are not as expected. You want to debug the CalculateAccessCharges stored procedure to find the error. You 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 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 55

You have developed a remoting component that helps manage production schedules for a manufacturing company. The component is packaged as Production.dll. One of your applications uses this component, and you anticipate that in the future, some other applications might use classes from the Production.dll library. You might 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 56

You are a programmer for a popular gaming software-publishing company. The company 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 will you use for these components before packaging it 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 your components.

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

Question 57

You use Visual C# .NET to develop a remoting component called MortgageInterest that is packaged in MortgageInterest.dll version 1.0.0.0. MortgageInterest.dll is deployed into the GAC of the production server. After two months, you discover a bug in the assembly. You fix the bug by releasing a new version, 1.0.1.0, of the assembly. You place the newly created assembly in the GAC. What will happen to the applications that use MortgageInterest.dll?

  • A. The applications using the MortgageInterest.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 MortgageInterest.dll assembly will notice a new version of the assembly and will load the new version of the assembly with no problems.

  • C. The applications using the MortgageInterest.dll assembly will not bother about 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 MortgageInterest.dll assembly will be requested to select the desired assembly version to run for their application.

Question 58

You would like 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 need to be placed. You want to write minimum 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 that the user 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 59

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 60

You have developed an intranet ASP.NET application for your company that uses Microsoft Windows authentication to authenticate the users of the application. When the employee is authenticated, he or she can access all the Web pages of the intranet application. However, your application contains an Accounting directory that contains details of the salaries and pay checks of the employees. 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 61

You create a serviced component named Books that is activated as a server application. This component is stored in the Books.dll assembly and is registered in the COM+ catalog. You need to debug the GetBooksList() method of the serviced component. What should you do?

  • A. Open the Books solution. Set a breakpoint on the GetBooksList() method. Start the debugger.

  • B. Open the solution for the client program. Set a breakpoint on the statement that calls the Books.GetBooksList() method. Start debugging the client program.

  • C. Attach the debugger to the Books.dll process. Set a breakpoint on the GetBooksList() method.

  • D. Attach the debugger to the dllhost.exe process. Set a breakpoint on the GetBooksList() method.

Question 62

Your application contains this code:

 EventLog el = new EventLog(); el.Source = "MyLog"; el.WriteEntry("MyLog", "Message", EventLogEntryType.Error); 

You have not called EventLog.CreateEventSource("MyLog") anywhere in your application, and the MyLog event log does not already exist. What happens when you execute this code?

  • A. A runtime error occurs.

  • B. The message is written to the MyLog event log.

  • C. The message is displayed in a message box.

  • D. The message is written to the application event log.

Question 63

You develop a Windows-based application using Visual C# .NET. Your code would like File I/O permission but can run without this permission. You plan to request the permission and trap the error if it is not granted. Which SecurityAction action should you use with the FileIOPermission object?

  • A. SecurityAction.RequestMinimum

  • B. SecurityAction.Demand

  • C. SecurityAction.RequestOptional

  • D. SecurityAction.RequestRefuse

Question 64

Which of these tasks requires you to use imperative security rather than declarative security?

  • A. Refusing dangerous permissions such as Registry permission

  • B. Ensuring that your application has access to an environment variable whose name is not known until runtime

  • C. Ensuring that your application has access to a specific file whose name is known at design time

  • D. Ensuring that your application has access to a Jet database as a specific user.

Question 65

You have developed a remoting assembly named RemoteServices that is a member of code groups as follows:

  • At the enterprise level, the RemoteServices assembly is a member of the All Code group that has the FullTrust permission set.

  • At the machine level, the RemoteServices assembly is a member of the All Code group and the Sensitive code group. The All Code group has the LocalIntranet permission set, and the Sensitive code group has the Nothing permission set.

  • At the user level, the RemoteServices assembly is a member of the Internet code group, which has the Internet permission set.

What permission set will the CLR assign to the RemoteServices assembly?

  • A. Nothing

  • B. Internet

  • C. LocalIntranet

  • D. FullTrust


    Team-Fly    
    Top


    MCAD Developing XML Web Services and Server Components with Visual C#. NET and the. NET Framework Exam Cram 2 (Exam Cram 70-320)
    Managing Globally with Information Technology
    ISBN: 789728974
    EAN: 2147483647
    Year: 2002
    Pages: 179

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net