20165320 The ninth week after-class test

topic

1. The domain name resolution server (ARP) is responsible for converting domain names into IP addresses to connect with hosts. my answer (B)

A . true

B . false

2. The following statement about the URL class, the correct one is my answer (BD)

A. The URL class itself can encode or decode URL parts according to the escape mechanism defined in RFC2396.

B. The URL class inherits from java.lang.Object and implements the Serializable interface.

C. public String getHost() returns the MAC address of the host.

D. The constructor URL(String protocol, String host, int port, String file, URLStreamHandler handler) can create a URL object according to the specified protocol, host, port number, file and handler.

3. A URL object usually contains the most basic three parts of information: protocol, address and port number. my answer (B)

A . true

B . false

4. The following statement about the InetAddress class, the correct one is my answer (ACD)

A. Subclasses of InetAddress include Inet4Address, Inet6Address.

B. The return values ​​of getByName(String host) and getHostName() are of type InetAddress.

C. An IP address is a 32-bit or 128-bit unsigned number used by IP, which is a low-level protocol on which both the UDP and TCP protocols are built.
D. public String toString() converts this IP address to a String. The returned string has the form: hostname/literal IP address.

5. The following statement is wrong is my answer (C)

A. An IP address identifies a computer on the Internet, and a port number identifies a process on a server.

B. The port number is an integer between 1-65535.

C. The Secure Shell (SSH) service occupies port 21, and the Hypertext Transfer Protocol (HTTP) for the World Wide Web (WWW) service occupies port 80.

D. Ports 0-1023 are occupied by predefined service traffic.

6. Which of the following statements is correct is my answer (AC)

A. The client uses the Socket class to establish the socket object responsible for connecting to the server.

B. Socket(InetAddress address, int port, InetAddress localAddr, int localPort) creates a socket and connects it to the specified remote port on the specified remote address.

C. The return value of getInetAddress() is the socket connection address of type String.

D. public int getPort() returns the local port to which this socket is bound.

7. The constructor of ServerSocket public ServerSocket() creates an unbound server socket. If an IO error occurs while opening the socket, an IOException is thrown. my answer (A)

A . true

B . false

8. Which of the following statements about the ServerSocket class is correct is my answer (BD)

A. The accept() method blocks until a connection comes in. The return value is of type boolean.

B. The public String toString() method returns the implementation address and implementation port of this socket as String.

C . setSoTimeout(int timeout) Enables/disables SO_TIMEOUT by specifying a timeout value in seconds.

D. public boolean isBound() returns the bound state of the ServerSocket. Returns true if the ServerSocket was successfully bound to an address.

9. The following statement about TCP and UDP, which is correct is my answer (AB)

A. TCP is connection-oriented; UDP is connectionless, that is, there is no need to establish a connection before sending data.

B. The data transmitted through the TCP connection is error-free, not lost, not duplicated, and arrives in order; UDP does its best to deliver, that is, it does not guarantee reliable delivery.

C. UDP and TCP are both network layer protocols.

D. UDP has no congestion control, so congestion on the network will not slow down the sending rate of the source host.

10. If the DatagramSocket constructor cannot correctly create a DatagramSocket, which of the following exceptions will be thrown? my answer (C)

A . IOException

B . UnknownHostException

C . SocketException

D . MalformedURLException

11. Which of the following classes contains an Internet address in an object? my answer (C)

A . Applet

B . Datagramsocket

C . InetAddress

D . AppletContext

12. The following classes capable of supporting TCP/IP connections are my answer (CD)

A . InetAddress

B . Packet

C . Socket

D . ServerSocket

13. The key protocol that forms the basis of the World Wide Web is the http protocol. my answer (A)

A . true

B . false

14. Most of Java's networking classes are contained in the Java .applet package. my answer (B)

A . true

B . false

15. In order to obtain the files and other contents of the remote host, when the URL object is created, which method should be used to obtain the information? my answer (C)

A . getPort

B . getHost

C . openStream()

D . openConnection()

16. When using streaming socket programming, in order to send data to the other party, which method do you need to use? my answer (C)

A . getInetAddress()

B . getLocalPort()

C . getOutputStream()

D . getInputStream()

17. When using UDP socket communication, which class is commonly used to package the information to be sent? my answer (D)

A . String

B . DatagramSocket

C . MulticastSocket

D . DatagramPacket

18. The URL object that has been created cannot be changed. my answer (A)

A . true

B . false

19. Throws my answer when the client's server address is not found (B)

A . IOException

B . UnknownHostException

C . SocketException

D . MalformedURLException

20. When using UDP socket communication, which method is used to receive data? my answer (B)

A . read()

B . receive()

C . accept()

D . listen()

Summary of wrong questions

  1. Correct answer AB

    Resolution: The return value of getnetAddress is of type InetAddress, and public int getPort() returns the remote port to which this socket is connected.

  2. Correct answer ABD

    Analysis: UDP does not have congestion control, so network congestion will not reduce the sending rate of the source host. Both UDP and TCP are transport layer protocols.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325117167&siteId=291194637