Deck 21: Internet Networking

Full screen (f)
exit full mode
Question
If a computer wants to request information from gateway.com, it must first ask a(n) ____ server to translate the domain name into a numeric Internet address.

A) DNS
B) socket
C) URL
D) IP
Use Space or
up arrow
down arrow
to flip the card.
Question
IP breaks up large chunks of data into more manageable ____________________.

A) packets
B) sockets
C) application data
D) network protocol data
Question
____ has built-in provisions for retrying incomplete transmissions.

A) TCP
B) IP
C) DNS
D) HTTP
Question
_____________ attempts reliable delivery of data, with retries if there are failures. It also notifies the sender whether or not the attempt succeeded.

A) IP
B) FTP
C) HTTP
D) TCP
Question
What are among the most important pieces of information that must be included in an IP packet?
I) The Internet address of the recipient
II) The URL of the recipient
III) The Internet address of the sender
IV) The port number of the sender

A) I, III, and IV
B) I, II, and III
C) II, III, and IV
D) I, II, III, and IV
Question
__________________ is the protocol that defines communication between Web browsers and Web servers.

A) TCP/IP
B) Telnet
C) HTTP
D) IP
Question
The ____________ translates domain names into Internet addresses.

A) DSN
B) DNIP
C) DNS
D) TCP
Question
If your data gets lost or garbled during transmission from one computer to another, what is responsible for ensuring that the recipient is aware of the unfortunate fact and does not rely on incomplete data?

A) TCP
B) IP
C) HTTP
D) DNS
Question
What does the acronym POP stand for?

A) Point to Point
B) Post Office Point
C) Protocol Of Point
D) Post Office Protocol
Question
_______ ________ was developed to enable different local area networks to communicate with each other and has become the basis for connecting computers around the world over the Internet.

A) TCP
B) IP
C) FTP
D) HTTP
Question
Two kinds of data are transmitted between computers: ______________ refers to the data that one computer actually wants to send to another. Network protocol data are the data that describe how to reach the intended recipient and how to check for errors and data loss in the transmission.

A) packets
B) transmission data
C) application data
D) socket data
Question
____________________ has no provision for retrying an incomplete transmission.

A) TCP
B) IP
C) FTP
D) HTTP
Question
A(n) _______________ is a set of instructions and rules that the client and server follow to allow communication between them. Each will know what to send and what to expect to receive from its partner in the communication.

A) URL
B) Internet
C) protocol in network programming
D) File Transfer Protocol
Question
Each IP ____ is delivered separately, and each one that is a part of the same transmission can take different routes through the Internet.

A) packet
B) socket
C) address
D) port number
Question
Suppose you use the URLGet program in Section 21.5 to get a web page from a server that does not exist, such as http://wombat.java/index.html. What will happen?

A) The call to the URL constructor will throw an exception.
B) The call to getResponseCode will throw an exception.
C) The call to getResponseCode will return the error code 404.
D) The call to getInputStream will throw an exception.
Question
The term _____________ data refers to the data that describe how to reach the intended recipient and how to check for errors and data loss in the transmission.

A) packet
B) socket
C) application data
D) network protocol
Question
Which of the following protocols is used to send email messages?

A) POP
B) IP
C) SMTP
D) TCP
Question
The ____________ has one function, to attempt to deliver data from one computer to another across the Internet.

A) TCP/IP
B) IP
C) HTTP
D) DNS
Question
The ____ is a complex collection of pathways on which a message can travel from one access point to another.

A) IP
B) HTTP protocol
C) HTML
D) Internet
Question
The numbers 130.65.86.66 denote a(n) ____________________.

A) TCP address
B) IP address
C) URL address
D) FTP address
Question
A(n) ____ describes how data for a particular application is transmitted.

A) URL
B) application protocol
C) socket
D) IP address
Question
A(n) ____ is a pointer to an information resource on the World Wide Web.

A) URL
B) socket
C) IP address
D) domain name
Question
Write a code fragment that connects to a server running on gorge.divms.uiowa.edu at port 2345 and sends the message "Hello server" to the server and then reads the one-line response from the server.

