位置:首页 > 题库频道 > 其它分类 > 计算机其它 > 微软MCAD 70-310 实战百题

You are developing an application that queries a table named Products in a Microsoft SQL Server database named Datal. The query will be stored in a string variable named sqlQuery. The query includes the following SQL code:SELECT * FROM Products FOR XML AUTOYou 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?

发布时间:2021-12-25

A.Use a SqlDataAdapter object and set its SelectComir:and property to sqlQuery. 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

B.Use a SqlDataAdapter object and set its SelectCommand property to sqlQuery. 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

C.Set the SqlCommand object's CommandText to sqlQuery. Use the ExecuteReader method of the SqlCommand object to create aSqlDataReader object. Use the Read method of the SqlDataReader object to read the data

D.Set the SqlCommand object's CommandText to sqlQuery. Use the ExecuteXmlReader method of the SqlCommand object to create an XmlReader object. Use the XmlReader object to read the data

试卷相关题目

  • 1You are developing a Windows-based application that requires the use of a calculation function named CalculateValue. This functionincludes the following signature:CalculateValue (int As Integer) As IntegerCalculateValue is located in an unmanaged DLL named UsefulFunc- tions.dll, and is not part of a COM interface. You need to be able to use CalculateValue in your application.Which action or actions should you take? (Choose all that apply)

    A.Use Regsvr32.exe to register UsefulFunctions.dll

    B.Use Visual Studio . NET to add a reference to UsefulFunc- tions.dll

    C.To your application, add the following code segment: using UsefulFunctions

    D.To your application, add the following code segment:Public Shared Function CalculateValue(x As Integer) As_Integer

    开始考试点击查看答案
  • 2You create an XML Web service named TimeService. Each time Time- Service is started, it checks for the existence of an event log named TimeServiceLog. If TimeServiceLog does not exist, TimeService creates it.You discover that when TimeService creates TimeServiceLog, it throws a System.Security.SecurityException. The exception includes the following message: "Requested registryaccess is not allowed". You need to resolve this problem.What should you do?

    A.Configure Inetinfo.exe to run as the local administrator user account

    B.Create an installer for TimeService, and create the new event log in the installer code

    C.Modify the Web.config file by adding an identity element to impersonate Che LOGON user specified by Internet Information Services (IIS)

    D.Modify the permissions of theHKEY_LOCAL_MACHINESYSTEMCurrentCont;rolSetServices'Eventlog registry key to give fullcontrol to the IUSR_computername user account

    开始考试点击查看答案
  • 3You create a serviced component named OrderProcessor. Order- Processor implements the IOrderlnit interface. The component and the interface contain the following code segments:<Guidr0B6ABB29-4 3D6-4 0a6-B5F2-83A4 57D0 62ACn)> cinterfaceType(ComlnterfaceType.InterfacelsDual)> Public Interface IOrderlnit 'IOrderlnit methods go here End InterfacePublic Class OrderProcessor Inherits ServicedComponent Implements IOrderlnit 'OrderProcessor methods go here.End ClassYou discover that every time you rebuild OrderProcessor, existing unmanaged client code fails. The HRESULT for the exception is 0x80040154. The exception includes the following message: "Class not registered." You need to resolve this problem.What should you do?

    A.Add a Guid attribute to the OrderProcessor class

    B.Add a Comlmport attribute to the IOrderlnit interface

    C.To the OrderProcessor class, add the following attribute:

    D.To the end of every method, add the following line of code: Marshal.ReleaseComObj ect(Me)

    开始考试点击查看答案
  • 4You are creating an XML Web service named Accountinglnformation for your company. AccountInformation exposed a Web method named Get- AccountBalance that returns the account balance as a string. You must limit access to GetAc count Bala nee to users who have credentials stored in your Microsoft SQL Server database.You need to design GetAccountBalance to receive encrypted user credentials by using two custom fields named Username and Password in the SOAP header. To accomplish this goal, you must write the code for GetAccountBalance.Which code segment should you use?

    A.Public Class AuthenticateUser Inherits SoapHeader Public Username As StringPublic Password As String End Class'In the accountInformation class add this code: Public authenticateUserHeader As AuthenticateUser Public Function GetAccountBalance () As String If (authenticateUserHeader Is "") Then Return "Please supply Credentials."Else'Code to authenticate the user and return 'the account balance goes here.End IfEnd Function

    B.Public Class AuthenticateUser Public Username As String Public Password As String End Class'In the accountInformation class add this code: Public authenticateUserHeader As AuthenticateUser Public Function GetAccountBalnce() as String If (authenticateUserHeader Is nn) Then Return "Please supply Credentials."Else'Code to authenticate the user and return 'the account balance goes here.End IfEnd Function

    C.Public Class AuthenticateUser Inherits SoapHeader Public Username As String Public Password As String End Class'In the accountlnformation class add this code: Public authenticateUserHeader As AuthenticateUser Public Function GetAccountBalance() As String If (authenticateUserHeader Is Then Return "Please supply credentials."Else'Code to authenticate the user and return 'the account balance goes here.End IfEnd Function

    D.Public Class AuthenticateUser Public Username As String Public Password As String End Class• In the accountlnformation class add this code: Public authenticateUserHeader As AuthenticateUser Public Function GetAccountBalnce() As String If (authenticateUserHeader I日Then Return "Please supply Credentials."Else'Code to authenticate the user and return 'the account balance goes her

    E.End If End Function

    开始考试点击查看答案
  • 5You develop a Windows-based application named WinApp that contains a Windows From named Forml. To WinApp, you add a Web reference to an XML Web service named Servicel.Servicel exposes two Web methods named Authenticate and RetrieveData Both methods have sessions enabled. Authenticate authenticates a caller. If the caller is authenticated, Authenticate generates a unique key, stores that key by using the Session object, and returns that key.RetrieveData expects a valid key that has been generated by Authenticate as input before it will return dat

    A.If the key matches the key in the current session, RetrieveData will return data to the customer.You write the following code segment in the Load event handler of Forml(Line numbers are included for reference only)1.Dim servicel As New localhost.Servicel ()2.Dim key As String3.Dim userData As DataSet4.'Insert new code.5.key = servicel.Authenticate(myUser, myPassword)6.userData = servicel.RetrieveData(key)7.dataGridl.DataSource = userDataYou run the application. When line 06 executes the Web service throws an exception, which indicates that the key is invalid. To ensure that the application runs without exceptions, you must insert additional code on line 04.Which code segment should you use?A.servicel.PreAuthenticate = True

    B.servicel.InitializeLifetimeService()C . servicel.CookieContainer = New _System.Net.CookieContainer ()D. Dim cookie As New System.Net.Cookie("Key", key)

    开始考试点击查看答案
  • 6Your company 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.<!——A document with refrigerators --><saleList><refrigerators>〈refrigerator type="freezer on bottom", price="210"/> </refrigerators〉</saleList><!-- A document with washers --><saleList><washers><washer type="front load" , price="145"/> <washer type="top load" , price="130"/> </washers></saleList>All incoming XML documents are loaded into a MemorySystem object named used List.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?

    A.Create an XtalDocument object and load it from used List. Use the SelectSingleNode method to search the XmlDocument object for the saleLisUrefrigerators node. If this node is found, aet hasRefrigerator to True. Otherwise, set hasRefrigerator to False

    B.Create an XmlXPathDocument object and load it from usedList. Use an XPatbNavigator object to search the XmlXPathDocument for the saleLisUrefrigerators node. If this node is found, set hasRefrigerator to True. Otherwise, set hasRefrigerator to False

    C.Create an XmlTextReader object on used List. Loop through usedlist by using the MoveToContent method of the XmlTextReader object and comparing for the sale list/refrigerators node. If this node is found, set hasRefrigerator to True. Otherwise, set hasRefrigerator to False

    D.Create a DataSet object and use its ReadXml method to load used list 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 Tru

    E.Otherwise, set hasRefrigerator to False

    开始考试点击查看答案
  • 7You have a SqlDataReader object named ordersDataReader. This object contains a column named OrderQuantity that has an integer value. This object also contains one row for each order received during the previous week.You need to write code that will process each row in orders Data Reader and pass OrderQuantity to a function named myFunction.Which code segment should you use?

    A.Dim weeklyOrderQuantity As Long = 0 While ordersDataReader.Read()Call myFunction(ordersDataReader("OrderQuantity")) End While

    B.Dim weeklyOrderQuantity As Long = 0 While ordersDataReader.NextResuit()Call myFunction(ordersDataReader("OrderQuantity")) End While

    C.Dim weeklyOrderQuantity As Long = 0 Dim orderCount As Integer = 0While orderCount < ordersDataReader.FieldCount Call myFunction(ordersDataReader("OrderQuantity")) orderCount += 1 ordersDataReader.Read()End While

    D.Dim weeklyOraerQuantity As Long = 0 Dim orderCount As Integer = 0While orderCount < ordersDataReader.FieldCount Call myFunction(ordersDataReader("OrderQuantity")> orderCount += 1 ordersDataReader.NextResult()End While

    开始考试点击查看答案
  • 8You are developing an application to monitor store inventory. When inventory falls below a specified level, the application auto-matically generates a purchase request. Suppliers have requested that you transmit purchase requests to them in an XML document. Suppliers will accept the XML document in any valid form, except they do not want the data set definition to be included in the XML f ile.You create a method named GeneraLePurchaseRequest. You write the code to populate a DataSet object named myDataSet with the purchase request dat

    A.You define a variable named fileName that contains the name and path of the output file.You need to create an XML file from the data in myDataSet by adding code to GeneratePurchaseRequest. You want to accomplish this task by writing the minimum amount of code.Which code segment should you use?A.myDataSet.WriteXML(fileName, XmlWriteMode•IgnoreSchema)

    B.myDataSet.WriteXML(fileName, XmlWriteMode.WriteSchema)

    C.myDataSet.WriteXMLSchema(filename)

    D.Dim myWriter As TextWriter = New StreamWriter(fileName) myDataSet.WriteXMLSchema(myWriter)

    开始考试点击查看答案
  • 9You are developing a order-processing application that retrieves data from a Microsoft SQL Server database named Datal that contains a table named Customers and a table named Orders.Customer has a primary key of customerID. Each row in orders has a CustomerlD 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)

    A.Create a foreign key constraint named constraintOrders that has Orders.CustomersID as the parent column and Customers. CustomerlD as the child column

    B.Create a foreign key constraint named ConstraintCustomers that has Customers.CustomerlD as the parent column and Orders.CustomerlD as the child column

    C.Create a unique constraint named uniqueCustomers by using theCustomers.CustomerlD

    D.Add ConstraintOrders tothe Orders Data Table

    E.Add ConstraintOrders tothe Customer Data Table

    G.Add ConstraintCustomers to the Customers Data Table

    H.Add UniqueCustomers to the Customers Data Table

    开始考试点击查看答案
  • 10You have a .NET Remoting object named ProductLoader. The Product- Loader class is a server-activated Singleton object.The ProductLoader class loads product data into a Microsoft SQL Server database. The Load method of the ProductLoader class is a time-consuming method to call.You are developing a client application that uses the ProductLoader class. You want to ensure that the client application can continue to respond to user input while the Load method of the ProductLoader class is called.What should you do?

    A.Use an AsyncDelegate instance to call the Load method

    B.Modify the ProductLoader class to be derived from IAsyncResult

    C.Configure the ProductLoader class to be a client-activated .NET Remoting object

    D.Configure the client application to have its own remoting channel that matches the server's channel and formatter

    开始考试点击查看答案
返回顶部