Web Design and Development MCQs with Answers
Practice important Web Design and Development MCQs with answers and explanations.
Multiple Choice Questions
Q331: What is a socket in the context of network communication?
- A: A device for network access
- B: A bi-directional communication channel
- C: A file storage unit
- D: A protocol for data transfer
View Answer
B
Q332: How many ports are available for TCP and UDP sockets combined?
- A: 64k
- B: 128k
- C: 256k
- D: 512k
View Answer
B
Q333: What does a server socket do?
- A: Processes data from clients
- B: Listens for incoming client connections
- C: Connects to other servers
- D: Sends data to clients
View Answer
B
Q334: What is the purpose of the client’s socket?
- A: To listen for incoming connections
- B: To process client requests
- C: To communicate with the server
- D: To handle data storage
View Answer
C
Q335: What Java packages are required for socket programming?
- A: java.net., java.io.
- B: java.awt., java.swing.
- C: java.util., java.math.
- D: java.lang., java.sql.
View Answer
A
Q336: Which method is used to create a server socket in Java?
- A: ServerSocket()
- B: Socket()
- C: Connect()
- D: Listen()
View Answer
A
Q337: What does the accept() method in a server socket do?
- A: Creates a new client socket
- B: Listens for client requests
- C: Establishes a connection with the server
- D: Closes the server socket
View Answer
A
Q338: How do you send a message from a client to a server in Java socket programming?
- A: Using pw.println()
- B: Using pw.readLine()
- C: Using s.getInputStream()
- D: Using s.getOutputStream()
View Answer
A
Q339: What is the purpose of the s.close() method in socket programming?
- A: To close the server socket
- B: To close the client socket
- C: To flush the output stream
- D: To terminate the connection
View Answer
B
Q340: Which of the following is a well-known port number?
- A: 21
- B: 8080
- C: 3306
- D: 9000
View Answer
A