A) Socket sock = new Socket(2345, gorge.divms.uiowa.edu);
PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)println("Hello server");
Pw)flush();
String line = scan.nextLine();
Scanner scan = new Scanner(sock.getInputStream());
B) Socket sock = new Socket(gorge.divms.uiowa.edu);
PrintWriter pw = new PrintWriter(sock.getOutputStream(), 2345);
Pw)println("Hello server");
Pw)flush();
Scanner scan = new Scanner(sock.getInputStream());
String line = scan.nextLine();
C) Socket sock = new Socket(gorge.divms.uiowa.edu, 2345);
PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)println("Hello server");
Pw)flush();
Scanner scan = new Scanner(sock.getInputStream());
String line = scan.nextLine();
D) Socket sock = new Socket(gorge.divms.uiowa.edu, 2345);
PrintWriter pw = new PrintWriter(sock.getInputStream());
Pw)println("Hello server");
Pw)flush();
Scanner scan = new Scanner(sock.getOutputStream());
String line = scan.nextLine();
Question
What does the acronym SMTP stand for?

A) Simple Mail Transfer Protocol
B) Small Mail Transport Protocol
C) Simple Mail Transport Protocol
D) Small Mail Transfer Protocol
Question
To connect to the HTTP port (80) of the server yahoo.com, you use:

A) Socket s = new Socket(80, yahoo.com);
B) Socket s = connect("yahoo.com", 80);
C) Socket s = new Socket("yahoo.com", 80);
D) java yahoo.com 80
Question
What are the steps involved in designing a client/server application?
I) Design a communication protocol.
II) Test the server with the Telnet program.
III) Implement the server program.
IV) Write a client program.

A) I
B) I and II
C) I, II, and III
D) I, II, III, and IV
Question
Which of the following HTTP commands supplies input to a server-side command and returns the result?

A) CONNECT
B) DELETE
C) HEAD
D) POST
Question
The ____ program is a useful tool for establishing test connections with servers.

A) DNS
B) HTML
C) Telnet
D) TCP
Question
Which of the following is not an HTTP command?

A) HEAD
B) BODY
C) PUT
D) OPTIONS
Question
Suppose you use the URLGet program in Section 21.5 to get a web page that does not exist on a server (which does exist). Assuming that the server is otherwise working properly, what will happen?

A) The call to openConnection will throw an exception.
B) The call to getResponseCode will return the error code 404.
C) The call to getResponseMessage will return null.
D) The call to getInputStream will throw an exception.
Question
_________ objects are used for communication (IO) between two computers (client and server).

A) ServerSocket
B) Socket
C) ClientSocket
D) Packet
Question
Write a code fragment that connects to a server running on gorge.divms.uiowa.edu at port 2345 and reads one line of text sent by the server.

A) Socket sock = new Socket(gorge.divms.uiowa.edu, 2345);
Scanner scan = new Scanner(sock.getOutputStream());
String line = scan.nextLine();
B) Socket sock = new Socket(gorge.divms.uiowa.edu, 2345);
Scanner scan = new Scanner(sock.getInputStream());
String line = scan.nextLine();
C) Scanner scan = new Scanner(sock.getInputStream());
Socket sock = new Socket(gorge.divms.uiowa.edu, 2345);
String line = scan.nextLine();
D) Socket sock = new Socket(2345, gorge.divms.uiowa.edu);
Scanner scan = new Scanner(sock.getInputStream());
String line = scan.next();
Question
For test protocols, turn the socket streams into:

A) scanners and readers.
B) scanners and printers.
C) scanners and writers.
D) scanners and servers.
Question
Which code fragment creates a server running at port 6666 and sends one line of text, "Hello from earth" over and over to any machine that connects to the server.

A) ServerSocket ss = new ServerSocket(6666);
Socket sock = ss.accept();
While (true)
{
PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)println("Hello from earth");
Pw)flush();
Pw)close();
}
B) ServerSocket ss = new ServerSocket(6666);
While (true)
{
PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)println("Hello from earth");
Socket sock = ss.accept();
}
C) ServerSocket ss = new ServerSocket(6666);
While (true)
{
Socket sock = ss.accept();
PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)println("Hello from earth");
Pw)flush();
Pw)close();
}
D) Socket sock = ss.accept();
While (true)
{
ServerSocket ss = new ServerSocket(6666);
PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)println("Hello from earth");
Pw)flush();
Pw)close();
}
Question
A ______ is an object that encapsulates a TCP connection.

A) packet
B) socket
C) client
D) server
Question
Suppose that sock refers to a TCP socket connected to another machine, and in is aScanner. Which code sends the string "Who is there?" to the other machine, receives the return answer, and then prints it?

