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

You are developing a Windows-based application that requires the use of a calculation function named CalculateValue. This function includes 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. Your project directory contains a copy of UsefulFunctions.dll.While you are working in Debug mode, you attempt to run your application. However, a System.DllNotFoundException is thrown.You verify that you are using the correct function named. You also verify that the code in the DLL exposes CalculateValue. You have not modified the project assembly, and you have not modified machine-level security. You need to test your application immediately .What should you do?

发布时间:2021-12-25

A.Move UsefulFunctions.dll to your project's bin directory

B.Move UsefulFunctions.dll to your project's Debug directory

C.Immediately before the declaration of CalculateValue, add the following code segment:

D.Immediately before the call to CalculateValue, add the following code segment:Dim perm As New SecurityPermission(_SecurityPermissionFlag.UnmanagedCode)perm.Assert()

试卷相关题目

  • 1You create a serviced component named Yourltem that implements an interface named Interface Item. You want to ensure that calls to the serviced component through Interfaceltem are queued.What should you do?

    A.To Yourltem, add the following attribute: cinterfaceQueuing(true, Interface="lnterfaceltem")>

    B.To Yourltem, add the following attribute:〈Transaction(TransactionOption.Disabled,Isolation = TransactionlsolationLevel.Serializable)>

    C.To the Yourltem assembly, add the following attribute: 〈assembly:ApplicationQueuing(Enables=true, QueueListenerEnabled=true)>

    D.In the Yourltem implementation, override the Activate method from the Serviced Component class. In the Activate method, add the following code segment:Dim q As New Queue() q.Enqueue(Me)

    开始考试点击查看答案
  • 2You create a . NET Remo ting object named AdminService, which is hosted in Internet Information Services(IIS) . The object uses an HttpChannel and a BinaryFormatter. AdminService is in an assembly named Ad- minService.dll. The URL for AdminService is http://LocalHost/ AdminService/AS.rem.You write a test console application named Tester.exe to test the AdminService interface. Tester.exe includes the following code segment:Module Tester Sub Main ()Dim service As New AdminService ()'Code to exercise the service object.End Sub End ModuleYou write a configuration file for Tester.exe. The configuration file is named Tester.exe.config and includes the following code segment:Cconfiguration〉〈system•runtime.remoting>〈application〉<client><wellknown url="http://LocalHost/ AdminService/AS.rem" type="AdminService, AdminService"/></client> </application〉〈/system.runtime.remoting></configuration>You run Tester.exe. The application immediately throws a Sys- tem.NullReferenceException. The exception includes the following message: "Object reference not set to an instance of an object.,’You need to resolve this exception.What should you do?

    A.To the application element of theTester.exe.config file, add the following code segment:〈channel ref=,'http">〈formatter ref="binary,,/>

    B.Replace the use of the AdminService constructor in Tester.exe with the following code segment:Dim service As AdminService =CType(Activator.Createlnstance (GetType(AdminService)), AdminService)

    C.At the beginning of the Main method in Tester.exe, add the following line of code:RemotingConfiguration.Configure("Tester.exe.config")

    D.Rename the configuration file from Tester.ex

    E.config to Tester.config

    开始考试点击查看答案
  • 3You are creating an XML Web service named Tracker to track orders for your company. Tracker includes a Web method named OrderStatus for tracking the status of individual orders. You anticipate that many client applications will use the service.You want administrators of Tracker to be able to monitor the requests per second for OrderStatus.Which code segment should you use?

    A.Dim counter As New PerformanceCounter("Tracker_ "OrderStatus req/sec", False)

    B.PerformanceCounterCategory.Create("Tracker","category", "OrderStatus req/sec", "req/sec”)C . Dim counterData() As CounterCreationData =_{New CounterCreationData("OrderStatus req/sec","help", PerformanceCounterType.RateOfCountsPerSecond32)} Dim collection As New_CounterCreationDataCollection(counterData) PerformanceCounterCategory.Create("Tracker", _"Tracker performance counters", collection)D. Dim counterData() As CounterCreationData =_{New CounterCreationData("Int32", "second",_PerformanceCounterType.AverageTimer32)}Dim collection As New_CounterCreationDataCollection(counterData) PerformanceCounterCategory.Create("OrderStatus", _ "requests per second", collection)}

    开始考试点击查看答案
  • 4As a software developer at your company, you are creating an XML Web service named HousingService that exposed two Web methods name Search House and BuyHouses. Prior to deploying the service, you want to customize the default template that is displayed when a customer makes a request through the browser.You create a Web Form named HousingServiceDescription.aspx that is a customized version of the default template. You place the Web Form in the bin directory of the HousingService project.The Web Form needs to override the default template when a request is made. You need to ensure that customers who request HousingService though a browser view HousingServiceDescription.aspx.What should you do?

    A.Create a SOAP extension to redirect the user to HousingServiceDescription .aspx

    B.Set the Namespace property of the WebService attribute to the location of HousingServiceDescription.aspx

    C.In the Web.config file, enable tracing and the set TraceMode node to binHousingServiceDescription.aspx

    D.In the Web.config file, set the HRef property of the wsdlHelp- Generator node to binHousingServiceDescription.aspx

    开始考试点击查看答案
  • 5You are creating an XML Web service named InventoryService for a nationwide clothing retailer company. The service provides near real-time inventory information to individual store managers by using a virtual private network(VPN).InventoryService exposes a Web method named Retrievelnventory that returns inventory information to the caller. You configure Internet Information Services(IIS) and InventoryService to use Integrated Windows authentication.You need to write code in InventoryService to ensure that only members of the Manager group can access Retrievelnventory.

    A.To the 〈authorization〉 section of the We

    B.config file, add the following element:Callow roles="Manager" />B.To the 〈authorization〉 section of the Web.config file, add the following element:

    C.In Retrievelnventory, add the following code segment: If User.Identity.Name.Equals("Manager") Then'Code to retrieve inventory data goes here.End If

    D.In Retrievelnventory, add the following code segment: If User.Identity.AuthenticationTyp

    E.Equals("Manager”} Then1Code to retrieve inventory data goes here.End If

    开始考试点击查看答案
  • 6You are creating an XML Web service named myService. This service has a function named WriteMessage that writes messages to a flat file in the C:MyLogsmyServiceLog directory.You want to implement security for WriteMessage so that WriteMessage and all the code it calls can write messages only to the myServiceLog directory.Which code segment should you use?

    A.Dim filePermission As New FilelOPermission _(FilelOPermissionAccess.Write, "C:XmyServiceLog") filePermission.Demand()

    B.Dim filePermission As New FilelOPermission(FilelOPermissionAccess.Write, "C:XmyServiceLog") filePermission.Deny()

    C.Dim filePermission As New FilelOPermission _(FilelOPermissionAccess.Write, "C:XmyServiceLog") filePermission.PermitOnly()

    D.Dim filePermission As New FilelOPermission __(FilelOPermissionAccess.Write, "C:myServiceLog") filePermission.Assert()

    开始考试点击查看答案
  • 7You are developing an application that receives product information from external vendors in the form of XML documents. The information will be stored in a Microsoft SQL Server database.The application must validate all incoming XML dat

    A.It uses an XmlValidatingReader object to read each XML document. If any invalid sections of XML are encountered, the inconsistencies are listed in a single document.You must ensure that the validation process runs as quickly as possible. What should you do?A.Set the ValidationType property of the XmlValidatingReader object to Schema

    B.Set the CanResolveEntity property of the XmlValidatingReader object to True

    C.Create and register a ValidationEventHandler method

    D.Use a try/catch block to catch validation exceptions

    开始考试点击查看答案
  • 8You 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)

    开始考试点击查看答案
  • 9You 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

    开始考试点击查看答案
  • 10You 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)

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