Microsoft 70-589 Real Exam Questions
Candidates for this exam use Microsoft Visual Studio to develop data-access portions of applications. Candidates should have a minimum of two to three years of experience developing Web, Windows, or distributed applications by using the Microsoft .NET Framework.
Questions that contain code will be presented in either VB or C#. Candidates can select one of these languages when they start the exam.
1: You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET. The application contains two entities named Customer and Order. The Customer entity has a navigable property named Orders. The Orders property returns a collection of Order entity instances. You write the following code segment.
ContosoEntities context = new ContosoEntities();
ObjectQuery<Customer> query;
You need to ensure that each time a Customer entity instance is queried the related Order entity instances are retrieved. Which code segment should you add?
A.query = context.Customer.Include("Orders");
B.query = context.CreateQuery<Customer>("Orders");
C.query = context.Customer;query.Select("Orders");
D.query = context.Customer;query.Parameters.Add(new ObjectParameter("Orders",""));
Correct Answers: A
2: You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET. The application connects to a Microsoft SQL Server 2005 database. The database contains two tables that are displayed in two different GridView controls. The tables are displayed by using two SqlConnection objects. You need to display the tables simultaneously by using a single SqlConnection object. What should you do?
A.Execute two SqlDataReader objects by using a single SqlCommand object.
B.Enable Multiple Active Result Sets (MARS) in the connection string of the application.
C.Create a bound connection by using the sp_getbindtoken and the sp_bindsession stored procedures.
D.Create an exception handler for the connection-busy exception that is thrown on using a single SqlConnection object.
Correct Answers: B
3: You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET. The application uses Microsoft OLE DB Provider as the data provider. You change the data provider to Microsoft SqlClient. The application throws errors while executing parameterized queries. You need to ensure that the application executes the parameterized queries. What should you do?
A.Change the parameter in the query from DBNull to Null.
B.Reorder the positional parameters in the application code.
C.Set the Unicode attribute in the connection string to True.
D.Change the positional parameters in the application code to named parameters.
Correct Answers: D
4: You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET. The application connects to a Microsoft SQL Server 2005 database. The application throws an exception when the SQL Connection object is used. You need to handle the exception. Which code segment should you use?
A.try{ if(null!=conn) conn.Close(); // code for the query}catch (Exception ex){ // handle exception}finally{ if(null==conn) conn.Open();}
B.try{ conn.Close(); // code for the query}catch (Exception ex){ // handle exception} finally{ if(null!=conn) conn.Open();}
C.try{ conn.Open(); // code for the query}catch (Exception ex){ // handle exception} finally{ if(null!=conn) conn.Close();}
D.try{ conn.Open(); // code for the query}catch (Exception ex){ // handle exception} finally{ if(null==conn) conn.Close();}
Correct Answers: C
5: You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET. The application connects to a Microsoft SQL Server 2005 database. The application uses an XML file that contains product data. A corresponding XSD file contains the schema of the XML file.
You need to ensure that the application performs the following tasks:
Loads the XML file in a typed DataSet
Validates the XML file against the schema provided in the XSD file
What should you do?
A.Use the xsd.exe tool along with the /loadxml parameter to create a typed DataSet object that contains the data from the XML file.
B.Use the xsd.exe tool along with the /dataset parameter to generate a typed DataSet object.Use the DataSet.ReadXml method to load the typed DataSet object.
C.Add the XSD file to the schema collections of the XmlReader object.Load the XML file in the XmlReader object.Iterate through the XML nodes of the XMLReader object to create a new typed DataRow for each node.
D.Load the XML file in an XmlDocument object.Call the XmlDocument.Validate method to validate the XML file against the schema.Iterate through the XML nodes of the XmlDocument object to create a new typed DataRow for each node.
Correct Answers: B
Correct Answers: B
6: You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET.
The application has a typed DataSet named DSOrders. The DSOrders DataSet has two DataTables as shown in the following sequence:
1. Orders
2. Customers
You write the following code segment.
DSOrders ds = new DSOrders();
IDataReader rd;
You need to expose the two DataTables as a DataReader stream. You also need to ensure that the Customers DataTable is the first DataTable in the stream. Which code segment should you add?
A.rd = ds.CreateDataReader(ds.Customers);
B.rd = ds.CreateDataReader(ds.Customers, ds.Orders);
C.ds.DefaultViewManager.CreateDataView(ds.Customers);rd = ds.CreateDataReader();
D.ds.Customers.Prefix = "0";ds.Orders.Prefix = "1";rd = ds.CreateDataReader();
Correct Answers: B
7: You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET. The application connects to a Microsoft SQL Server 2005 database.
You write the following code segment.
string queryString = "Select Name, Age from dbo.Table_1";
SqlCommand command = new SqlCommand(queryString,
(SqlConnection)connection));
You need to get the value that is contained in the first column of the first row of the result set returned by the query. Which code segment should you use?
A.var value = command.ExecuteScalar();string requiredValue = value.ToString();
B.var value = command.ExecuteNonQuery();string requiredValue = value.ToString();
C.var value = command.ExecuteReader(CommandBehavior.SingleRow);string requiredValue = value[0].ToString();
D.var value = command.ExecuteReader(CommandBehavior.SingleRow);string requiredValue = value[1].ToString();
Correct Answers: A
D.Add another query to ProductTableAdapter by using the ProductID field as a parameter, and then filter the records by using this parameter.
Correct Answers: D
8: You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET. The application connects to a Microsoft SQL Server 2005 database. The application uses a SqlConnection object that is active for the lifetime of a user session. You need to ensure that the application gracefully handles all the exceptions that cannot be recovered. Which task should your code perform?
A.Catch all the SqlException exceptions and examine the State property of each error. If the State property value is 0, gracefully exit the application.
B.Catch all the SqlException exceptions and examine the State property of each error. If the State property value is not 0, gracefully exit the application.
C.Catch all the SqlException exceptions and examine the Class property of each error. If the Class property value is greater than 16, gracefully exit the application.
D.Catch all the SqlException exceptions and examine the Source property of each error. If the Source property value is not .Net SqlClient Data Provider, gracefully exit the application.
Correct Answers: C
9: You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET. You need to define a class named Order that can participate within a transaction. What should you do?
A.Define the Order class to inherit from the System.Transactions.Enlistment class.
B.Define the Order class to inherit from the System.Transactions.SinglePhaseEnlistment class.
C.Define the Order class to implement the System.Transaction.ITransactionPromoter interface.
D.Define the Order class to implement the System.Transaction.IEnlistmentNotification interface.
Correct Answers: D
10: You create an application by using the Microsoft .NET Framework 3.5 and Microsoft Synchronization Services for Microsoft ADO.NET. The application uses a database that contains two tables named Orders and OrderDetails. A primary key to foreign key relationship exists between these two tables.
You write the following code segment.
SyncTable tableOrders = new SyncTable("Orders");
SyncTable tableOrderDetails = new SyncTable("OrderDetails");
SyncGroup orderGroup = new SyncGroup("Changes");
You need to ensure that the following requirements are met:
Updates are synchronized to both the tables.
Referential integrity is accounted for.
Which two code segments should you add? (Each correct answer presents part of the solution. Choose two.)
A.tableOrders.SyncGroup = orderGroup;
B.tableOrders.TableName = orderGroup.GroupName;
C.tableOrderDetails.SyncGroup = orderGroup;
D.tableOrderDetails.TableName = orderGroup.GroupName;
Correct Answers: A C
Download | Password: certificatexam.com