A) PrintWriter pw = new PrintWriter(sock.getOutputStream().println("Who is there?"));
InputStream instream = sock.getInputStream();
Scanner in = new Scanner(instream);
System.out.println(in.nextLine());
B) PrintWriter pw = new PrintWriter(sock.getInputStream());
Pw)println("Who is there?");
Pw)flush();
InputStream instream = sock.getInputStream();
Scanner in = new Scanner(instream);
System.out.println(in.nextLine());
C) PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)flush("Who is there");
InputStream instream = sock.getInputStream();
Scanner in = new Scanner(instream);
System.out.println(in.nextLine());
D) PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)println("Who is there?");
Pw)flush();
InputStream instream = sock.getInputStream();
Scanner in = new Scanner(instream);
System.out.println(in.nextLine());
Question
Which code creates a server socket on port PORT_NUMBER and listens for a connection?

A) ServerSocket ss = new ServerSocket(PORT_NUMBER);
Socket sock = ss.accept();
B) Socket ss = new Server(PORT_NUMBER);
ServerSocket sock = ss.accept();
C) ServerSocket ss = new ServerSocket();
Socket sock = ss.accept();
D) ServerSocket ss = new ServerSocket(PORT_NUMBER);
Socket sock = new Socket(ss.accept());
Question
Show the command line that establishes a telnet connection with echo server (port 7) running on the computer www.eecs.utoledo.edu.

A) telnet 7 www.eecs.utoledo.edu
B) connect www.eecs.utoledo.edu 7
C) telnet www.eecs.utoledo.edu 7
D) tcp www.eecs.utoledo.edu 7
Question
Which of the following statements is correct?

A) HTML is a protocol that describes the command set for web server requests.
B) Web servers know how to display HTML documents.
C) Web servers know how to issue HTTP commands.
D) The Telnet program is not a browser and does not understand HTML tags.
Question
The ____ is used to download received messages from e-mail servers.

A) SMTP
B) TCP
C) IP
D) POP
Question
To retrieve the response code and message from an HttpURLConnection object, you need __________________.

A) to use the getInputStream() method.
B) to use the getURLConnection() method.
C) to use the getResponseCode() and getResponseMessage() methods.
D) to use the getCodeResponse() method.
Question
When you communicate with a mail server, you ___________, or you can learn how to use Java mail extensions.

A) can write programs that send GET and POP commands.
B) can write programs that send SMTP and POST commands.
C) can write programs that send GET and POST commands
D) can write programs that send SMTP and POP commands.
Question
The HTTP response code 200 means _______________.

A) the response is successful.
B) the page is found successfully.
C) the page was not found.
D) the connection is lost.
Question
To kill a server that was started in a shell window, ________.

A) press Ctrl+C
B) press Ctrl+Z
C) call the kill method
D) servers don't stop.
Question
When a web page is loaded, the browser stores it in a ________ directory.

A) root
B) my document
C) cashe
D) cache
Question
The Java library provides a _________ class that can take care of the socket connection to a web server.

A) SocketConnection
B) ServerConnection
C) ClientConnection
D) URLConnection
Question
Buffering the characters means:

A) characters are immediately sent to their destination.
B) characters are not placed in an array.
C) characters are not immediately sent to their destination.
D) characters are being flushed.
Question
To retrieve the response code from a URLConnection object, you need __________________.

A) to cast the HttpURLConnection object to the URLConnect subclass.
B) to cast the URLConnection object to the HttpURLConnect subclass.
C) to use the getInputStream() method.
D) to use the getCodeResponse() method.
Question
A print writer buffers the characters that you send to it. To make sure that the server gets a complete request at a time, you need to ________ the buffer.

A) print
B) send
C) scan
D) flush
Question
The _________ class makes it easy to fetch a file from a web server.

A) FileConnection
B) ServerConnection
C) ClientConnection
D) URLConnection
Question
A successful response has status _______________.

A) 200 OK.
B) 404 OK.
C) 0 OK.
D) 100 OK.
Question
A thread dies ______________

A) when the client quits or disconnects.
B) when the run method exits.
C) when the client quits or disconnects and/or when the run method exits.
D) the thread runs forever in the background.
Question
In a communication protocol, can the sender indicate how many bytes are contained in the request?

A) Yes, the web server does that at the end of the GET request.
B) Yes, the web browser does that in POST request.
C) Yes, the web browser does that at the end of the HTTP header.
D) No, the sender can't indicate how many bytes are contained in the request.
Question
When you communicate with a web server to obtain data, you have two choices:
I) You can make a socket connection and send GET and POST commands.
II) You can make a server connection and send GET and POST commands.
III) You can use the URLConnection class and have it issue the commands on your behalf.
IV) You can use the URL class and have it issue the commands on your behalf.

A) I and II.
B) II and III.
C) III and I.
D) IV and II.
Question
The following command:
Java pgmName hostname /
Lets you retrieve any item from a web server. The slash means:

A) the port of the hostname.
B) the root page of the web server.
C) the character to end the command.
D) the item name needs to be retrieved.
Question
A page not found has status code _______________.

A) 200 not found.
B) 404 not found.
C) 0 not found.
D) 100 not found.
Question
The ______ method empties the buffer and forwards all waiting characters to the destination.

A) print
B) send
C) scan
D) flush
Question
The ______ method of the ServerSocket class waits for a client connection.

A) wait()
B) connect()
C) accept()
D) next()
Question
The HTTP response code 404 means _______________.

A) the response is successful.
B) the page is found successfully.
C) the page was not found.
D) the connection is lost.
Question
For the server to execute the run method in a separate thread for each client, the application program needs to implement the _____ interface.

A) Running
B) Runtime
C) Server
D) Runnable
Question
The HTTP command PUT ____________.

A) returns the requested item.
B) stores an item on the client.
C) stores an item on the server.
D) supplies input to a client-side command.
Question
The HTTP command POST ____________.

A) returns the requested item.
B) supplies input to a server-side command and returns the result.
C) requests input from the server-side command.
D) supplies input to a client-side command.
Question
You should use a ______ to connect to a web server.

A) Packet
B) Socket
C) URLConnection
D) HttpURLConnection
Question
The HTTP command GET ____________.

A) returns the requested item.
B) supplies input to a server-side command.
C) requests input from the server-side command.
D) supplies input to a client-side command.
Question
Sending commands over a socket connection is ___________.

A) a high-level approach.
B) a medium-level approach.
C) a low-level approach.
D) a complex approach.
Question
You should not use a ______ to connect to a web server.

A) Packet
B) Socket
C) URLConnection
D) HttpURLConnection
Question
The HTTP command OPTIONS ____________.

A) requests the item's communication options.
B) returns the item's options from the client.
C) returns the item's option on the server.
D) changes the options of the item.
Question
What does TCP/IP stand for?

A) Transmission Control and Internet Protocol.
B) Transmission Control Protocol and Internet Protocol.
C) Transmission Protocol and Internet Protocol.
D) Transmission Control Protocol over Internet Protocol.
Question
What does the following if statement do?
If (code == HttpURLConnetion.HTTP_OK)

A) It checks if the code is 200.
B) It checks if the code is 404.
C) It checks if the connection is still connected.
D) It checks if there is HTTP.
Question
The HTTP command HEAD ____________.

A) stores the header information of an item on the server.
B) deletes the header information of an item from the server.
C) requests the header information of an item.
D) traces the header information of an item.
Question
To open a connection, which of the following statements can you use?

A) URL u = new URL("http://www.yahoo.com");
URLConnection conn = u.open();
B) URL u = new URL("http://www.yahoo.com");
URLConnection conn = new URLConnection(u);
C) URL u = new URL("http://www.yahoo.com");
URLConnection conn = u.openURLConnection();
D) URL u = new URL("http://www.yahoo.com");
URLConnection conn = u.openConnection();
Question
To close a connection, which of the following statements can you use?

A) URL u = new URL("http://www.yahoo.com");
URLConnection conn = u.close();
B) URL u = new URL(str);
URLConnection conn = new URLConnection(u);
C) URL u = new URL(str);
URLConnection conn = u.closeURLConnection();
D) There is no need to close the connection.
Question
The HTTP command TRACE ____________.

A) traces the requested item.
B) traces an item from the client.
C) traces an item on the server.
D) traces the server communication.
Question
The HTTP command DELETE ____________.

A) deletes two items, an item on the server and an item from the client.
B) deletes an item from the client.
C) deletes an item on the server.
D) deletes input from a client-side command.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/74
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 21: Internet Networking
1
If a computer wants to request information from gateway.com, it must first ask a(n) ____ server to translate the domain name into a numeric Internet address.

