JSP Servlets   «Prev  Next»

Applets Servlets Interaction [Java] - Quiz

 
1. The applet in this module sent a GET request to the server. Why was GET chosen over POST?
Please select the best answer.
  A. Applets cannot send POST requests to servlets
  B. A GET request is simpler for the servlet to handle than a POST
  C. A GET request is simpler for the applet to send than a POST
  D. The response to a GET is simpler for the applet to process than the response to a POST

2. To send a GET request to a servlet, first you create a URL to the servlet and then:
Please select the best answer.
  A. The connection is made when the URL is constructed
  B. Call the openConnection() method of the URL
  C. Call the doGet() method of the servlet directly
  D. Call the openConnection method of the URL and then the doGet() method of the servlet directly

3. The servlet’s doGet() has to be changed because it is being called by an applet. What needs to change?
Please select the best answer.
  A. The response object is an HttpAppletResponse instead of an HttpServletResponse
  B. The HTML in the response must include an APPLET tag
  C. The response will not contain any HTML
  D. The response is limited to 256 characters

4. When a servlet needs to extract a parameter from the GET request, and the request came from an applet:
Please select the best answer.
  A. The servlet code must first translate the parameters to GET form
  B. The servlet code must search the parameter string for the question mark
  C. The servlet code must send a request back to the applet for the parameters
  D. The servlet code is the same as when the request came from a form

5. Rather than reading the servlet response a byte at a time, our sample code reads the entire line into a String by calling readLine(). Of which class is this a method?
Please select the best answer.
  A. InputStream
  B. BufferedReade
  C. InputStreamReader
  D. BufferedInputStream

6. To get an InputStream from which to read the servlet response, you must call a method of the URLConnection class. Which method do you call?
Please select the best answer.
  A. getInputStream()
  B. openInputStream()
  C. getResponseStream()
  D. openResponseStream()


Score =
Correct answers: