Exam Prep Questions

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 4.  .NET Remoting


Question 1

You are designing a companywide order-processing system. This application is hosted on a server in the company's headquarters in Redmond, Washington, and is accessed by 1,500 franchise locations throughout the world. The application specification mentions that the franchisees should be able to access the order-processing system even through firewalls. A large number of franchisees access the application over a slow connection, and your objective is to maximize the performance of the application. Which of the following combinations of channel and formatter would you choose in this scenario?

  • A. Use a TCP channel with a binary formatter.

  • B. Use a TCP channel with a SOAP formatter.

  • C. Use an HTTP channel with a binary formatter.

  • D. Use an HTTP channel with a SOAP formatter.

A1:

Answer C is correct. Firewalls generally allow HTTP messages to pass through, and the binary formatter provides a size-optimized format for encoding data. Answers A and B are incorrect because using a TCP channel might require administrators to open additional ports in the firewall. Answer D is incorrect because the SOAP format is verbose when compared to binary and would take additional bandwidth, which is not a desirable solution for clients using slow connections.

Question 2

You are designing a distributed application for a large automotive company. The application allows the parts suppliers across the globe to collect the latest design specifications for a part. The application is heavily accessed by the suppliers. For greater scalability, you are required to design the application so that it can be deployed in a load-balanced environment. How should you host the remotable object in this scenario?

  • A. As a server-activated object in SingleCall activation mode

  • B. As a server-activated object in Singleton activation mode

  • C. As a client-activated object using the HTTP channel

  • D. As a client-activated object using the SOAP formatter

A2:

Answer A is correct. You should host the remotable object in SingleCall activation mode. Answers B, C, and D are incorrect because only server-activated objects in SingleCall activation mode support load balancing because they do not maintain state across the method calls.

Question 3

You have designed a remotable class named ProductDesign. You now want to register this class with the remoting system in such a way that client programs can remotely instantiate objects of this class and invoke methods on it. You want to have only one instance of this class on the server, no matter how many clients connect to it. Which of the following code segments fulfills your requirement?

  • A.

     RemotingConfiguration.RegisterWellKnownServiceType(     typeof(ProductDesign), "ProductDesign",     WellKnownObjectMode.SingleCall); 
  • B.

     RemotingConfiguration.RegisterWellKnownServiceType(     typeof(ProductDesign), "ProductDesign",     WellKnownObjectMode.Singleton); 
  • C.

     RemotingConfiguration.RegisterActivatedServiceType(     typeof(ProductDesign), "ProductDesign"); 
  • D.

     RemotingConfiguration.RegisterWellKnownClientType(     typeof(ProductDesign), "ProductDesign"); 
A3:

Answer B is correct. When you want to create just one instance of a remote object, without regard to the number of clients, you must create a server-activated object in Singleton activation mode. Answer A is incorrect because SingleCall activation mode creates an instance of the server object on each call. Answer C is incorrect because the RegisterActivatedServiceType() method registers the object as a CAO. This creates as many connections as the number of clients that connect to the server. Answer D is incorrect because the RegisterWellKnownClientType() method just registers an object on the client end; whether one or more objects will be created on the server depends on the activation mode specified when the object was registered with the server.

Question 4

You have designed a remotable class that allows users to retrieve the latest weather information for their region. You do not want to write a lot of code to create a custom remoting host, so you decide to use IIS to host the application. The name of the remotable class is RemotingWeather.WeatherInfo, and it is stored in an assembly named WeatherInfo.dll. You want the users to access this remotable class by using the URL http://RemoteWeather.com/users/WeatherInfo.rem. Which of the following remoting configurations would you place in the web.config file so that client applications can correctly retrieve weather information?

  • A.

     <system.runtime.remoting>    <application>        <service>            <activated type= "RemotingWeather.WeatherInfo,             WeatherInfo"/>       </service>       <channels>            <channel ref="http" port="80" />       </channels>    </application> </system.runtime.remoting> 
  • B.

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

     <system.runtime.remoting>    <application>        <service>            <activated type= "RemotingWeather.WeatherInfo, WeatherInfo"/>       </service>       <channels>            <channel ref="http server" port="80" />       </channels>    </application> </system.runtime.remoting> 
  • D.

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

Answer B is correct. IIS supports only well-known or server-activated objects. Answers A and C are incorrect because, in this case, you must use the <wellknown> element instead of the <activated> element. Answer D is incorrect because, for specifying the server configuration, you must use the <server> element instead of the <client> element to configure the WellKnown object.

Question 5

You are a software developer for LubriSol, Inc., which manufactures chemicals for automobile industries. Your company does a lot of business with ReverseGear, Inc., which is the largest manufacturer of heavy vehicles in the country. ReverseGear, Inc., uses a .NET remoting application that allows its suppliers to check its daily parts requirements. Your objective is to create a client application to the ReverseGear's application that retrieves the information for parts produced by your company. All you know about the server application is its URL, which is http://ReverseGearInc.com/Suppliers/Req.rem. You want the quickest solution. What should you do to write a client application successfully?

  • A. Contact ReverseGear, Inc., to ask for the interface and include a reference to the interface in the client project.

  • B. Open the URL in the Web browser and select View, Source to find how the remote class is structured.

  • C. Use the Visual Studio .NET Add Web Reference feature to add a reference to the remote class in the client project.

  • D. Use the Soapsuds tool to automatically generate the metadata and include the reference to this metadata in the client project.