A) DNS
B) socket
C) URL
D) IP
A
2
IP breaks up large chunks of data into more manageable ____________________.

A) packets
B) sockets
C) application data
D) network protocol data
A
3
____ has built-in provisions for retrying incomplete transmissions.

A) TCP
B) IP
C) DNS
D) HTTP
A
4
_____________ attempts reliable delivery of data, with retries if there are failures. It also notifies the sender whether or not the attempt succeeded.

A) IP
B) FTP
C) HTTP
D) TCP
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
5
What are among the most important pieces of information that must be included in an IP packet?
I) The Internet address of the recipient
II) The URL of the recipient
III) The Internet address of the sender
IV) The port number of the sender

A) I, III, and IV
B) I, II, and III
C) II, III, and IV
D) I, II, III, and IV
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
6
__________________ is the protocol that defines communication between Web browsers and Web servers.

A) TCP/IP
B) Telnet
C) HTTP
D) IP
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
7
The ____________ translates domain names into Internet addresses.

A) DSN
B) DNIP
C) DNS
D) TCP
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
8
If your data gets lost or garbled during transmission from one computer to another, what is responsible for ensuring that the recipient is aware of the unfortunate fact and does not rely on incomplete data?

A) TCP
B) IP
C) HTTP
D) DNS
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
9
What does the acronym POP stand for?

A) Point to Point
B) Post Office Point
C) Protocol Of Point
D) Post Office Protocol
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
10
_______ ________ was developed to enable different local area networks to communicate with each other and has become the basis for connecting computers around the world over the Internet.

A) TCP
B) IP
C) FTP
D) HTTP
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
11
Two kinds of data are transmitted between computers: ______________ refers to the data that one computer actually wants to send to another. Network protocol data are the data that describe how to reach the intended recipient and how to check for errors and data loss in the transmission.

A) packets
B) transmission data
C) application data
D) socket data
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
12
____________________ has no provision for retrying an incomplete transmission.

A) TCP
B) IP
C) FTP
D) HTTP
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
13
A(n) _______________ is a set of instructions and rules that the client and server follow to allow communication between them. Each will know what to send and what to expect to receive from its partner in the communication.

A) URL
B) Internet
C) protocol in network programming
D) File Transfer Protocol
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
14
Each IP ____ is delivered separately, and each one that is a part of the same transmission can take different routes through the Internet.

A) packet
B) socket
C) address
D) port number
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
15
Suppose you use the URLGet program in Section 21.5 to get a web page from a server that does not exist, such as http://wombat.java/index.html. What will happen?

A) The call to the URL constructor will throw an exception.
B) The call to getResponseCode will throw an exception.
C) The call to getResponseCode will return the error code 404.
D) The call to getInputStream will throw an exception.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
16
The term _____________ data refers to the data that describe how to reach the intended recipient and how to check for errors and data loss in the transmission.

A) packet
B) socket
C) application data
D) network protocol
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
17
Which of the following protocols is used to send email messages?

A) POP
B) IP
C) SMTP
D) TCP
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
18
The ____________ has one function, to attempt to deliver data from one computer to another across the Internet.

A) TCP/IP
B) IP
C) HTTP
D) DNS
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
19
The ____ is a complex collection of pathways on which a message can travel from one access point to another.

A) IP
B) HTTP protocol
C) HTML
D) Internet
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
20
The numbers 130.65.86.66 denote a(n) ____________________.

A) TCP address
B) IP address
C) URL address
D) FTP address
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
21
A(n) ____ describes how data for a particular application is transmitted.

A) URL
B) application protocol
C) socket
D) IP address
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
22
A(n) ____ is a pointer to an information resource on the World Wide Web.

A) URL
B) socket
C) IP address
D) domain name
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
23
Write a code fragment that connects to a server running on gorge.divms.uiowa.edu at port 2345 and sends the message "Hello server" to the server and then reads the one-line response from the server.

