Review Questions

1. 

What best describes the trade-offs that must be considered when deciding whether to use a TCP channel or an HTTP channel?

  1. The TCP channel is faster but offers less security.

  2. The HTTP channel is faster but offers less security.

  3. The TCP channel can be configured to use Secure Sockets Layer (SSL) but can use only the binary formatter.

  4. The HTTP channel can be configured to use Secure Sockets Layer (SSL) but can use only the SOAP formatter.

athe tcp channel transmits data faster than http. however, http (the higher-level protocol) supports various security features such as ssl. the third and fourth answers are incorrect. the default is for the tcp channel to use the binary formatter and the http channel to use the soap formatter; however, they can be configured to use either formatter. custom formatters can also be created to extend these basic classes provided by the .net framework.

2. 

When registering a channel, how should you select a port number?

  1. You are restricted to using port numbers 0 through 1023.

  2. .NET Remoting works only with port numbers 1433 and 1434.

  3. .NET Remoting works only with port numbers in the 8000-8999 range.

  4. You can assign any port number but be careful that you do not conflict with the port numbers that are conventionally used by other applications.

dalthough you can use any port number, numbers up to 1023 are widely used by common applications (such as port 80 for web browsers and servers), so you should select port numbers greater than 1024. microsoft sql server commonly uses port numbers 1433 and 1434. you should be aware of other applications that are using ports on your server and choose port numbers that do not conflict.

3. 

When registering a channel in your code, which System DLL should you set a reference to?

  1. System.Web.Services.dll

  2. System.ServiceProcess.dll

  3. System.Runtime.Remoting.dll

  4. System.Runtime.EnterpriseServices.dll

cto use the channelclass and other important .net framework classes in a .net remoting project, set a reference to system.runtime.remoting.dll .

4. 

You have a class in your .NET Remoting application that requires that its complete object state be sent to the calling client code. What are two ways that this can be specified? (Choose two.)

  1. Mark the class with the <Serializable> attribute.

  2. Mark the class with the <MarshalByValue> attribute.

  3. Implement the IMarshal interface in your class and create a custom marshalling method.

  4. Implement the ISerializable interface in your class and create a custom serialization method.

a, dby adding the - serializable - attribute to your class, you can use the built-in .net framework serialization capabilities to send all the data that completely describes the object s state to another component. by implementing the iserializable interface, you can create a custom method for controlling how the object s data is transcribed. this is useful for serializing complex objects or for using application-specific knowledge of the data to reduce the amount of data transferred.

5. 

You would like in your .NET Remoting application to create a proxy object on the client side when the client instantiates a remote object but not necessarily to contact the server until the client accesses the object. How do you create classes that support this behavior?

  1. Your classes must inherit from MarshalByValue.

  2. Your classes must inherit from MarshalByRefObject.

  3. Your classes must implement ISerializable.

  4. Your classes must implement IMarshal.

bin order for the .net remoting infrastructure to create proxy objects on the client, the server classes must inherit from marshalbyrefobject . marshal-by-value objects are those that implement iserializable or make use of the - serializable - attribute to transcribe the complete object state to the client.

6. 

You want to create a server-activated object that will remain in memory while the host application is running and that will service multiple requests from multiple clients. This type of object is defined by setting the WellKnownObjectMode property to what?

  1. SingleUse

  2. SingleCall

  3. Singleton

  4. SingleInstance

ca singleton object can remain in memory on the server for an indefinite period of time and service multiple requests from multiple clients. a singlecall object is created and destroyed for each method call. the others are not valid wellknownobjectmode types.

7. 

You want to create a server-activated object that holds unique data for each caller. After a method call is complete, the object will no longer be needed and the server memory it was using must be released as quickly as possible. This type of object is defined by setting the WellKnownObjectMode property to what?

  1. SingleUse

  2. SingleCall

  3. Singleton

  4. SingleInstance

