Java Servlets   «Prev  Next»

Java Server Side - Quiz

Each question is worth one point. Select the best answer for each question.
 
1. A Web servlet is:
Please select the best answer.
  A. An applet that has been installed on a Web server
  B. Any class that extends java.servlet.Servlet
  C. Any class that extends javax.servlet.http.HttpServlet
  D. Any class that implements a doGet() method


2. A big disadvantage of executing a program on the Web server through a server side include is:
Please select the best answer.
  A. A poorly written program can be insecure, or even crash the Web server
  B. Such programs cannot be written in Java
  C. The look and feel of your Web site must be maintained within the program’s code
  D. Server side include execs cannot access a database


3. ASP pages mix raw HTML with little snippets of code that are executed on the server, with the resulting output sent back to the browser. These snippets can be written in:
Please select the best answer.
  A. Any language at all
  B. Any scripting language, such as Perl, Javascript, or VBscript
  C. Either Javascript or VBscript
  D. VBscript only.

4. If your user needs to run a CGI program or script, the Web browser will:
Please select the best answer.
  A. Send a GET request to the server, using the script name as the requested file name
  B. Send a CGI request to the server, using the script name as the requested file name
  C. Send a CGI request to the server, which can automatically determine the script name
  D. Send a script request to the server, using the script name as the requested file name

5. What do CGI, SSI, ASP, and servlets have in common?
Please select the best answer.
  A. They can execute on the client or the server for maximum flexibility.
  B. They execute on the server, and interact with other server programs.
  C. They are easy and quick to learn
  D. They are efficient and scale well as the number of visitors to your site increases.


6. Because servlets are written in Java, a number of powerful features are available from within your code.
Which of the following is not simplified by using Java Web servlets?
Please select the best answer.
  A. Memory management
  B. Threading
  C. Database access
  D. User interaction

7. A Java Web servlet is a class that extends javax.servlet.http.HttpServlet. One of the important methods of the superclass that your servlet class should override is:
Please select the best answer.
  A. Get()
  B. doGet()
  C. handleGet()
  D. DoGet()

8. If more than one user wants to run a servlet on your system:
Please select the best answer.
  A. The second one will receive an error message
  B. The second one will have to wait until the first one is completely finished
  C. The system will start a second copy of the servlet and each user’s request will execute in a different copy
  D. The system will use threading to let both requests share a single copy of the servlet in memory.

9. If you write your servlet spectacularly badly, so that it divides by zero, or in some other way encounters a fatal error:
Please select the best answer.
  A. The Web server will be locked up until someone clears your servlet
  B. The Web server will crash and have to be rebooted
  C. No serious consequences will occur
  D. The user will receive an error message from the web server explaining the exception that was thrown

Your score is 0.0