A) Socket sock = new Socket(2345, gorge.divms.uiowa.edu);
PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)println("Hello server");
Pw)flush();
String line = scan.nextLine();
Scanner scan = new Scanner(sock.getInputStream());
B) Socket sock = new Socket(gorge.divms.uiowa.edu);
PrintWriter pw = new PrintWriter(sock.getOutputStream(), 2345);
Pw)println("Hello server");
Pw)flush();
Scanner scan = new Scanner(sock.getInputStream());
String line = scan.nextLine();
C) Socket sock = new Socket(gorge.divms.uiowa.edu, 2345);
PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)println("Hello server");
Pw)flush();
Scanner scan = new Scanner(sock.getInputStream());
String line = scan.nextLine();
D) Socket sock = new Socket(gorge.divms.uiowa.edu, 2345);
PrintWriter pw = new PrintWriter(sock.getInputStream());
Pw)println("Hello server");
Pw)flush();
Scanner scan = new Scanner(sock.getOutputStream());
String line = scan.nextLine();
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
24
What does the acronym SMTP stand for?

A) Simple Mail Transfer Protocol
B) Small Mail Transport Protocol
C) Simple Mail Transport Protocol
D) Small Mail Transfer Protocol
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
25
To connect to the HTTP port (80) of the server yahoo.com, you use:

A) Socket s = new Socket(80, yahoo.com);
B) Socket s = connect("yahoo.com", 80);
C) Socket s = new Socket("yahoo.com", 80);
D) java yahoo.com 80
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
26
What are the steps involved in designing a client/server application?
I) Design a communication protocol.
II) Test the server with the Telnet program.
III) Implement the server program.
IV) Write a client program.

A) I
B) I and II
C) I, II, and III
D) I, II, III, and IV
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
27
Which of the following HTTP commands supplies input to a server-side command and returns the result?

A) CONNECT
B) DELETE
C) HEAD
D) POST
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
28
The ____ program is a useful tool for establishing test connections with servers.

A) DNS
B) HTML
C) Telnet
D) TCP
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
29
Which of the following is not an HTTP command?

A) HEAD
B) BODY
C) PUT
D) OPTIONS
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
30
Suppose you use the URLGet program in Section 21.5 to get a web page that does not exist on a server (which does exist). Assuming that the server is otherwise working properly, what will happen?

A) The call to openConnection will throw an exception.
B) The call to getResponseCode will return the error code 404.
C) The call to getResponseMessage will return null.
D) The call to getInputStream will throw an exception.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
31
_________ objects are used for communication (IO) between two computers (client and server).

A) ServerSocket
B) Socket
C) ClientSocket
D) Packet
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
32
Write a code fragment that connects to a server running on gorge.divms.uiowa.edu at port 2345 and reads one line of text sent by the server.

A) Socket sock = new Socket(gorge.divms.uiowa.edu, 2345);
Scanner scan = new Scanner(sock.getOutputStream());
String line = scan.nextLine();
B) Socket sock = new Socket(gorge.divms.uiowa.edu, 2345);
Scanner scan = new Scanner(sock.getInputStream());
String line = scan.nextLine();
C) Scanner scan = new Scanner(sock.getInputStream());
Socket sock = new Socket(gorge.divms.uiowa.edu, 2345);
String line = scan.nextLine();
D) Socket sock = new Socket(2345, gorge.divms.uiowa.edu);
Scanner scan = new Scanner(sock.getInputStream());
String line = scan.next();
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
33
For test protocols, turn the socket streams into:

A) scanners and readers.
B) scanners and printers.
C) scanners and writers.
D) scanners and servers.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
34
Which code fragment creates a server running at port 6666 and sends one line of text, "Hello from earth" over and over to any machine that connects to the server.

A) ServerSocket ss = new ServerSocket(6666);
Socket sock = ss.accept();
While (true)
{
PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)println("Hello from earth");
Pw)flush();
Pw)close();
}
B) ServerSocket ss = new ServerSocket(6666);
While (true)
{
PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)println("Hello from earth");
Socket sock = ss.accept();
}
C) ServerSocket ss = new ServerSocket(6666);
While (true)
{
Socket sock = ss.accept();
PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)println("Hello from earth");
Pw)flush();
Pw)close();
}
D) Socket sock = ss.accept();
While (true)
{
ServerSocket ss = new ServerSocket(6666);
PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)println("Hello from earth");
Pw)flush();
Pw)close();
}
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
35
A ______ is an object that encapsulates a TCP connection.

A) packet
B) socket
C) client
D) server
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
36
Suppose that sock refers to a TCP socket connected to another machine, and in is aScanner. Which code sends the string "Who is there?" to the other machine, receives the return answer, and then prints it?

