WEB开发网
开发学院WEB开发Jsp jsp在线考试系统-htm文件 阅读

jsp在线考试系统-htm文件

 2000-12-11 16:37:59 来源:WEB开发网   
核心提示:一个在线考试系统,测试你的jsp知识,jsp在线考试系统-htm文件,代码不是特别多,所以不加注释了(http://jspbbs.yeah.net)index.jsp<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0&
一个在线考试系统,测试你的jsp知识,代码不是特别多,所以不加注释了(http://jspbbs.yeah.net)

index.jsp

<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<DIV ALIGN="RIGHT">
<FONT SIZE="-1"><A HREF="/developer/Quizzes/index.html">Quizzes
Index</A></FONT></DIV>
<H2 ALIGN="RIGHT"><FONT COLOR="#FFFFFFF">JSP PRofessional, Chapter 12
Quiz</FONT></H2>
<H4 ALIGN="RIGHT"><EM>by Dan Malks</EM></H4>

<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR><TD>
<IMG SRC=http://www.cncms.com/"penduke.gif" WIDTH="164" HEIGHT="115" ALIGN=left ALT="Duke">
</TD><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
The <I><A
HREF="/developer/Books/jsp/index.html">JSP Professional: Chapter 12, JSP
Archictecture</A></I> Test your knowledge on the differences between servlets
and JSP, Factor Forward-Factor Back, page-centric verses the dispatcher
approach, and more.
</FONT></TD></TR>
</TABLE>

<HR>

<!-- Form calls the answer.jsp, which invokes the QuizResponses bean -->
<FORM METHOD="POST" ACTION="answer.jsp">

<OL>
<!-- Question 1 -->

<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Choose the statement
that best describes the relationship between javaServer
Pages<SUP><FONT SIZE="-2">TM</FONT></SUP> (JSP<SUP><FONT SIZE="-2">TM</FONT></SUP>)
and servlets: </FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="one"
TYPE="RADIO" VALUE="A">  A.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Servlets are built on JSP semantics and all servlets are compiled to JSP
pages for runtime usage<BR></FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="one"
TYPE="RADIO" VALUE="B">  B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> JSP and servlets are
unrelated technologies</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="one"
TYPE="RADIO" VALUE="C">  C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Servlets and JSP are
competing technologies for handling web requests. Servlets are being superceded
by JSP, which is preferred. The two technologies are not useful in combination.
</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="one"
TYPE="RADIO" VALUE="D">  D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> JSPs are built on
servlet semantics and all JSPs are compiled to servlets for runtime usage
</FONT></TD></TR>
</TABLE>

<P>
<!-- Question 2 -->
<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif">What is a benefit of
using JavaBeans<SUP><FONT SIZE="-2">TM</FONT></SUP> to separate business logic
from presentation markup within the JSP environment? </FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="two"
TYPE="RADIO" VALUE="A">  A.</FONT></TD>
<TD>
<FONT FACE="Verdana, Arial, Helvetica, sans-serif"> It allows the JSP to
access middleware </FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="two"
TYPE="RADIO" VALUE="B">  B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">It creates a cleaner
role separation between the web-production team and the software development
team, so that the web-production team can focus on presentation markup, while
the software team can focus on building reusable software components for helping
to generate dynamic displays </FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="two"
TYPE="RADIO" VALUE="C">  C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">It provides a dynamic
markup environment, such that JavaBeans are integrated seamlessly with the
template presentation content, in order to create the dynamic display for the
client
</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="two"
TYPE="RADIO" VALUE="D">  D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">It provides the
developer with full access to the Java<SUP><FONT SIZE="-2">TM</FONT></SUP> 2
Platform Enterprise Edition (J2EE<SUP><FONT SIZE="-2">TM</FONT></SUP>),
which is unavailable from outside the JavaBean environment </FONT></TD></TR>
</TABLE>
<P>
<!-- Question 3 -->

<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Why use the
<CODE>RequestDispatcher</CODE> to forward a request to another resource,
instead of doing a <CODE>sendRedirect</CODE>? </FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="three"
TYPE="RADIO" VALUE="A">  A.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Redirects are no
longer supported in the current servlet API</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="three"
TYPE="RADIO" VALUE="B">  B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Redirects are not a
cross-platform portable mechanism</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="three"
TYPE="RADIO" VALUE="C">  C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> The <CODE>RequestDispatcher</CODE>
does not use the reflection API</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="three"
TYPE="RADIO" VALUE="D">  D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> The
<CODE>RequestDispatcher</CODE> does not require a round trip to the client, and
thus is more efficient and allows the server to maintain request
state</FONT></TD></TR>
</TABLE>

<P>
<!-- Question 4 -->

<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif">What alternatives exist
to embedding Java code directly within the HTML markup of your JSP page?</FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="four"
TYPE="RADIO" VALUE="A">  A.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Moving the code into
your session manager</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="four"
TYPE="RADIO" VALUE="B">  B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Moving the code into
sciptlets</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="four"
TYPE="RADIO" VALUE="C">  C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Moving the code into
JavaBeans and servlets</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="four"
TYPE="RADIO" VALUE="D">  D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Moving the code into a
transaction manager</FONT></TD></TR>
</TABLE>
<P>
<!-- Question 5 -->

<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> What type of scriptlet
code is better-suited to being <I>factored forward</I> into a servlet?
</FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="five"
TYPE="RADIO" VALUE="A">  A.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Code that deals
with logic that is common across requests</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="five"
TYPE="RADIO" VALUE="B">  B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Code that deals
with logic that is vendor specific</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="five"
TYPE="RADIO" VALUE="C">  C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Code that deals
with logic that relates to database access</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="five"
TYPE="RADIO" VALUE="D">  D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Code that deals
with logic that relates to client scope</FONT></TD></TR>
</TABLE>

<P>
<!-- Question 6 -->

<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Choose the statement that
best describes how to connect JSP pages and EJBs</FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="six"
TYPE="RADIO" VALUE="A">  A.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Lookup the EJBs from
within a JSP, but use the EJBs from within a basic JavaBean</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="six"
TYPE="RADIO" VALUE="B">  B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Lookup and use the EJBs
from a separate business delegate. The JavaBeans that work with JSP pages are
clients to these business delegates and know nothing about EJB
specifics</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="six"
TYPE="RADIO" VALUE="C">  C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Lookup and use the
EJBs from within a JSP page, but only as remote references</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="six"
TYPE="RADIO" VALUE="D">  D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Lookup the EJBs from
within a servlet, delegating usage to specific JSP pages</FONT></TD></TR>
</TABLE>

<P>
<!-- Question 7 -->

<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Are custom tags
available in JSP 1.0? If not, how else might you implement iteration from
within a JSP? </FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="seven"
TYPE="RADIO" VALUE="A">  A.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Yes, but the only tags
available relate to database access</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="seven"
TYPE="RADIO" VALUE="B">  B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> No. To iterate over a
collection of values, one must use scriptlet code</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="seven"
TYPE="RADIO" VALUE="C">  C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> No, but there is a
standard <iterate> tag that may be used</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="seven"
TYPE="RADIO" VALUE="D">  D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> Yes, but custom tags
will not help developers create tags for use in iterating over a
collection</FONT></TD></TR>
</TABLE>

<P>
<!-- Question 8 -->

<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> What is the initial
contact point for handling a web request in a <I>Page-Centric</I> architecture?
</FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="eight"
TYPE="RADIO" VALUE= "A">  A.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> A JSP
page</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="eight"
TYPE="RADIO" VALUE= "B">  B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> A
JavaBean</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="eight"
TYPE="RADIO" VALUE= "C">  C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> A
servlet</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="eight"
TYPE="RADIO" VALUE= "D">  D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> A session
manager</FONT></TD></TR>
</TABLE>

<P>
<!-- Question 9 -->

<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif">What is the difference
between doing an <I>include</I> or a <I>forward</I> with a
<CODE>RequestDispatcher</CODE>?</FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="nine"
TYPE="RADIO" VALUE="A">  A.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> The forward method
transfers control to the designated resource, while the include method invokes
the designated resource, substitutes its output dynamically in the display, and
returns control to the calling page.</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="nine"
TYPE="RADIO" VALUE="B">  B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> The two methods
provide the same functionality, but with different levels of
persistence</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="nine"
TYPE="RADIO" VALUE="C">  C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> The forward method is
deprecated as of JSP 1.1 and the include method should be used in order to
substitue portions of a dynamic display at runtime</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="nine"
TYPE="RADIO" VALUE="D">  D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> The include method
transfers control to a dynamic resource, while the forward method allows for
dynamic substitution of another JPS pages output, returning control to the
calling resource</FONT></TD></TR>
</TABLE>

<P>
<!-- Question 10 -->
<LI><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> What line of code below
might be combined in the same JSP page with a validation guard (for
example,<code> <% bean.validationGuard(); %></code> ), in order to create
an alternate flow of control for scenarios in which exceptions arise. The
<code>validationGaurd</code> method might throw an exception, which should cause
the flow of control to continue in another user-defined page (assume JSP
1.0)</FONT>
<BR>
<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0">
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="ten"
TYPE="RADIO" VALUE="A">  A.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> <CODE><jsp:error
page="errorPage.jsp" guard="true" /></CODE></FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="ten"
TYPE="RADIO" VALUE="B">  B.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> <CODE><%@ page
language="java" buffer="8k" %></CODE>
</FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="ten"
TYPE="RADIO" VALUE="C">  C.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> <CODE><jsp:useBean
id="bean" class="examples.Bean" scope="request" /></CODE></FONT></TD></TR>
<TR><TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><INPUT NAME="ten"
TYPE="RADIO" VALUE="D">  D.</FONT></TD>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><CODE> <%@ page
language="java" errorPage="errorPage.jsp" buffer="8k"
%></CODE></FONT></TD></TR>
</TABLE>

</OL>

<P>
<DIV ALIGN="CENTER">
<INPUT TYPE="SUBMIT" VALUE="Submit">
<INPUT TYPE="RESET">
</DIV>
</FORM>

</FONT>
</TD>
</TR>
</TABLE>

<P>

Tags:jsp 在线考试

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接