Introduction to Java Programming, Seventh Edition, Y. Daniel Liang
Chapter 40 JavaServer Pages
Section 40.2 A Simple JSP Page
1
A JSP file ends with __________.
A.
.java extension
B.
.html extension
C.
.shtml extension
D.
.jsp extension
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 40.3 How Is a JSP Page Processed?
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 40.4 JSP Scripting Constructs
4
_______________ is a JSP expression.
A.
<%= i %>
B.
<%= Math.pow(2, 3) %>
C.
<%= new Date().toString() %>
D.
<% for (int i = 0; i <= 10; i++) { %>
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 --%>
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 -->
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 40.5 Predefined Variables
8
Which of the following is a JSP implicit object?
A.
request
B.
response
C.
out
D.
session
E.
application
9
The JSP explicit object out is actually _________.
A.
response.getOutputStream()
B.
response.getWriter()
C.
request.getOutputStream()
D.
request.getWriter()
E.
application
Section 40.6 JSP Directives
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
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 40.7 Using JavaBeans in JSP
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.