Chap4 Networking 2
Chap4 Networking 2
26. Which of these is a protocol for breaking and 32. The client requests a connection to a server
sending packets to an address across a using the following statement:
network? (a) Socket s = new Socket(ServerName, port);
(a) TCIP/IP (b) Socket s = serverSocket.accept();
(b) DNS (c) Socket s = serverSocket.getSocket();
(c) Socket (d) Socket s = new Socket(ServerName);
(d) Proxy Server ANSWER: A
ANSWER: A
33. The server listens for a connection request
27. Which of these is a full form of DNS? from a client using the following statement:
(a) Data Network Service (a) Socket s = new Socket(ServerName, port);
(b) Data Name Service (b) Socket s = serverSocket.accept();
(c) Domain Network Service (c) Socket s = serverSocket.getSocket();
(d) Domain Name Service (d) Socket s = new Socket(ServerName);
ANSWER: D ANSWER: B
28. Which of these class is used to encapsulate IP 34. When a client requests connection to a server
address and DNS? that has not yet started, _______
(a) DatagramPacket (a) java.net.BindException occurs.
(b) URL (b) java.net.ConnectionException occurs.
(c) InetAddress (c) the client is blocked until the server is
(d) ContentHandler started
ANSWER: C (d) the client encounters a fatal error and must
be terminated.
29. How many bits are in a single IP address? ANSWER: B
(a) 8
(b) 16 35. To create an InputStream on a socket s, you
(c) 32 use ______
(d) 64 (a) InputStream in = new InputStream(s);
ANSWER: C (b) InputStream in = s.getInputStream();
(c) InputStream in = s.obtainInputStream();
30. When creating a server on a port that is (d) InputStream in = s.getStream();
already in use, _______ ANSWER: B
(a) java.net.BindException occurs.
(b) the server is created with no problems. 36. _________ models an IP address, which can be
(c) the server is blocked until the port is used to find the host name and IP address of
available. the client.
(d) the server encounters a fatal error and must (a) TheServerSocket class
be terminated. (b) The Socket class
ANSWER: A (c) ThelnetAddress class
(d) The Connection interface
31. When creating a client on a server port that is ANSWER: C
already in use, _____
(a) the client can connect to the server 37. To connect to a server running on the same
regardless of whether the port is in use. machine with the client, which of the
(b) java.net.BindException occurs. following can be used for the hostname?
(a) “localhost" ANSWER: B
(b) “127.0.0.1"
(c) InetAddress.getLocalHost() 42. To obtain an ObjectOutputStream from a
(d) All of above socket, use
ANSWER: D (a) socket.getOutputStream()
(b) socket.getObjectStream()
38. The _______ method in the InetAddress class (c) new
returns the IP address. ObjectOutputStream(socket.getOutputStream()
(a) getIP() )
(b) getIPAddress() (d) socket.objectOutputStream()
(c) getHostAddress() ANSWER: C
(d) getAddress()
ANSWER: C 43. To obtain an ObjectInputStream from a
socket, use
39. A ServerSocket can connect to ______ clients. (a) socket.getInputStream()
(a) one (b) socket.getObjectStream()
(b) two (c) socket.getObjectInputStream))
(c) ten (d) new
(d) an unlimited number of ObjectInputStream(socket.getInputStream())
ANSWER: D ANSWER: D