Professional Documents
Culture Documents
22. Which method is used to close a server socket in Java? A) close() B) disconnect() C)
shutdown() D) end()
23. What is the role of the ServerSocket class in Java socket programming? A) To create a client-
side socket. B) To represent a server-side socket that listens for incoming connections. C) To
perform low-level I/O operations. D) To handle datagram-based communication.
24. Which exception is thrown when there is an error during socket communication in Java? A)
IOException B) SocketException C) NetworkException D) ProtocolException
25. How do you retrieve the output stream associated with a socket in Java? A)
socket.getOutput() B) socket.getOutputStream() C) socket.getOutputWriter() D)
socket.getSenderStream()
26.