Sun Java Solaris Communities My SDN Account Join SDN
 
Quizzes

JavaServer Pages Fundamentals Quiz

 

Quizzes Index


Fundamentals Quiz

Duke This JavaServer Pages (JSP) Fundamentals Quiz offers a way to test the knowledge you learned about the JSP API from the JSP Fundamentals Short Course. For additional help on JSP, be sure to check out the JSP FAQ at jGuru.

    1. When a JSP page is compiled, what is it turned into?

     A. Applet
     B. Servlet
     C. Application
     D. Mailet

    2. Which of the following is not a standard method called as part of the JSP life cycle?

     A. jspInit()
     B. jspService()
     C. _jspService()
     D. jspDestroy()

    3. If you want to override a JSP file's initialization method, within what type of tags must you declare the method?

     A. <@ @>
     B. <%@ %>
     C. <% %>
     D. <%! %>

    4. Which of the following can not be used as the scope when using a JavaBean with JSP?

     A. application
     B. session
     C. request
     D. response
     E. page

    5. The implicit JSP objects like request, response, and out are only visible in the _jspService() method.

     A. True
     B. False

    6. What is the key difference between using a <jsp:forward> and HttpServletResponse.sendRedirect()?

     A. forward executes on the client while sendRedirect() executes on the server.
     B. forward executes on the server while sendRedirect() executes on the client.
     C. The two methods perform identically.

    7. Which of the following statements makes your compiled JSP page implement the SingleThreadModel interface?

     A. <%@ page isThreadSafe="false" %>
     B. <%@ page isThreadSafe="true" %>

    8. Of the following four valid comment styles that can be used within JSP pages, which can the end user see?

     A.
    <%--
      My comments
      <% out.println("Hello World"); %>
    --%> 
     B.
    <!-- (c)2000 jGuru.com --> 
     C.
    <% // For Loop 
      for (int i=1; i<=4; i++) {
    %> 
      <H<%=i%>>Hello</H<%=i%>>
    <% } %> 
    
     D.
    <% /** yet another comment */ 
      JavaDoc Rules
    %> 

    9. How can a servlet call a JSP error page?

     A. This capability is not supported.
     B. When the servlet throws the exception, it will automatically be caught by the calling JSP page.
     C. The servlet needs to forward the request to the specific error page URL. The exception is passed along as an attribute named "javax.servlet.jsp.jspException".
     D. The servlet needs to redirect the response to the specific error page, saving the exception off in a cookie.

    10. When using a JavaBean to get all the parameters from a form, what must the property be set to (??? in the following code) for automatic initialization?

    <jsp:useBean id="fBean" class="govi.FormBean" scope="request"/> 
    <jsp:setProperty name="fBean" property="???" /> 
    <jsp:forward page="/servlet/JSP2Servlet" /> 
    
     A. *
     B. all
     C. @
     D. =