A) PrintWriter pw = new PrintWriter(sock.getOutputStream().println("Who is there?"));
InputStream instream = sock.getInputStream();
Scanner in = new Scanner(instream);
System.out.println(in.nextLine());
B) PrintWriter pw = new PrintWriter(sock.getInputStream());
Pw)println("Who is there?");
Pw)flush();
InputStream instream = sock.getInputStream();
Scanner in = new Scanner(instream);
System.out.println(in.nextLine());
C) PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)flush("Who is there");
InputStream instream = sock.getInputStream();
Scanner in = new Scanner(instream);
System.out.println(in.nextLine());
D) PrintWriter pw = new PrintWriter(sock.getOutputStream());
Pw)println("Who is there?");
Pw)flush();
InputStream instream = sock.getInputStream();
Scanner in = new Scanner(instream);
System.out.println(in.nextLine());
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
37
Which code creates a server socket on port PORT_NUMBER and listens for a connection?

A) ServerSocket ss = new ServerSocket(PORT_NUMBER);
Socket sock = ss.accept();
B) Socket ss = new Server(PORT_NUMBER);
ServerSocket sock = ss.accept();
C) ServerSocket ss = new ServerSocket();
Socket sock = ss.accept();
D) ServerSocket ss = new ServerSocket(PORT_NUMBER);
Socket sock = new Socket(ss.accept());
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
38
Show the command line that establishes a telnet connection with echo server (port 7) running on the computer www.eecs.utoledo.edu.

A) telnet 7 www.eecs.utoledo.edu
B) connect www.eecs.utoledo.edu 7
C) telnet www.eecs.utoledo.edu 7
D) tcp www.eecs.utoledo.edu 7
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
39
Which of the following statements is correct?

A) HTML is a protocol that describes the command set for web server requests.
B) Web servers know how to display HTML documents.
C) Web servers know how to issue HTTP commands.
D) The Telnet program is not a browser and does not understand HTML tags.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
40
The ____ is used to download received messages from e-mail servers.

A) SMTP
B) TCP
C) IP
D) POP
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
41
To retrieve the response code and message from an HttpURLConnection object, you need __________________.

A) to use the getInputStream() method.
B) to use the getURLConnection() method.
C) to use the getResponseCode() and getResponseMessage() methods.
D) to use the getCodeResponse() method.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
42
When you communicate with a mail server, you ___________, or you can learn how to use Java mail extensions.

A) can write programs that send GET and POP commands.
B) can write programs that send SMTP and POST commands.
C) can write programs that send GET and POST commands
D) can write programs that send SMTP and POP commands.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
43
The HTTP response code 200 means _______________.

A) the response is successful.
B) the page is found successfully.
C) the page was not found.
D) the connection is lost.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
44
To kill a server that was started in a shell window, ________.

A) press Ctrl+C
B) press Ctrl+Z
C) call the kill method
D) servers don't stop.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
45
When a web page is loaded, the browser stores it in a ________ directory.

A) root
B) my document
C) cashe
D) cache
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
46
The Java library provides a _________ class that can take care of the socket connection to a web server.

A) SocketConnection
B) ServerConnection
C) ClientConnection
D) URLConnection
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
47
Buffering the characters means:

A) characters are immediately sent to their destination.
B) characters are not placed in an array.
C) characters are not immediately sent to their destination.
D) characters are being flushed.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
48
To retrieve the response code from a URLConnection object, you need __________________.

A) to cast the HttpURLConnection object to the URLConnect subclass.
B) to cast the URLConnection object to the HttpURLConnect subclass.
C) to use the getInputStream() method.
D) to use the getCodeResponse() method.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
49
A print writer buffers the characters that you send to it. To make sure that the server gets a complete request at a time, you need to ________ the buffer.

A) print
B) send
C) scan
D) flush
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
50
The _________ class makes it easy to fetch a file from a web server.

A) FileConnection
B) ServerConnection
C) ClientConnection
D) URLConnection
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
51
A successful response has status _______________.

A) 200 OK.
B) 404 OK.
C) 0 OK.
D) 100 OK.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
52
A thread dies ______________

A) when the client quits or disconnects.
B) when the run method exits.
C) when the client quits or disconnects and/or when the run method exits.
D) the thread runs forever in the background.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
53
In a communication protocol, can the sender indicate how many bytes are contained in the request?

