Introduction to Java Programming, Includes Data Structures, Eleventh Edition, Y. Daniel Liang

This quiz is for students to practice. A large number of additional quiz is available for instructors using Quiz Generator from the Instructor's Resource Website. Videos for Java, Python, and C++ can be found at https://yongdanielliang.github.io/revelvideos.html.

Chapter 38 JavaServer Pages


Section 38.2 A Simple JSP Page
38.1  A JSP file ends with __________.
A. .java extension
B. .html extension
C. .shtml extension
D. .jsp extension

38.2  You can run JSP from _____________.
A. any Web server
B. any JVM
C. any Web server that supports Java servlet and JSP
D. any Web browser

Section 38.3 How Is a JSP Page Processed?
38.3  Which of the following statements are true?
A. JSP is translated into Java servlet by a Web server when a JSP is called.
B. JSP is translated into HTML by a Web server when a JSP is called.
C. JSP is translated into XML by a Web server when a JSP is called.
D. You can embed Java code in JSP.

Section 38.4 JSP Scripting Constructs
38.4  _______________ is a JSP expression.
A. <%= i %>
B. <%= Math.pow(2, 3) %>
C. <%= new Date().toString() %>
D. <% for (int i = 0; i <= 10; i++) { %>

38.5  _______________ is a JSP scriptlet.
A. <%= i %>
B. <%= Math.pow(2, 3) %>
C. <%! private long computeFactorial(int n) { if (n == 0)return 1;else return n * computeFactorial(n - 1); } %>
D. <% for (int i = 0; i <= 10; i++) { %>
E. <!-- HTML Comment --%>

38.6  _______________ is a JSP declaration.
A. <%= i %>
B. <%= Math.pow(2, 3) %>
C. <%! private long computeFactorial(int n) { if (n == 0) return 1; else return n * computeFactorial(n - 1); } %>
D. <% for (int i = 0; i <= 10; i++) { %>
E. <!-- HTML Comment -->

38.7  _______________ is a JSP comment.
A. <%= i %>
B. <%-- i --%>
C. <%! private long computeFactorial(int n) { if (n == 0) return 1; else return n * computeFactorial(n - 1); } %>
D. <% for (int i = 0; i <= 10; i++) { %>
E. <!-- HTML Comment -->

Section 38.5 Predefined Variables
38.8  Which of the following is a JSP implicit object?
A. request
B. response
C. out
D. session
E. application

38.9  The JSP explicit object out is actually _________.
A. response.getOutputStream()
B. response.getWriter()
C. request.getOutputStream()
D. request.getWriter()
E. application

Section 38.6 JSP Directives
38.10  ________ is a statement that gives the JSP engine information about the JSP page.
A. A JSP implicit object
B. A JSP scriptlet
C. A JSP expression
D. A JSP directive

38.11  The ________ directive lets you provide information for the page, such as importing classes and setting up content type. The page directive can appear anywhere in the JSP file.
A. page
B. include
C. tablib
D. import

Section 38.7 Using JavaBeans in JSP
38.12  A class is a JavaBeans component if ____________________.
A. it is a public class
B. it has a public constructor with no arguments
C. it is serializable.