ba singlecall object is created and destroyed for each method call and serves only a single caller. the object can hold unique data for the caller while it is in memory. a singleton object remains in memory and is reused for each method call by multiple callers. the others are not valid wellknownobjectmode types.

8. 

When an object's lifetime lease expires, what happens?

  1. The client receives an exception.

  2. The object is marked as available for garbage collection.

  3. The client receives an event notification to extend the lease.

  4. The object is immediately removed from memory.

bwhen the object s lifetime lease expires, it is marked as available for garbage collection by the clr.

9. 

What should you do to make a custom setting for the InitialLeaseTime property in your code?

  1. In the client code, call the Lease.Renew method at the end of every method call.

  2. In the client code, change the RenewOnCallTime property at the end of every method call.

  3. In the server code, override the GetLifetimeService method and change the property setting.

  4. In the server code, override the InitializeLifetimeService method and change the property setting.

dthe initialleasetime property can be changed only from the default in the marshalbyrefobject.initializelifetimeservice method. to make a custom setting, you must override this method and change the property setting in your code.

10. 

What should you do to change the setting for the CurrentLeaseTime property in your code?

  1. In the client code, get a reference to the remote object's lease object by calling the GetLifetimeService method. Then call the Renew method of the lease object.

  2. In the client code, get a reference to the remote object's lease object by calling the InitializeLifetimeService method. Then call the Renew method of the lease object.

  3. In the server code, call the Lease.Renew method at the end of every method call.

  4. In the server code, change the RenewOnCallTime property at the end of every method call.

athe currentleasetime property can be changed by accessing the remote object s associated lease object (which is created and maintained by the .net remoting infrastructure). the getlifetimeservice method returns a reference to a lease object. you can then call lease.renew . the initializelifetimeservice method is executed only when the object is created. lease.renew should be called by the client, not in the server code. you do not need to change the renewoncalltime property; it will automatically extend the object s lifetime by the specified time (the default is 2 minutes) after every client call on the object.

11. 

When designing a class that will be used in a remote server as a part of a .NET Remoting application, why should you start by defining and compiling an interface DLL?

  1. It is a requirement of the .NET Framework that all classes are defined by an interface.

  2. It is a requirement of .NET Remoting that all classes are defined by an interface.

  3. So that the complete implementation DLL does not need to be deployed on every client computer.

  4. So that the complete implementation DLL does not need to be deployed on the remote server computer.

cthe interface dll contains the minimum information that the .net remoting infrastructure on the client side needs to create a proxy for the remote class. by providing the interface, you do not need to distribute the complete implementation dll to client computers.

12. 

What is one of the main advantages of using XML configuration files to set .NET Remoting properties?

  1. Improved performance

  2. Easier maintenance

  3. Increased security

  4. Greater scalability

bxml configuration files make ongoing maintenance and support of applications easier because changes can be made directly to the configuration file. developers do not have to change the original source code and recompile.

13. 

What is one of the most common errors that is made when working with XML configuration files?

  1. Putting the configuration file in the wrong directory

  2. Giving the configuration file an invalid filename

  3. Forgetting to compile the configuration file

  4. Incorrect use of uppercase and lowercase letters in the XML tag names

dxml parsers require that all xml tag names exactly match their definitions, including exact matches of uppercase and lowercase characters. because a configuration file can be named anything, as long as it matches the name referenced in the code, those are not common errors. likewise, a configuration file does not need to be compiled.

14. 

What is the main advantage of calling remote methods asynchronously?

  1. The user interface of the client application remains responsive, and the developer can provide status messages to the user.

  2. The method call will automatically be repeated if you cannot connect to the server on the first try.

  3. The user is notified by the .NET Remoting infrastructure that they will have to wait for their results.

  4. The client's results will be stored on the server until the client application requests them.

aasynchronous method calls enable the client application s user interface to remain responsive, so that the developer can provide status information to the user.

15. 

When calling a remote method asynchronously, which set of methods should you use?

  1. CallStart and CallComplete

  2. BeginMethod and EndMethod

  3. BeginInvoke and EndInvoke

  4. MethodStart and MethodComplete

