You are on page 1of 1

1. Which of the following is true about UDP sockets in Java?

A) They provide reliable,


connection-oriented communication B) They use the Socket class for communication C) They
are connectionless and unreliable D) They use the ServerSocket class for communication

2. How do you create a server socket in Java? A) new ServerSocket() B) new Socket() C)
ServerSocket.createServer() D) Socket.openServer()

3. Which method is used to read data from a Socket in Java? A) read() B) receive() C)
readLine() D) getData()

4. Which method is used to send data through a Socket in Java? A) send() B) write() C)
sendData() D) writeBytes()

5. What is the purpose of the InputStream and OutputStream classes in socket programming?
A) To handle network connections B) To handle file I/O operations C) To read and write data
to and from a socket D) To perform encryption and decryption

You might also like