A5:

Answer D is correct. Because you know that the server's .NET remoting application is using HTTP, you can use the Soapsuds tool to automatically generate the metadata for the server. Answer A is incorrect because you want the quickest solution. Answer B is incorrect because the Web browser View, Source command cannot display the metadata for the class files. Answer C is incorrect because the Add Web Reference feature of Visual Studio .NET is available only to XML Web services.

Question 6

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 remotable class does not have any user interface, but it must use Integrated Windows authentication to authenticate the users. Which of the following techniques should you use to host the remotable class? You want a solution that requires you to write minimal code.

  • A. Use a console application as a remoting host.

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

  • C. Use a Windows forms application to host the remotable class.

  • D. Use Internet Information Services (IIS) as a remoting host.

A6:

Answer D is correct. You should use IIS as the remoting host because IIS has built-in support for Integrated Windows authentication. Answers A, B, and C are incorrect because you must write additional code to achieve Integrated Windows authentication with these techniques.

Question 7

You are developing an application that allows the client programs to instantiate a class named Inventory. You want the remote object to be created on the server so that it can access the inventory database. However, you want client programs to control the creation and the lifetime of the remote objects. Which of the following methods of the RemotingConfiguration class would you choose to register the remotable class with the remoting system on the server?

  • A. RegisterWellKnownServiceType()

  • B. RegisterWellKnownClientType()

  • C. RegisterActivatedServiceType()

  • D. RegisterActivatedClientType()

A7:

Answer C is correct. Your requirement is to register a client-activated remote object on the server, so you should use the RegisterActivatedServiceType() method. Answers A and B are incorrect because these two options are for creating the server-activated objects. Answer D is incorrect because the RegisterActivatedClientType() method is used to register the CAO with the remoting system in the client's application domain.

Question 8

One of your coworkers has written the following code as part of a client application that activates a remote object. She is complaining that her program is not compiling. What should she modify in the program to remove this error? (Select all that apply.)

 01: DbConnect CreateObject() 02: { 03:     TcpClientChannel channel =             new TcpClientChannel(1234); 04:     ChannelServices.RegisterChannel(channel); 05:     RemotingConfiguration.         RegisterWellKnownClientType( 06:         typeof(DbConnect), 07:         "tcp://localhost/DbConnect" 08:         ); 09:     dbc = new DbConnect(); 10:     return dbc; 11: } 
  • A. Change Line 5 to use the RegisterWellKnownServiceType() method instead of the RegisterWellKnownClientType() method.

  • B. Change the URL in Line 7 to "tcp://localhost:1234/DbConnect".

  • C. Remove the port number from the constructor of TcpClientChannel() in Line 3.

  • D. Change the code in Line 7 to objectUri="DbConnect".

A8:

Answers B and C are correct. When creating a client channel, you should not specify a port number when calling the channel constructor. Instead, the port number should be used with the URL of the remote object. After the channels are created, they should be registered with the remoting system. Answer A is incorrect because you use the RegisterWellKnownClientType() method to register a client application with the remoting framework. Answer D is incorrect because ObjectUri needs to be specified for registering the server rather than the client.

Question 9

You have designed a Windows application that is used by the shipping department of a large distribution house. The Windows application instantiates a remotable class hosted on Internet Information Services (IIS). The remotable class provides various services to the Windows application, such as address validation and calculation of shipping rates. When you deploy the application, users complain that when they click the Validate Address button, the Windows application freezes and they can't take further action until the address has been verified. What should you do to improve the application's responsiveness?

  • A. Use the binary formatter instead of the SOAP formatter.

  • B. Use the TCP channel to communicate instead of the HTTP channel.

  • C. Modify the remotable class to support asynchronous method calls.

  • D. Modify the Windows application to call the methods asynchronously on the remote object.

A9:

Answer D is correct. This behavior occurs because the Windows application is calling the methods on the remote object synchronously. You can make the user interface more responsive by simply calling the remote method asynchronously. Answers A and B are incorrect because the issue in the question is not of speed, but of responsiveness. Answer C is incorrect because no modifications are needed on the remotable object to support asynchronous calls.

Question 10

You have been hired by Great Widgets, Inc., to create an application that enables suppliers to access purchase order information in real time. You create the required classes that the suppliers can activate remotely and package them into a file named gwpoinfo.dll. You plan to use IIS as the remoting host for this file. After the application has been deployed, minimal steps should be involved in changing the remoting configuration for this application. Any configuration changes made to the purchase order information system should not affect any other applications running on that server. Which of the following files would you choose to configure remoting for the purchase order information system?

  • A. gwpoinfo.dll

  • B. web.config

  • C. global.asax

  • D. machine.config

A10:

Answer B is correct. You should store the remoting configuration in the web.config file. This file is an XML-based configuration file that is easy to modify and does not require a separate compilation step. Answers A and C are incorrect because storing configuration settings in gwpoinfo.dll or global.asax requires the additional step of compilation before the settings come into effect. Answer D is incorrect because any changes made to machine.config affect all the applications running on the server.


    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