cthe delegate object provides the begininvoke and endinvoke methods that enable you to create asynchronous callback functions in your applications.

Answers

1. 

A The TCP channel transmits data faster than HTTP. However, HTTP (the 'higher-level' protocol) supports various security features such as SSL. The third and fourth answers are incorrect. The default is for the TCP channel to use the binary formatter and the HTTP channel to use the SOAP formatter; however, they can be configured to use either formatter. Custom formatters can also be created to extend these basic classes provided by the .NET Framework.

2. 

D Although you can use any port number, numbers up to 1023 are widely used by common applications (such as port 80 for web browsers and servers), so you should select port numbers greater than 1024. Microsoft SQL Server commonly uses port numbers 1433 and 1434. You should be aware of other applications that are using ports on your server and choose port numbers that do not conflict.

3. 

C To use the ChannelClass and other important .NET Framework classes in a .NET Remoting project, set a reference to System.Runtime.Remoting.dll.

4. 

A, D By adding the <Serializable> attribute to your class, you can use the built-in .NET Framework serialization capabilities to send all the data that completely describes the object's state to another component. By implementing the ISerializable interface, you can create a custom method for controlling how the object's data is transcribed. This is useful for serializing complex objects or for using application-specific knowledge of the data to reduce the amount of data transferred.

5. 

B In order for the .NET Remoting infrastructure to create proxy objects on the client, the server classes must inherit from MarshalByRefObject. Marshal-by-value objects are those that implement ISerializable or make use of the <Serializable> attribute to transcribe the complete object state to the client.

6. 

C A Singleton object can remain in memory on the server for an indefinite period of time and service multiple requests from multiple clients. A SingleCall object is created and destroyed for each method call. The others are not valid WellKnownObjectMode types.

7. 

B A SingleCall object is created and destroyed for each method call and serves only a single caller. The object can hold unique data for the caller while it is in memory. A Singleton object remains in memory and is reused for each method call by multiple callers. The others are not valid WellKnownObjectMode types.

8. 

B When the object's lifetime lease expires, it is marked as available for garbage collection by the CLR.

9. 

D The InitialLeaseTime property can be changed only from the default in the MarshalByRefObject.InitializeLifetimeService method. To make a custom setting, you must override this method and change the property setting in your code.

10. 

A The CurrentLeaseTime property can be changed by accessing the remote object's associated lease object (which is created and maintained by the .NET Remoting infrastructure). The GetLifetimeService method returns a reference to a lease object. You can then call Lease.Renew. The InitializeLifetimeService method is executed only when the object is created. Lease.Renew should be called by the client, not in the server code. You do not need to change the RenewOnCallTime property; it will automatically extend the object's lifetime by the specified time (the default is 2 minutes) after every client call on the object.

11. 

C The interface DLL contains the minimum information that the .NET Remoting infrastructure on the client side needs to create a proxy for the remote class. By providing the interface, you do not need to distribute the complete implementation DLL to client computers.

12. 

B XML configuration files make ongoing maintenance and support of applications easier because changes can be made directly to the configuration file. Developers do not have to change the original source code and recompile.

13. 

D XML parsers require that all XML tag names exactly match their definitions, including exact matches of uppercase and lowercase characters. Because a configuration file can be named anything, as long as it matches the name referenced in the code, those are not common errors. Likewise, a configuration file does not need to be compiled.

14. 

A Asynchronous method calls enable the client application's user interface to remain responsive, so that the developer can provide status information to the user.

15. 

C The Delegate object provides the BeginInvoke and EndInvoke methods that enable you to create asynchronous callback functions in your applications.



MCAD/MCSD(c) Visual Basic. NET XML Web Services and Server Components Study Guide
MCAD/MCSD: Visual Basic .NET XML Web Services and Server Components Study Guide
ISBN: 0782141935
EAN: 2147483647
Year: 2005
Pages: 153

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net