Introduction to Java Programming, Sixth Edition, Y. Daniel Liang
Chapter 35 Java ServerPages
Section 35.2 A Simple JSP Page
1
JSP files end 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 35.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 35.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 35.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 35.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 35.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.