Introduction to Java Programming, Includes Data Structures, Eleventh Edition, Y. Daniel Liang

This quiz is for students to practice. A large number of additional quiz is available for instructors using Quiz Generator from the Instructor's Resource Website. Videos for Java, Python, and C++ can be found at https://yongdanielliang.github.io/revelvideos.html.

Chapter 40 Remote Method Invocation


Section 40.2 RMI Basics
40.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

40.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

40.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

40.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

40.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

40.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

40.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

40.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.

40.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

40.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
40.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);

40.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");

40.13  To start an RMI registry, use ____________ from the command window.
A. start rmiregistry
B. start rmiregistry 7000
C. rmiregistry
D. rmiregistry 7000

40.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