Multiple Choice
Which code fragment creates a server running at port 6666 and sends one line of text, "Hello from earth" over and over to any machine that connects to the server.
A) ServerSocket ss = new ServerSocket(6666) ;
Socket sock = ss.accept() ;
While (true)
{
PrintWriter pw = new PrintWriter(sock.getOutputStream() ) ;
Pw) println("Hello from earth") ;
Pw) flush() ;
Pw) close() ;
}
B) ServerSocket ss = new ServerSocket(6666) ;
While (true)
{
PrintWriter pw = new PrintWriter(sock.getOutputStream() ) ;
Pw) println("Hello from earth") ;
Socket sock = ss.accept() ;
}
C) ServerSocket ss = new ServerSocket(6666) ;
While (true)
{
Socket sock = ss.accept() ;
PrintWriter pw = new PrintWriter(sock.getOutputStream() ) ;
Pw) println("Hello from earth") ;
Pw) flush() ;
Pw) close() ;
}
D) Socket sock = ss.accept() ;
While (true)
{
ServerSocket ss = new ServerSocket(6666) ;
PrintWriter pw = new PrintWriter(sock.getOutputStream() ) ;
Pw) println("Hello from earth") ;
Pw) flush() ;
Pw) close() ;
}
Correct Answer:

Verified
Correct Answer:
Verified
Q17: The _ has one function, to attempt
Q25: To retrieve the response code and message
Q32: What does the acronym POP stand for?<br>A)Point
Q35: To retrieve the response code from a
Q39: For the server to execute the run
Q42: _ is the protocol that defines communication
Q47: The HTTP command GET _.<br>A)returns the requested
Q54: The HTTP command DELETE _.<br>A)deletes two items,
Q60: In a communication protocol, can the sender
Q74: _ has no provision for retrying an