1. XYZ Inc. buys and
sells used refrigerators. External vendors
frequently send you XML documents that list one type
of used appliances for sale. The documents that you
receive contain either only washers or only
refrigerators as in the following example.
All incoming XML documents are loaded into a
MemorySystem object named usedList.
You need to automate a process that will discover
XML documents contain refrigerator elements. As soon
as you ascertain that a document contains
refrigerators, you can stop processing the document.
You decide to use Visual studio .NET to develop an
application that will contain a Boolean variable
named hasRefrigerator. A value of True for this
variable means that a document contains refrigerator
elements. A value of false means that it does not.
You want to ensure that the discovery process occurs
as quickly as possible.
What should you do?
-
Create an
XmlDocument object and load it from usedList.
Use the SelectSingleNode method to search the
XmlDocument object for the saleList/refrigerators
node.
If this node is found, set hasRefrigerator to
True.
Otherwise, set hasRefrigerator to False.
-
Create an
XmlXPathDocument object and load it from
usedList.
Use an XPathNavigator object to search the
XmlXPathDocument for the saleList/refrigerators
node.
If this node is found, set hasRefrigerator to
True.
Otherwise, set hasRefrigerator to False.
-
Create an
XmlTextReader object on usedList.
Loop through usedList by using the MoveToContent
method of the XmlTextReader object and
comparing for the saleList/refrigerators node.
If this node is found, set hasRefrigerator to
True.
Otherwise, set hasRefrigerator to False.
-
Create a DataSet
object and use its ReadXml method to load
usedList into the object.
If the Count property of the Rows collection of
the refrigerators entry in the object is not
equal to
zero, set hasRefrigerator to True.
Otherwise, set hasRefrigerator to False.
Answer: A
2. You create an XML
web service that retrieves data from Microsoft SQL
Server database. You instantiate a SqlConnection
object named ABConnection and set the Max Pool Size
property of the connectionString to 50. All 50
connections are now in use. However, a request for
connection number 51 is received. What is the most
likely result?
-
An exception is
immediately thrown.
-
The current
connection pool is expanded by 50 additional
connections.
-
A new connection
pool is created that has the same maximum number
of connections.
-
The request is
queued until a connection becomes available or
until the timeout limit is reached.
Answer: D
3. You have a
strongly types DataSet object named XYZDataSet. This
object contains three DataTable objects named
Customers, Orders and OrderDetails.
Customers and Orders have a data column named
CustomerID. Orders and OrderDetails have a data
column named OrderID. Orders have a foreign key
constraint between Customers and Orders on
CustomerID. OrderDetails has a foreign key
constraint between Orders and OrderDetails on
OrderID.
You want to populate Customers, Orders and
OrderDetails with data from Microsoft SQL Server
database.
In which order should you fill the Data table
objects?
-
Customers
OrderDetails
Orders
-
OrderDetails
Orders
Customers
-
Customers
Orders
OrderDetails
-
Orders
OrderDetails
Customers
Answer: C
4. Your Microsoft
SQL Server 6.5 database contains a table named
XYZPurchases that consists of more than 1 million
rows. You are developing an application to populate
a DataReader object with data from XYZPurchases. You
want to ensure that the application processes the
data as quickly as possible. You create a SQL SELECT
statement in a local variable named tkSQLSelect. You
need to initiate a SqlConnection object and a
SqlCommand object you will use to populate the
DataReader object. Which code segment should you
use?
-
Dim myConnection As
New OleDbConnection _
(myOleDbConnectionString)
Dim tkCommand As New OleDbCommand _
(tkSQLSelect)
-
Dim myConnection As
New OleDbConnection _
(myOleDbConnectionString)
Dim tkCommand As New OleDbCommand _
(tkSQLSelect, myConnection)
-
Dim myConnection As
New SqlConnection _
(mySqlConnectionString)
Dim tkCommand As New SqlCommand _
tkSQLSelect)
-
Dim myConnection As
New SqlConnection _
(mySqlConnectionString)
Dim tkCommand As New SqlCommand _
(tkSQLSelect, myConnection)
Answer: B
5. Your Microsoft
SQL Server database has a stored procedure named
XYZCustomer. XYZCustomer accepts one parameter named
@CustomerID and returns the appropriate company
name.
You initiate a SqlCommand object named myCommand.
You need to initialize myCommand to return the
company name for @CustomerID with a value of 'ALFKI'.
Which code segment should you use?
-
myCommand.CommandText = 'XYZCustomer, ALFKI'
myCommand.Parameters.Add ('@CustomerID')
-
myCommand.CommandText = 'XYZCustomer'
myCommand.Parameters.Add ('XYZCustomer', 'ALFKI')
-
myCommand.CommandText = '@CustomerID'
myCommand.Parameters.Add ('XYZCustomer', 'ALFKI')
-
myCommand.CommandText = 'XYZCustomer'
myCommand.Parameters.Add ('@CustomerID', 'ALFKI')
Answer: D
6. You have a
DataSet object named myDataSet. This object contains
two DataTable objects named Customers and Orders.
Customers has a column named CustomerID, which is
unique to each customer.
Orders also has a column named CustomerID. You want
to use the GetChildRows method of the DataRow object
to get all orders for the current customers. What
should you do?
-
Add a foreign key
constraint on CustomerID of Orders between
Customers and Orders.
-
Add a data relation
to myDataSet on OrderID between Customers and
Orders.
-
Create a unique
constraint on CustomerID of Customers.
-
Create a primary
key on CustomerID of Customers.
Answer: B
7. You are
developing an application that queries a table named
Products in a Microsoft SQL Server database. The
query will be stored in a string variable named
ABQuery. The query includes the following SQL code.
SELECT * FROM Products For XML AUTO
You must iterate the query results and populate an
HTML table with product information.
You must ensure that your application processes the
results as quickly as possible.
What should you do?
-
Use a
SqlDataAdapter object and set its SelectCommand
property to ABQuery.
Use the Fill method of the SqlDataAdapter object
to read the data into a DataSet object.
Loop through the associated rows to read the
data.
-
Use a
SqlDataAdapter object and set its SelectCommand
property to ABQuery.
Use the Fill method of the SqlDataAdapter object
to read the data into a DataSet object.
Use the ReadXml method of the DataSet object to
read the data.
-
Set the SqlCommand
object's Command Text to ABQuery.
Use the ExecuteReader method of the SqlCommand
object to create a SqlDataReader object.
Use the Read method of the SqlDataReader object
to read the data.
-
Set the SqlCommand
object's Command Text to ABQuery.
Use the ExecuteXmlReader method of the
SqlCommand object to create a XmlReader object.
Use the XmlReader object to read the data.
Answer: D
8. You use a
function to maintain a table named Categories in a
Microsoft SQL Server database. The function creates
a DataTable object named Categories in a DataSet
object named categoriesDataSet.
These two objects capture all insertions, updates
and deletions to the Categories table. The function
instantiates a SqlDataAdapter object named
ABDataAdapter. This object is configured to select,
insert, update and delete rows in the Categories
DataTable object. You need to update the database to
include the changes in the Categories DataTable
object and capture all data errors in a batch after
all rows have been processed.
Which code segment should you use?
-
Try
ABDataAdapter.Update (CategoriesDataSet,
'Categories')
Catch mySqlException as SqlException
Dim myDataRow( ) As DataRow = _
CategoriesDataSet.Tables (0).GetErrors ( )
End Try
' Code to process errors goes here.
-
ABDataAdapter.ContinueUpdateOnError = True
Try
ABDataAdapter.Update (CategoriesDataSet,
'Categories')
Catch mySqlException as SqlException
Dim myDataRow( ) As DataRow = _
CategoriesDataSet.Tables (0) .GetErrors ( )
End Try
' Code to process errors goes here.
-
ABDataAdapter.Update (CategoriesDataSet,
'Categories')
If categoriesDataSet.Tables(0).HasErrors Then
Dim myDataRow ( ) As DataRow = _
CategoriesDataSet.Tables(0).GetErrors ( )
' Code to process errors goes here.
End If
-
ABDataAdapter.ContinueUpdateOnError = True
ABDataAdapter.Update (CategoriesDataSet,
'Categories')
If categoriesDataSet.Tables (0).HasErrors Then
Dim myDataRow ( ) As DataRow = _
CategoriesDataSet.Tables(0).GetErrors ( )
' Code to process errors goes here.
End If
Answer: D
9. Your company
frequently receives product information from
external vendors in the form of XML data. You
receive XML document files, an .xdr schema file, and
an .xsd schema file.
You need to write code that will create a typed
DataSet object on the basis of product information.
Your code will be used in several Visual studio .NET
applications to speed up data processing.
You need to create this code as quickly as possible.
What should you do?
-
Create the code
manually.
-
Use
XmlSerializer.Serialize to generate the code.
-
Use the
XmlSerializer.Deserialize to generate the code.
-
Use the Xml Schema
Definition tool (Xsd.exe) to generate the code.
Answer: D
10. You create a
DataSet object named XYZProductsDataset that
contains product information from a Microsoft SQL
Server database. This object has a primary key on a
column named ProductID.
You want to create a new DataSet object that has the
same structure as XYZProductsDataset, including the
primary key. You want the new DataSet object to be
empty of data.
Which code segment should you use?
A. Dim NewDataSet As
DataSet = XYZProductsDataset.Clone
B. Dim NewDataSet As
DataSet = XYZProductsDataset.Copy
C. Dim NewDataSet as
New DataSet ( )
newDataSet.Tables.Add ('XYZProductsDataset')
D. Dim newDataSet as
New Dataset ( )
newDataSet.Tables.Add (XYZProductsDataset.Tables
(0))
Answer: A
11. Your Microsoft
SQL Server database contains a table named XYZOrders.
Due to recent increase in product sale. XYZOrders
now contains more than 500,000 rows.
You need to develop an application to produce a
report of all orders in the table. You need to
ensure that the application processes the data as
quickly as possible. Which code segment should you
use?
-
Dim
myOleDbConnection As New OleDbConnection _
('Data Source=(local);'_
& 'Initial Catalog=XYZ;'_
& 'Integrated Security=true')
Dim myOleDbCommand As New OleDbCommand_
('SELECT * FROM XYZOrders' , myOleDbConnection)
Dim ordersData Reader As OleDbDataReader
MyOleDbconnection.Open()
OrdersDataReader = myOleDbcommand.ExecuteReader
-
Dim
myOleDbConnection As New OleDbConnection _
('provider=sqloleDb;Data Source=(local);'_
& 'Initial Catalog=XYZ;' _
& 'Integrated Security=true')
Dim myOleDbCommand As New OleDbCommand_
('SELECT * FROM XYZOrders' , myOleDbConnection)
Dim ordersData Reader As OleDbDataReader
myOleDbconnection.Open()
ordersDataReader = myOleDbCommand.ExecuteReader
-
Dim myConnection As
New SqlConnection _
('Data Source=(local);Initial Catalog=XYZ;'_
& 'Integrated Security=true')
Dim myCommand as new SqlCommand_
('SELECT * FROM XYZOrders' , myConnection)
Dim ordersData Reader As SqlDataReader
Myconnection.Open()
OrdersDataReader = mycommand.ExecuteReader
-
Dim myConnection As
New SqlConnection _
('Data Source=(local); 'Initial Catalog=XYZ;' _
& 'Integrated Security=true')
Dim myCommand as new SqlCommand('SELECT * FROM
XYZOrders')
Dim ordersData Reader As SqlDataReader
Myconnection.Open()
ordersDataReader = myCommand.ExecuteReader
Answer: C
12. You are
debugging a visual studio .Net application named
XYZApp. The application produces an Xml documents
object and then consumes the same object. This
object moves data in the application. The object has
no schema, but it contains a declaration line that
you must inspect. You decide to transform the XML
code and its declaration into a string for easy
inspection. What should you do?
-
Assign the ToString
method of the Xml Document object to a string
variable.
-
Assign the OuterXml
property of the Xml document object to a string
variable
-
Assign the OuterXml
property of the Xml document element property of
the Xml document object to a string variable.
-
Use the
WriteContentTo method of the XmlDocument object
to write the document into a MemoryStream
object. Use the GetXml method of the DataSet
object to get a string version of the document.
Answer: B
13. You are
developing a order-processing application that
retrieves data from a Microsoft SQL Server database
contains a table named Customers and a table named
Orders.
Customer has a primary key of customerID. Each row
in orders has a CustomerID that indicates which
customer placed the order.
Your application uses a DataSet object named
ordersDataSet to capture customer and order
information before it applied to the database. The
ordersDataSet object has two Data Table objects
named Customers and Orders.
You want to ensure that a row cannot exist in the
Orders Data Table object without a matching row
existing in the customers Data Table object.
Which two actions should you take? (Each correct
answer presents part of the solution. Choose two.)
-
Create a foreign
key constraint named ConstraintOrders that has
Orders.CustomersID as the parent column and
Customers. CustomerID as the child column.
-
Create a foreign
key constraint named ConstraintCustomers that
has Customers.CustomerID as the parent column
and Orders.CustomerID as the child column.
-
Create a unique
constraint named UniqueCustomers by using the
Customers.CustomerID
-
Add
ConstraintOrders to the Orders Data Table.
-
Add
ConstraintOrders to the Customer Data Table.
-
Add
ConstraintCustomers to the Orders Data Table.
-
Add
ConstraintCustomers to the Customers Data Table.
-
Add UniqueCustomers
to the Customers Data Table.
Answer: B, F
14. You have DataSet
object named LoanCustomersDataSet that contains
customers serviced by the loan department of XYZ
Inc.. You receive a second DataSet that contains
customers serviced by the asset management
department of XYZ Inc.. Both objects have the same
structure. You want to merge assetCustomersDataSet
into LoanCustomersDataSet and preserve the original
values
in loanCustomersDataSet. Which code segment should
you use?
-
loanCustomersDataSet.Merge (assetCustomersDataSet)
-
loanCustomersDataSet.Merge (assetCustomersDataSet,
True)
-
assetCustomersDataSet.Merge
(loanCustomersDataSet)
-
assetCustomersDataSet.Merge (loanCustomersDataSet,
True)
Answer: B
15. You are creating
an XML Web service that generates a SOAP message.
Parameter information in the SOAP message must be
encrypted. You write the appropriate code to modify
the SOAP message. You also write a method named
Encrypt. This method takes a string an argument,
encrypts the string, and returns a new string that
contains the
encrypted string. Before encryption , the Body
element of the SOAP message will be written in the
following format. some date After encryption, the
Body element must be written in the following
format.
154 37 146 194 17 92 32 139 28 42 184 202 164 18
You write code to isolate the XML node in an XmlNode
object named theNode.
You now need to write code to encrypt the parameter
information.
Which code segment should you use?
-
Dim encrypted as
String = Encrypt(theNode.InnerText)
theNode.OuterXml = encrypted
-
Dim encrypted as
String = Encrypt(theNode.InnerXml)
theNode.OuterXml = encrypted
-
Dim encrypted as
String = Encrypt(theNode.InnerXml)
theNode.InnerXml = encrypted
-
Dim encrypted as
String = Encrypt(theNode.OuterXml)
theNode.OuterXml = encrypted
-
Dim encrypted as
String = Encrypt(theNode.InnerText)
theNode.InnerText = encrypted
Answer: C
16. You create
version 1.0.0.0 of an assembly named ABAssembly. You
register the assembly into global assembly cache.
ABAssembly cosist of two .NET Remoting objects named
AB1 and AB2. These objects are configured in
the App.config file of ABAssembly as shown in the
following code segment:
objectUri='AB2.rem'
type='ABAssembly.AB2.rem'
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=28dckd8349lduj'/>
You create an application named MyApp that resides
on a different computer than ABAssembly.
MyApp references version 1.0.0.0 of ABAssembly.
MyApp contains code that activates instances of
AB1 and AB2 to use their services.
Due to change in business needs, you must update
ABAssembly. You create version 2.0.0.0 of ABAssembly.
Which is backward compatible, but you do not update
any information in the App.config file
of ABAssembly. You register version 2.0.0.0 of
ABAssembly in the global assembly cache. You then
rebuild MyApp.
Which version of the remote objects will MyApp
activate?
-
version 1.0.0.0 of
AB1; version 1.0.0.0 of AB2
-
version 1.0.0.0 of
AB1; version 2.0.0.0 of AB2
-
version 2.0.0.0 of
AB1; version 1.0.0.0 of AB2
-
version 2.0.0.0 of
AB1; version 2.0.0.0 of AB2
Answer: A
17. You are creating
Windows-based application named ABWinApp. To the
application, you add a Windows Form named MyForm and
a reference to a SingleCall .Net Remoting object
named TheirObject.
You need to ensure that MyForm creates an instance
of TheirObject to make the necessary remote object
calls.
Which code segment should you use?
-
RemotingConfiguration.RegisterActivatedClientType(
_
GetType(TheirObject) ,
'http://XYZServer/TheirAppPath/TheirObject.rem')
Dim theirObject As New TheirObject()
-
RemotingConfiguration.RegisterWellKnownClientType(
_
GetType(TheirObject) ,
'http://XYZServer/TheirAppPath/TheirObject.rem')
Dim theirObject As New TheirObject()
-
RemotingConfiguration.RegisterActivatedServiceType(
_
GetType(TheirObject) ,
Dim theirObject As New TheirObject()
-
RemotingConfiguration.RegisterWellKnownServiceType(
_
GetType(TheirObject) ,
'http://XYZServer/TheirAppPath/TheirObject.rem',
_
WellKnownObjectMode.Singleton)
Dim theirObject As New TheirObject()
Answer: B
18. You are
preparing to deploy an XML Web service named
XYZInventoryService. This service queries a
Microsoft SQL Server database and return information
to the caller.
You are using Visual Studio .Net to create a setup
project. You need to install XYZInventorySystem. You
also need to run a script to create the necessary
SQL Server database and tables to store the data. To
accomplish this, you need to configure the project
to have administrator rights to the SQL Server
database.
You add a custom dialog box to the project that
prompts the user for the administrator user name and
password that are used to connect to the SQL Server
database. You need to make the user name and
password available to a custom Installer class that
will execute the script.
What should you do?
-
Add a launch
condition that passes the user name and password
to the Install subroutine.
-
Add a merge module
to the project that captures the user name and
password. Use the merge module to access these
values in the Install subroutine.
-
Retrieve the user
name and password from the savedState object in
the install subroutine.
-
Create a custom
install action. Set the CustomActionData
property to the entered user name and password.
Then access these values in the Install
subroutine.
Answer: D
19. You have an
ASP.NET application named ABWebApp. This application
uses a private assembly named Employee to store and
retrieve employee data. Employee is located in the
bin directory of ABWebApp. You develop a new ASP
.NET application named ABWebApp2 that also needs to
use employee. You assign Employee a strong name, set
its version to 1.0.0.0, and install it in the global
assembly cache. You then create a publisher policy
assembly for version 1.0.0.0 and install it in the
global assembly cache. You complete ABWebApp2
against version 1.0.0.0. You do not recompile
ABWebApp. You then run ABWebApp.
What is the most likely result?
-
A
VersionNotFoundException is Thrown.
-
Employee is loaded
from the bin directory.
-
Version 1.0.0.0 of
Employee is loaded from the global assembly
cache.
-
Version 1.0.0.0 of
Employee is loaded by the publisher policy
assembly.
Answer: D
20. You are creating
an XML Web service that tracks employee information.
The service contains a Web method named
RetrieveXYZEmployees. The service also contains a
base class named Employee and
two classes named Manager and Engineer, which are
derived from Employee. RetrieveXYZEmployees takes a
roleID as input that specifies the type of employee
to retrieve, either Manager or Engineer.
RetrieveXYZEmployees returns an array type Employee
that contains all employees that are in the
specified role.
You want to ensure that Manager and Engineer object
types can be returned from RetrieveXYZEmployees.
What should you do?
-
Set the TypeName
property of the XmlType attribute to Employee
for both Manager and Engineer.
-
Apply two
XmlInclude attributes to RetrieveXYZEmployees,
one of type Manager and one of type Engineer.
-
Apply an XmlRoot
attribute to the Employee class
Apply an XmlAttribute attribute to the Manager
and Engineer classes.
-
Apply an XmlRoot
attribute to the Employee class
Apply an XmlElement attribute to the Manager and
Engineer classes.
Answer: B