A) Yes, the web server does that at the end of the GET request.
B) Yes, the web browser does that in POST request.
C) Yes, the web browser does that at the end of the HTTP header.
D) No, the sender can't indicate how many bytes are contained in the request.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
54
When you communicate with a web server to obtain data, you have two choices:
I) You can make a socket connection and send GET and POST commands.
II) You can make a server connection and send GET and POST commands.
III) You can use the URLConnection class and have it issue the commands on your behalf.
IV) You can use the URL class and have it issue the commands on your behalf.

A) I and II.
B) II and III.
C) III and I.
D) IV and II.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
55
The following command:
Java pgmName hostname /
Lets you retrieve any item from a web server. The slash means:

A) the port of the hostname.
B) the root page of the web server.
C) the character to end the command.
D) the item name needs to be retrieved.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
56
A page not found has status code _______________.

A) 200 not found.
B) 404 not found.
C) 0 not found.
D) 100 not found.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
57
The ______ method empties the buffer and forwards all waiting characters to the destination.

A) print
B) send
C) scan
D) flush
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
58
The ______ method of the ServerSocket class waits for a client connection.

A) wait()
B) connect()
C) accept()
D) next()
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
59
The HTTP response code 404 means _______________.

A) the response is successful.
B) the page is found successfully.
C) the page was not found.
D) the connection is lost.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
60
For the server to execute the run method in a separate thread for each client, the application program needs to implement the _____ interface.

A) Running
B) Runtime
C) Server
D) Runnable
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
61
The HTTP command PUT ____________.

A) returns the requested item.
B) stores an item on the client.
C) stores an item on the server.
D) supplies input to a client-side command.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
62
The HTTP command POST ____________.

A) returns the requested item.
B) supplies input to a server-side command and returns the result.
C) requests input from the server-side command.
D) supplies input to a client-side command.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
63
You should use a ______ to connect to a web server.

A) Packet
B) Socket
C) URLConnection
D) HttpURLConnection
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
64
The HTTP command GET ____________.

A) returns the requested item.
B) supplies input to a server-side command.
C) requests input from the server-side command.
D) supplies input to a client-side command.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
65
Sending commands over a socket connection is ___________.

A) a high-level approach.
B) a medium-level approach.
C) a low-level approach.
D) a complex approach.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
66
You should not use a ______ to connect to a web server.

A) Packet
B) Socket
C) URLConnection
D) HttpURLConnection
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
67
The HTTP command OPTIONS ____________.

A) requests the item's communication options.
B) returns the item's options from the client.
C) returns the item's option on the server.
D) changes the options of the item.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
68
What does TCP/IP stand for?

A) Transmission Control and Internet Protocol.
B) Transmission Control Protocol and Internet Protocol.
C) Transmission Protocol and Internet Protocol.
D) Transmission Control Protocol over Internet Protocol.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
69
What does the following if statement do?
If (code == HttpURLConnetion.HTTP_OK)

A) It checks if the code is 200.
B) It checks if the code is 404.
C) It checks if the connection is still connected.
D) It checks if there is HTTP.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
70
The HTTP command HEAD ____________.

A) stores the header information of an item on the server.
B) deletes the header information of an item from the server.
C) requests the header information of an item.
D) traces the header information of an item.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
71
To open a connection, which of the following statements can you use?

A) URL u = new URL("http://www.yahoo.com");
URLConnection conn = u.open();
B) URL u = new URL("http://www.yahoo.com");
URLConnection conn = new URLConnection(u);
C) URL u = new URL("http://www.yahoo.com");
URLConnection conn = u.openURLConnection();
D) URL u = new URL("http://www.yahoo.com");
URLConnection conn = u.openConnection();
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
72
To close a connection, which of the following statements can you use?

A) URL u = new URL("http://www.yahoo.com");
URLConnection conn = u.close();
B) URL u = new URL(str);
URLConnection conn = new URLConnection(u);
C) URL u = new URL(str);
URLConnection conn = u.closeURLConnection();
D) There is no need to close the connection.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
73
The HTTP command TRACE ____________.

A) traces the requested item.
B) traces an item from the client.
C) traces an item on the server.
D) traces the server communication.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
74
The HTTP command DELETE ____________.

A) deletes two items, an item on the server and an item from the client.
B) deletes an item from the client.
C) deletes an item on the server.
D) deletes input from a client-side command.
Unlock Deck
Unlock for access to all 74 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 74 flashcards in this deck.