Chapter 40 Remote Method Invocation
Section 40.2 RMI Basics
1. RMI is about .
a. passing primitive data between a server and a client
b. passing objects between a server and a client
c. accessing remote objects and invoking methods from remote objects.
d. java.lang.Cloneable
#
2. A remote object must be an instance of .
a. java.rmi.RemoteObject
b. java.rmi.Remote
c. java.io.Serializable
d. java.lang.Cloneable
#
3. is a subinterface of java.rmi.Remote that defines the methods for the server object.
a. Server object interface
b. Server implementation
c. RMI Registry
d. Server stub
e. Server Skeleton
#
4. is a class that implements the remote object interface.
a. Server object interface
b. Server implementation
c. RMI Registry
d. Server stub
e. Server Skeleton
#
5. is a utility that registers remote objects and provides naming services for locating objects.
a. Server object interface
b. Server implementation
c. RMI Registry
d. Server stub
e. Server Skeleton
#
6. is an object that resides on the client host and serves as a surrogate for the remote server object.
a. Server object interface
b. Server implementation
c. RMI Registry
d. Server stub
e. Server Skeleton
#
7. is an object that resides on the server host, communicates with the stub and the actual server object.
a. Server object interface
b. Server implementation
c. RMI Registry
d. Server stub
e. Server Skeleton
#
8. Which of the following statements are true when passing arguments in a remote method call.
a. Primitive data types, such as char, int, double, or boolean, are passed by value like a local call.
b. Local object types, such as java.lang.String, are also passed by value, but this is completely different from passing
an object parameter in a local call. Any object can be used as a parameter in a remote call as long as it is serializable.
The stub serializes the object parameter and sends it in a stream across the network. The skeleton deserializes the
stream into an object.
c. Remote object types are passed differently from local objects. When a client invokes a remote method with a
parameter of a remote object type, the stub of the remote object is passed. The server receives the stub and
manipulates the parameter through it.
d. When a client invokes a remote method with parameters, passing the parameters is handled by the stub and the
skeleton.
#
9. provides the naming services for the server to register the object and for the client to locate the object.
a. Server object interface
b. Server implementation
c. RMI Registry
d. Server stub
e. Server Skeleton
#
10. Each remote object has a unique name identified by an URL with the protocol rmi as follows:
a. rmi://host:port/name
b. //host:port/name
c. http://host:port/name
d. http://host/name
#
Section 40.3 Developing RMI Applications
11. To register a remote object o with a name t at port 7000 on host panda.armstrong.edu, use
a. Naming.bind(“rmi://panda.armstrong.edu:7000/t”, o);
b. Naming.rebind(“rmi://panda.armstrong.edu:7000/t”, o);
c. Name.rebind(“rmi://panda.armstrong.edu:7000/t”, o);
d. Name.bind(“rmi://panda.armstrong.edu:7000/t”, o);
#
12. To locate a remote object with a name t at port 7000 on host panda.armstrong.edu, use
a. Remote remoteObj = Naming.lookup(“rmi://panda.armstrong.edu:7000/t”);
b. Remote remoteObj = Name.lookup(“rmi://panda.armstrong.edu:7000/t”);
c. Remote remoteObj = Name.lookup(“//panda.armstrong.edu:7000/t”);
d. Remote remoteObj = Name.lookup(“http://panda.armstrong.edu:7000/t”);
#
13. To start an RMI registry, use from the command window.
a. start rmiregistry
b. start rmiregistry 7000
c. rmiregistry
#
14. Assume that the file named policy contains the permission for registering a remote object with an RMI registry. To
run the program (e.g., RegisterWithRMIServer) that registers a remote object with an RMI registry, use the command
from the command window.
a. java Djava.security.policy=policy RegisterWithRMIServer
b. java RegisterWithRMIServer java Djava.security.policy=policy
c. java RegisterWithRMIServer
d. java Dpolicy=policy RegisterWithRMIServer