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.