Java How to Program, 11/e Multiple Choice Test Bank 1 of 2
Chapter 28: Networking
Section 28.1 Introduction
28.1 Q1: __________ sockets and the __________ protocol are more desirable for the vast majority of Java
programmers.
a. Stream, UDP.
b. Stream, TCP.
c. Datagram, UDP.
d. Datagram, TCP.
28.1 Q2: Which statement is false?
a. With datagram sockets a process establishes a connection to another process.
b. The TCP protocol is used for transmission with stream sockets.
c. The UDP protocol is used for transmission with datagram sockets.
d. With the UDP protocol packets can be lost, duplicated or even arrive out of sequence.
Section 28.2 Reading a File on a Web Server
28.2 Q1: Which statement is false? Normally, an applet __________.
a. is allowed to read files only on the server from which the applet was downloaded.
b. can read files on any server that can be reached over the network.
c. cannot read files on the system on which it executes.
d. has different file access rights than an application running on the same machine.
28.2 Q2: A JEditorPane generates HyperlinkEvents only if it is __________.
a. invisible.
b. visible.
c. uneditable.
d. editable.
Section 28.3 Establishing a Simple Server Using Stream Sockets
28.3 Q1: Once the ServerSocket is created, the server can listen indefinitely (or block) for an attempt by a client
to connect. This is accomplished with a call to the ServerSocket method __________.
a. connect.
b. block.
c. accept .
d. listen.
Section 28.4 Establishing a Simple Client Using Stream Sockets
28.4 Q1: If an ObjectInputStream is used to read information from the server, an __________ is generated when
the client attempts to read a value from a stream on which end–of-stream is detected.
a. EOF.
b. EOS.
c. EOFException.
d. EOSException.
28.4 Q2: A(n) __________ is thrown when a server address indicated by a client cannot be resolved.
a. ConnectException.
b. ServerException.
c. MalformedURLException.
d. UnknownHostException.
Java How to Program, 11/e Multiple Choice Test Bank 2 of 2
Section 28.5 Client/Server Interaction with Stream Socket Connections
28.5 Q1: Output __________ are typically used to increase the efficiency of an application by sending larger
amounts of data fewer times.
a. objects.
b. broadcasters.
c. buffers.
d. None of the above.
28.5 Q2: The Internet address 128.0.0.1 is also known as __________.
a. localhost.
b. remotehost.
c. localserver.
d. remoteserver.
28.5 Q3: The port number at which the server waits for connections is often called the __________ point.
a. handhold.
b. handshake.
c. handoff.
d. handle.
Section 28.6 Connectionless Client/Server Interaction with Datagrams
28.6 Q1: Which statement is false?
a. Streams-based transmission is connection-oriented.
b. Connection-oriented transmission is like the telephone system.
c. Datagram-based transmission is connection oriented.
d. Connectionless transmission is like the way the mail is carried by the postal service.
28.6 Q2: Specifying a port that is already in use or specifying an invalid port number when creating a
DatagramSocket results in a __________.
a. SocketException.
b. PortInUseException.
c. PortException.
d. ConnectException.
Section 28.7 Client/Server Tic-Tac-Toe Using a Multithreaded Server
28.7 Q1: To be able to send and receive messages in parallel over a network connection, a program must use
__________ of execution.
a. one thread.
b. two threads.
c. three threads.
d. four threads.