SCWCD Mock Exam(转)

QUESTION NO: 2
Given:
1. public class ServletTest extends HttpServlet{
2. public void goGet(
3. HttpServletRequest request
4. HttpServletResponse response)
5. throws ServletException, IOException
6. {
7. String message = *In doGet*;
8.
9. }
10. }
Which two, inserted individually at line 8, will each place an entry in the servlet log file?
(Choose two)
A. log(message);
B. request.log(message);
C. getServletInfo().log(message);
D. getServletConfig().log(message);
E. getServletContext().log(message);
F. request.getSession().log(message);
--
QUESTION NO: 4

1. <%@ taglib uri='exmaple' prefix='example'%>
2. <example:aTagWithABody>
3. <%="BODY CONTENT"%>
4. </example:aTagWithABody>

If the aTagWithABody tag extends javax.servlet.jsp.tagext.TagSupport, and that tag's handler returns EVAL_BODY_BUFFERED from doStartTag, what is the result of processing the JSP code?

A. Compilation fails.
B. "BODY CONTENT" is returned in the generated response.
C. "<%=BODY CONTENT%>" is returned in the generated response.
D. Because the tag’s body content will be buffered, it will not be returned in the generated response.
--
QUESTION NO: 6
In a JSP custom tag, which method would you use to access the JSP implicit variable that references the application scope?

A. PageContext.getOut()
B. JspFactory.getPagetContext()
C. TagSupport.getValue(String)
D. PageContext.getServletContext()
--
QUESTION NO: 8
Which method is used to retrieve objects from an HTTP session?
A. getAttribute method of javax.servlet.Session
B. getAttribute method of javax.servlet.HttpSession
C. getAttribute method of javax.servlet.http.Session
D. getAttribute method of javax.servlet.http.HttpSession
昵称: swanky  时间: 2003-08-21 22:03:00

QUESTION NO: 2
Given:
1. public class ServletTest extends HttpServlet{
2. public void goGet(
3. HttpServletRequest request
4. HttpServletResponse response)
5. throws ServletException, IOException
6. {
7. String message = *In doGet*;
8.
9. }
10. }
Which two, inserted individually at line 8, will each place an entry in the servlet log file?
(Choose two)
A. log(message);
B. request.log(message);
C. getServletInfo().log(message);
D. getServletConfig().log(message);
E. getServletContext().log(message);
F. request.getSession().log(message);

Answer: A.E

(a)GenericServlet有实作ServletConfig介面, 所以有实作log method, 而HttpSrevlet继承之, 所以直接拿来使用

(e)API中有提到在GenericServlet中所提供的getServletContext
This method is supplied for convenience. It gets the context from the servlet's ServletConfig object.

在Servlet 2.1之后, GenericServlet有部份的程式如下

1
2
3
4
5
6
7
public void init(ServletConfig config) throws ServletException { _config = config; log("init called"); init();
}
public void init() throws ServletException {
}


所以我猜getServletContext就是拿_config来做_config.getServletContext()吧
也就是

1
2
3
public ServletContext getServletContext() { return _config.getServletContext();
}

--

QUESTION NO: 4

1. <%@ taglib uri='exmaple' prefix='example'%>
2. <example:aTagWithABody>
3. <%="BODY CONTENT"%>
4. </example:aTagWithABody>

If the aTagWithABody tag extends javax.servlet.jsp.tagext.TagSupport, and that tag's handler returns EVAL_BODY_BUFFERED from doStartTag, what is the result of processing the JSP code?

A. Compilation fails.
B. "BODY CONTENT" is returned in the generated response.
C. "<%=BODY CONTENT%>" is returned in the generated response.
D. Because the tag’s body content will be buffered, it will not be returned in the generated response.

Answer: A

因为只有继承 TagSupport 不能回传 EVAL_BODY_BUFFERED
要继承 BodyTagSupport 或实作 BodyTag 才行
--

QUESTION NO: 6
In a JSP custom tag, which method would you use to access the JSP implicit variable that references the application scope?

A. PageContext.getOut()
B. JspFactory.getPagetContext()
C. TagSupport.getValue(String)
D. PageContext.getServletContext()

Answer: D
--

QUESTION NO: 8
Which method is used to retrieve objects from an HTTP session?
A. getAttribute method of javax.servlet.Session
B. getAttribute method of javax.servlet.HttpSession
C. getAttribute method of javax.servlet.http.Session
D. getAttribute method of javax.servlet.http.HttpSession

Answer: D
昵称: swanky  时间: 2003-08-21 22:07:00
QUESTION NO: 12
Which method is used by a servlet to place its session ID in a URL that is written to the servlet’s response output stream?
A. The encodeURL method of the HttpServletRequest interface.
B. The encodeURL method of the HttpServletResponse interface.
C. The rewriteURL method of the HttpServletRequest interface.
D. The rewriteURL method of the HttpServletResponse interface.
--
QUESTION NO: 13
What is the name of the tag library descriptor element that declares that an attribute of a tag is mandatory?
--
QUESTION 15
Which correctly defined "data integrity"?
A. It guarantees that your confidential files are kept encrypted on your Web server.
B. It guarantees that only a specific set of users may access your confidential files.
C. It guarantees that delivery of your confidential files will not be read by a malicious user.
D. It guarantees that delivery of your confidential files will not be altered during transmission.
E. It guarantees that access to your confidential files will prompt the user for their password of the Web browser.



QUESTION NO: 12
Which method is used by a servlet to place its session ID in a URL that is written to the servlet’s response output stream?
A. The encodeURL method of the HttpServletRequest interface.
B. The encodeURL method of the HttpServletResponse interface.
C. The rewriteURL method of the HttpServletRequest interface.
D. The rewriteURL method of the HttpServletResponse interface.

Answer: B

根据题目的提示, 知 HttpServletRequest interface 没有机会中选
又 rewriteURL 不存在於 HttpServletResponse interface, 所以选 B
--

QUESTION NO: 13
What is the name of the tag library descriptor element that declares that an attribute of a tag is mandatory?

Answer: required

<required>true</required> <!-- true | yes -->
--

QUESTION 15
Which correctly defined "data integrity"?
A. It guarantees that your confidential files are kept encrypted on your Web server.
B. It guarantees that only a specific set of users may access your confidential files.
C. It guarantees that delivery of your confidential files will not be read by a malicious user.
D. It guarantees that delivery of your confidential files will not be altered during transmission.
E. It guarantees that access to your confidential files will prompt the user for their password of the Web browser.

Answer: D
昵称: swanky  时间: 2003-08-23 14:01:00
QUESTION NO: 21
When a session becomes invalid, which method will be invoked on a session attribute object that implements the corresponding interface?
A. sessionDestroyed of the HttpSessionListener interface
B. valueUnbound of the HttpSessionBindingListener interface
C. attributeRemoved of the HtppSessionAttributeListener interface
D. sessionWillPassivate of the HttpSessionActivationListener interface
--
QUESTION NO: 22
Which two are equivalent? (Choose two)
A. <%= YoshiBean.size%>
B. <%= YoshiBean.getSize()%>
C. <%= YoshiBean.getProperty("size")%>
D. <jsp:getProperty id="YoshiBean" param="size"/>
E. <jsp:getProperty name="YoshiBean" param="size"/>
F. <jsp:getProperty id="YoshiBean" property="size"/>
G. <jsp:getProperty name="YoshiBean" property="size"/>
--
QUESTION NO: 27
Which JSP directive declares a tag library used by the page?
昵称: swanky  时间: 2003-08-23 14:31:00

QUESTION NO: 21
When a session becomes invalid, which method will be invoked on a session attribute object that implements the corresponding interface?
A. sessionDestroyed of the HttpSessionListener interface
B. valueUnbound of the HttpSessionBindingListener interface
C. attributeRemoved of the HtppSessionAttributeListener interface
D. sessionWillPassivate of the HttpSessionActivationListener interface

Answer: B

比较一下 HttpSessionAttributeListener 与 HttpSessionBindingListener:

HttpSessionAttributeListener 有三个 method
void attrubuteAdded(HttpSessionBindingEvent se)
void attrubuteRemoved(HttpSessionBindingEvent se)
void attrubuteReplaced(HttpSessionBindingEvent se)
需要在 deployment descriptor 设定
不能在分散式环境下使用

HttpSessionBindingListener 有两个 method
void valueBound(HttpSessionBindingEvent se)
void valueUnbound(HttpSessionBindingEvent se)
不在 deployment descriptor 设定
attribute 需要要实作 HttpSessionBindingListener 这个介面
可以在分散式环境下使用

yoshi的解释:
针对那些attribute, 所以是HttpSessionBindingListener
另外还有几个很像的:
HttpSessionListener, 这个应该是用来记录整个web application中session的建立, 消失
HttpSessionAttributeListener, 这个是用来侦测整个web application所有的session中, attribute的建立与消失

而HttpSessionBindingListener是由attribute自己实作, 在自己被bound, unbound时会呼叫

Shen的解释:
The HttpSessionListener and HttpSessionAttributeListener are configured
in the deployment descriptor. Therefore, even if a session attribute
implements these interfaces, the sessionDestroyed() and attributeRemoved()
methods will not be called on that attribute.
An HttpSessionActivationListener is also configured in the deployment
descriptor, and it is used when a session is passivated or activated. 
--

QUESTION NO: 22
Which two are equivalent? (Choose two)
A. <%= YoshiBean.size%>
B. <%= YoshiBean.getSize()%>
C. <%= YoshiBean.getProperty("size")%>
D. <jsp:getProperty id="YoshiBean" param="size"/>
E. <jsp:getProperty name="YoshiBean" param="size"/>
F. <jsp:getProperty id="YoshiBean" property="size"/>
G. <jsp:getProperty name="YoshiBean" property="size"/>

Answer: B.G
--

QUESTION NO: 27
Which JSP directive declares a tag library used by the page?

Answer: taglib

<%@ taglib %>
昵称: swanky  时间: 2003-08-23 14:59:00
QUESTION NO: 31
Given a tag library with the following tags:
˙A tag called getYoshi that has one attribute called hierarchy that accepts a dynamic value.
˙A tag called getChapter that has one attribute called num.
Which three options are valid of these custom tags in a JSP page? (Choose three)
A. <mT:getYoshi hierarchy="vol1,chap1"/>
B. <mT:getYoshi hierarchy="<mT:getChapter num=1/>"/>
C. <mT:getYoshi hierarchy="<mT:getChapter num="1"/>"/>
D. <%String chapter = "chap1";%> <mT:getYoshi hierarchy=<%=chapter%>/>
E. <%String chapter = "chap1";%> <mT:getYoshi hierarchy="<%=chapter%>"/>
--
QUESTION NO: 33
Which two authentication techniques (defined by the auth-method element in the deployment descriptor) use built-in HTTP mechanisms? (Choose two)
A. FORM
B. BASIC
C. DIGEST
D. CLIENT-CERT
--
QUESTION NO: 36
Which TagSupport method can access any outer tag handler object?
A. getParent
B. findAncenstor
C. getParentWithClass
D. findAncenstorWithClass
--
QUESTION NO: 38
Within a Web application deployment descriptor, what is the name of an element that can
contain an <error-page> element?
A. error
B. web-app
C. servlet
D. error-page-config
--
QUESTION NO: 39
Which four constants describe the attributes of a JSP custom tag in a tag library descriptor?
(Choose four)
A. Name
B. Type
C. Required
D. Name-given
E. Short-name
F. Rtexprvalue
G. Display-name
昵称: swanky  时间: 2003-08-23 16:01:00

QUESTION NO: 31
Given a tag library with the following tags:
˙A tag called getYoshi that has one attribute called hierarchy that accepts a dynamic value.
˙A tag called getChapter that has one attribute called num.
Which three options are valid of these custom tags in a JSP page? (Choose three)
A. <mT:getYoshi hierarchy="vol1,chap1"/>
B. <mT:getYoshi hierarchy="<mT:getChapter num=1/>"/>
C. <mT:getYoshi hierarchy="<mT:getChapter num="1"/>"/>
D. <%String chapter = "chap1";%> <mT:getYoshi hierarchy=<%=chapter%>/>
E. <%String chapter = "chap1";%> <mT:getYoshi hierarchy="<%=chapter%>"/>

Answer: A.C.E
--

QUESTION NO: 33
Which two authentication techniques (defined by the auth-method element in the deployment descriptor) use built-in HTTP mechanisms? (Choose two)
A. FORM
B. BASIC
C. DIGEST
D. CLIENT-CERT

Answer: B.C

HTTP规格只定义BASIC和DIGEST
FORM基本上是BASIC机制
只不过用HTML FORM的方式去撷取资讯
--

QUESTION NO: 36
Which TagSupport method can access any outer tag handler object?
A. getParent
B. findAncenstor
C. getParentWithClass
D. findAncenstorWithClass

Answer: D
--

QUESTION NO: 38
Within a Web application deployment descriptor, what is the name of an element that can
contain an <error-page> element?
A. error
B. web-app
C. servlet
D. error-page-config

Answer: B
--

QUESTION NO: 39
Which four constants describe the attributes of a JSP custom tag in a tag library descriptor?
(Choose four)
A. Name
B. Type
C. Required
D. Name-given
E. Short-name
F. Rtexprvalue
G. Display-name

Answer: A.B.C.F
昵称: swanky  时间: 2003-08-23 16:05:00
QUESTION NO: 41
Which statement describes a normal default security restriction applied to classes loaded from untrusted sources by Java-enabled browsers?
A. Untrusted classes cannot load trusted classes.
B. Untrusted classes cannot create server sockets.
C. Untrusted classes cannot load untrusted classes.
D. Untrusted classes cannot initiate any network connections.
E. Untrusted classes cannot display windows outside of the browser.
--
QUESTION NO: 42
Given:
11. public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
12. PrintWriter out = response.getWriter();
13. out.print("<h1>Hello</h1>");
14.
15. response.sendError(HttpServletResponse.SC_NOT_FOUND);
16. }
Which, inserted at line 14, will ensure that an IllegalStateException is thrown at line 15?
A. response.flushBuffer();
B. response.resetBuffer();
C. response.clearStatus();
D. if(response.getError()==-1)
E. if(response.getStatus()==-1)
F. if(response.isCommitted()==false)
--
QUESTION NO: 43
How many times can the doAfterBody method be called when processing a custom tag handle in a JSP page?
A. Only one
B. Zero or one
C. One or more
D. Zero or more
--
QUESTION NO: 47
Which is true of all servlets?
A. If the service method is over-ridden, its definition must include the synchronized modifier.
B. Every instance of the servlet has access to a thread-safe ServletContext Object.
C. The servlet container may maintain a pool of multiple servlet objects for a given servlet instance
D. The developer has responsibility for synchronizing access to session attributes across multiple concurrent requests.
--
QUESTION NO: 48
In a JSP page you are required to insert a JSP fragment called insert.jsp, where this JSP
fragment requires an additional request parameter called title.
What is necessary to perform this insertion?
A. <%@ include file='insert.jsp'title=Web Wonk'%>
B. <jsp:include page="insert,jsp' title=Web Wonk"/>
C. <%@ include file='insert.jsp' %>Web Wonk<%@include%>
D. <jsp:include page='insert.jsp><jsp:param title="Web Wonk'/></jsp:include>
E. <jsp:include page='insert.jsp'><jsp:param name='title' value='Web Wonk'/></jsp:include>
--
QUESTION NO: 49
You are designing a Web application to guide users through a problem-solving
process. All the information about the problems, and their solutions, will be
stored in a database. The application will use a central controller to:
˙ Dispatch requests to the appropriate JSP page.
˙ Manage the workflow process across pages.
˙ Load the behavior of the controller dynamically for flexibility.
Which design pattern is intended to achieve these goals?
A. Front Component
B. Data Access Object
C. Mode-View-Controller
D. Session Entity Facade
--
QUESTION NO: 50
Given:
<jsp:useBean id="fum" class="fee.fie.Fo" scope="application"/>
In which type of object is fum stored as an attribute?
A. Servlet
B. HttpServlet
C. ServletConfig
D. ServletContext
E. ApplicationContext
昵称: swanky  时间: 2003-08-23 18:42:00

QUESTION NO: 41
Which statement describes a normal default security restriction applied to classes loaded from untrusted sources by Java-enabled browsers?
A. Untrusted classes cannot load trusted classes.
B. Untrusted classes cannot create server sockets.
C. Untrusted classes cannot load untrusted classes.
D. Untrusted classes cannot initiate any network connections.
E. Untrusted classes cannot display windows outside of the browser.

Answer: B
--

QUESTION NO: 42
Given:
11. public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
12. PrintWriter out = response.getWriter();
13. out.print("<h1>Hello</h1>");
14.
15. response.sendError(HttpServletResponse.SC_NOT_FOUND);
16. }
Which, inserted at line 14, will ensure that an IllegalStateException is thrown at line 15?
A. response.flushBuffer();
B. response.resetBuffer();
C. response.clearStatus();
D. if(response.getError()==-1)
E. if(response.getStatus()==-1)
F. if(response.isCommitted()==false)

Answer: A

public void sendError(int sc) throws java.io.IOException
Sends an error response to the client using the specified status code and clearing the buffer.
If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
如果 response 已经被 commit 送出,就会有 IllegalStateException
又 response 没有被 commit,就直接送出 404 error

public void flushBuffer() throws java.io.IOException
Forces any content in the buffer to be written to the client. A call to this method automatically commits the response, meaning the status code and headers will be written.
把 buffer 清空送出

public void resetBuffer()
Clears the content of the underlying buffer in the response without clearing headers or status code. If the response has been committed, this method throws an IllegalStateException.
重设一个空 buffer

public boolean isCommitted()
Returns a boolean indicating if the response has been committed. A commited response has already had its status code and headers written.
判断有无被 commit
--

QUESTION NO: 43
How many times can the doAfterBody method be called when processing a custom tag handle in a JSP page?
A. Only one
B. Zero or one
C. One or more
D. Zero or more

Answer: D
--

QUESTION NO: 47
Which is true of all servlets?
A. If the service method is over-ridden, its definition must include the synchronized modifier.
B. Every instance of the servlet has access to a thread-safe ServletContext Object.
C. The servlet container may maintain a pool of multiple servlet objects for a given servlet instance
D. The developer has responsibility for synchronizing access to session attributes across multiple concurrent requests.

Answer: D
--

QUESTION NO: 48
In a JSP page you are required to insert a JSP fragment called insert.jsp, where this JSP
fragment requires an additional request parameter called title.
What is necessary to perform this insertion?
A. <%@ include file='insert.jsp'title=Web Wonk'%>
B. <jsp:include page="insert,jsp' title=Web Wonk"/>
C. <%@ include file='insert.jsp' %>Web Wonk<%@include%>
D. <jsp:include page='insert.jsp><jsp:param title="Web Wonk'/></jsp:include>
E. <jsp:include page='insert.jsp'><jsp:param name='title' value='Web Wonk'/></jsp:include>

Answer: E
--

QUESTION NO: 49
You are designing a Web application to guide users through a problem-solving
process. All the information about the problems, and their solutions, will be
stored in a database. The application will use a central controller to:
˙ Dispatch requests to the appropriate JSP page.
˙ Manage the workflow process across pages.
˙ Load the behavior of the controller dynamically for flexibility.
Which design pattern is intended to achieve these goals?
A. Front Component
B. Data Access Object
C. Mode-View-Controller
D. Session Entity Facade

Answer: A
--

QUESTION NO: 50
Given:
<jsp:useBean id="fum" class="fee.fie.Fo" scope="application"/>
In which type of object is fum stored as an attribute?
A. Servlet
B. HttpServlet
C. ServletConfig
D. ServletContext
E. ApplicationContext

Answer: D
昵称: swanky  时间: 2003-08-23 18:44:00
QUESTION NO: 56
Given:
01. public class JumpingBean {
02. private String title = "JumpingBean";
03. private int num = 10;
04.
05. public void setTitle(String title) {
06. this.title = title;
07. }
08. public String getYoshi() {
09. return title;
10. }
11. public void setNum(int num) {
12. this.num = num;
13. }
14. public int getNum(| {
15. return num;
16. }
17. }

Given index.jsp:
1. <html><body>
2. <jsp:useBean id="bean" class="com.yoshi.JumpingBean"/>
3. <jsp:setProperty name="bean" property="*"/>
4. Title: <%=bean.getYoshi()%><br>
5. Num: <%=bean.getNum()%><br>
6. </body></html>

For the given URL:
http://localhost/index.jsp?num=3
Which two are returned in the generated HTML? (Choose two)

A. "Num: 0<br>"
B. "Num: 3<br>"
C. "Title: <br>"
D. "Num: 10<br>"
E. "Title: null<br>"
F. "Title: JumpingBean<br>"
--
QUESTION NO: 58
Given:
11. public class Acc extends HttpServlet{
12. private StringBuffer bar = new StringBuffer("bar");
13. private static StringBuffer xyz = new StringBuffer();
14. public void doPost(HttpServletRequest req, HttpServletResponse resp){
15. StringBuffer yoshi = new StringBuffer("yoshi");
16. HttpSession session = req.getSession();
17. }
18. }
Which two variables reference objects that are thread-safe? (Choose two)
A. req at line 14
B. yoshi at line 15
C. bar at line 12
D. xyz at line 13
E. session at line 16
--
QUESTION NO: 59
Which two are benefits of the Value Object design patterns for implementing Web applications? (Choose two)
A. It improves response time for accessing data.
B. It separates business logic from presentation logic.
C. It can greatly reduce network traffic for accessing data.
D. It separates resource interface from resource implementation.
E. It allows software developers and page authors to work in parallel with few dependencies.
昵称: swanky  时间: 2003-08-23 18:51:00

QUESTION NO: 56
Given:
01. public class JumpingBean {
02. private String title = "JumpingBean";
03. private int num = 10;
04.
05. public void setTitle(String title) {
06. this.title = title;
07. }
08. public String getYoshi() {
09. return title;
10. }
11. public void setNum(int num) {
12. this.num = num;
13. }
14. public int getNum(| {
15. return num;
16. }
17. }

Given index.jsp:
1. <html><body>
2. <jsp:useBean id="bean" class="com.yoshi.JumpingBean"/>
3. <jsp:setProperty name="bean" property="*"/>
4. Title: <%=bean.getYoshi()%><br>
5. Num: <%=bean.getNum()%><br>
6. </body></html>

For the given URL:
http://localhost/index.jsp?num=3
Which two are returned in the generated HTML? (Choose two)

A. "Num: 0<br>"
B. "Num: 3<br>"
C. "Title: <br>"
D. "Num: 10<br>"
E. "Title: null<br>"
F. "Title: JumpingBean<br>"

Answer: B.F
--

QUESTION NO: 58
Given:
11. public class Acc extends HttpServlet{
12. private StringBuffer bar = new StringBuffer("bar");
13. private static StringBuffer xyz = new StringBuffer();
14. public void doPost(HttpServletRequest req, HttpServletResponse resp){
15. StringBuffer yoshi = new StringBuffer("yoshi");
16. HttpSession session = req.getSession();
17. }
18. }
Which two variables reference objects that are thread-safe? (Choose two)
A. req at line 14
B. yoshi at line 15
C. bar at line 12
D. xyz at line 13
E. session at line 16

Answer: A.B
--

QUESTION NO: 59
Which two are benefits of the Value Object design patterns for implementing Web applications? (Choose two)
A. It improves response time for accessing data.
B. It separates business logic from presentation logic.
C. It can greatly reduce network traffic for accessing data.
D. It separates resource interface from resource implementation.
E. It allows software developers and page authors to work in parallel with few dependencies.

Answer: A.C
昵称: swanky  时间: 2003-08-23 18:53:00
QUESTION NO: 62
You are designing a large, complex Web application that will be structured in a multi-tier architecture. You must provide interfaces based on both HTML and XML. The application must be maintainable over many development and deployment iterations.
Which design pattern is intended to achieve these goals?
A. Remote Proxy
B. Business Delegate
C. Bimodal Data Access
D. Model-View-Controller
--
QUESTION NO: 66
Within a Web application deployment descriptor, what is the name of the child element of <context-param> that describes a parameter?
A. desc
B. usage
C. param-desc
D. description
E. param-usage
F. param-description
--
QUESTION NO: 68
Which two are true about the basic HTTP authentication mechanism? (Choose two)
A. An HTML form is used to collect username and passphrase.
B. The username and passphrase information is passed "in the clear".
C. The username and passphrase information is passed in an encryption form.
D. The Web browser uses a browser-specific mechanism to collect username and passphrase.
--
QUESTION NO: 70
Which method is invoked on a servlet's session object so that a session is never timed out by the servlet container?
A. setTimeout(0)
B. setTimeout(-1)
C. setMaxInactiveInterval(0)
D. setMaxInactiveInterval(-1)
E. setTimeout(Integer.MAX_VALUE)
F. setMaxInactiveInterval(Integer.MAX_VALUE)
昵称: swanky  时间: 2003-08-23 19:11:00

QUESTION NO: 62
You are designing a large, complex Web application that will be structured in a multi-tier architecture. You must provide interfaces based on both HTML and XML. The application must be maintainable over many development and deployment iterations.
Which design pattern is intended to achieve these goals?
A. Remote Proxy
B. Business Delegate
C. Bimodal Data Access
D. Model-View-Controller

Answer: D
--

QUESTION NO: 66
Within a Web application deployment descriptor, what is the name of the child element of <context-param> that describes a parameter?
A. desc
B. usage
C. param-desc
D. description
E. param-usage
F. param-description

Answer: D
--

QUESTION NO: 68
Which two are true about the basic HTTP authentication mechanism? (Choose two)
A. An HTML form is used to collect username and passphrase.
B. The username and passphrase information is passed "in the clear".
C. The username and passphrase information is passed in an encryption form.
D. The Web browser uses a browser-specific mechanism to collect username and passphrase.

Answer: B.D

in the clear
就是很清楚
传过去的资料没有被加密过
--

QUESTION NO: 70
Which method is invoked on a servlet's session object so that a session is never timed out by the servlet container?
A. setTimeout(0)
B. setTimeout(-1)
C. setMaxInactiveInterval(0)
D. setMaxInactiveInterval(-1)
E. setTimeout(Integer.MAX_VALUE)
F. setMaxInactiveInterval(Integer.MAX_VALUE)

Answer: D
昵称: swanky  时间: 2003-08-23 19:13:00
QUESTION NO: 73
Which deployment description snippet would you use to declare the use of a tag library?
A. 7. <taglib>
8. <uri>http://yoshi.com/taglib.tld</uri>
9. <location>/WEB-INF/taglib.tld</location>
10. </taglib>
B. 7. <taglib>
8. <taglib-uri>http://yoshi.com/tablib.tld</taglib-uri>
9. <taglib-location>/WEB-INF/tablib.tld</taglib-location>
10. </taglib>
C. 7. <tag-lib>
8. <uri>http://yoshi.com/taglib.tld</uri>
9. <location>/WEB-INF/taglib.tld</location>
10. </tag-lib>
D. 7. <tag-lib>
8. <taglib-uri>http://yoshi.com/taglib.tld</taglib-uri>
9. <taglib-location>/WEB-INF/taglib.tld</taglib-location>
10. </tag-lib>
--
QUESTION NO: 78
Given:
public class YoshiServlet extends GenericServlet implements SingleThreadModel{
public void doPost(ServletRequest req, ServletResponse resp){
}
}
Which is true?
A. YoshiServlet will compile successfully as is.
B. My servlet must define
public void service(ServletRequest req, ServletResponse resp)
for it to compile successfully.
C. My Servlet must define
public void destroy() and
public void service(ServletRequest req, ServletResponse resp)
for it to compile successfully.
D. My servlet must define
public void lock(Servlet req, Servlet resp) and
public void unlock(Servlet req, Servlet resp)
of the SingleThreadModel interface for it to compile successfully.
--
QUESTION NO: 80
Given that a custom tag is meant to be used without a body, which value would you use in the body-content element?
昵称: swanky  时间: 2003-08-23 19:19:00

QUESTION NO: 73
Which deployment description snippet would you use to declare the use of a tag library?
A. 7. <taglib>
8. <uri>http://yoshi.com/taglib.tld</uri>
9. <location>/WEB-INF/taglib.tld</location>
10. </taglib>
B. 7. <taglib>
8. <taglib-uri>http://yoshi.com/tablib.tld</taglib-uri>
9. <taglib-location>/WEB-INF/tablib.tld</taglib-location>
10. </taglib>
C. 7. <tag-lib>
8. <uri>http://yoshi.com/taglib.tld</uri>
9. <location>/WEB-INF/taglib.tld</location>
10. </tag-lib>
D. 7. <tag-lib>
8. <taglib-uri>http://yoshi.com/taglib.tld</taglib-uri>
9. <taglib-location>/WEB-INF/taglib.tld</taglib-location>
10. </tag-lib>

Answer: B
--

QUESTION NO: 78
Given:
public class YoshiServlet extends GenericServlet implements SingleThreadModel{
public void doPost(ServletRequest req, ServletResponse resp){
}
}
Which is true?
A. YoshiServlet will compile successfully as is.
B. My servlet must define
public void service(ServletRequest req, ServletResponse resp)
for it to compile successfully.
C. My Servlet must define
public void destroy() and
public void service(ServletRequest req, ServletResponse resp)
for it to compile successfully.
D. My servlet must define
public void lock(Servlet req, Servlet resp) and
public void unlock(Servlet req, Servlet resp)
of the SingleThreadModel interface for it to compile successfully.

Answer: B
--

QUESTION NO: 80
Given that a custom tag is meant to be used without a body, which value would you use in the body-content element?

Answer: empty
昵称: swanky  时间: 2003-08-23 19:20:00
QUESTION NO: 81
Given:
11. <%${%>
12. <jsp:useBean id="buffer" class="java.lang.StringBuffer"/>
13. <%buffer.append("xyz");%>
14. <%}%>
15. buffer is <%=buffer%>
What appears on the response stream?
A. An error occurs at compile time.
B. An error occurs at translation time.
C. The string "buffer is xyz" appears in the response stream.
D. The string "buffer is null" appears in the response stream.
--
QUESTION NO: 82
Which is a requirement of a distributable Web application?
A. It must not call the sendRedirect method.
B. It must not rely on URL-rewriting for session tracking.
C. It must not rely on any notification when a session is activated or passivated.
D. It must not rely on the propagation of events caused by the manipulation of session attributes.
--
QUESTION NO: 84
Which two are true of parameters defined using the <context-param> element within a Web application deployment descriptor? (Choose two)
A. They are accessible across sessions.
B. They are defined within the scope of a specific servlet definition.
C. They are accessible to any servlet or JSP page within the Web application.
D. They can be modified with the setAttribute method of the SessionContext interface.
E. They can be modified with the setInitParameter method of the ServletConfig interface.
--
QUESTION NO: 88
When a servlet context is initialized, which method will be invoked on an object implementing the specified interface?
A. contectCreated of the javax.servlet.ServletContextListener interface
B. contextInitialized of the javax.servlet.ServletContextListener interface
C. contextCreated of the javax.servlet.http.HtppServletContextListener interface
D. contextInitialized of the javax.servlet.http.HttpServletContextListener inteface
昵称: swanky  时间: 2003-08-23 21:47:00

QUESTION NO: 81
Given:
11. <%${%>
12. <jsp:useBean id="buffer" class="java.lang.StringBuffer"/>
13. <%buffer.append("xyz");%>
14. <%}%>
15. buffer is <%=buffer%>
What appears on the response stream?
A. An error occurs at compile time.
B. An error occurs at translation time.
C. The string "buffer is xyz" appears in the response stream.
D. The string "buffer is null" appears in the response stream.

Answer: A

JSP lifecycle 是在 Objective 8.5 里面
就是如果 jsp 的 tag 正确
会先 translation 成 class 档再 compile
--

QUESTION NO: 82
Which is a requirement of a distributable Web application?
A. It must not call the sendRedirect method.
B. It must not rely on URL-rewriting for session tracking.
C. It must not rely on any notification when a session is activated or passivated.
D. It must not rely on the propagation of events caused by the manipulation of session attributes.

Answer: D

分散式环境是在 Objective 3.3
主要就是不能使用 servlet context,因为在每个 container 都不同
deployment descriptor 里的 init parameters 也不一定相同
还有不能用 session attribute listeners
因为 HttpSession 的 scope 只存在於提供那个 session 的 VM
--

QUESTION NO: 84
Which two are true of parameters defined using the <context-param> element within a Web application deployment descriptor? (Choose two)
A. They are accessible across sessions.
B. They are defined within the scope of a specific servlet definition.
C. They are accessible to any servlet or JSP page within the Web application.
D. They can be modified with the setAttribute method of the SessionContext interface.
E. They can be modified with the setInitParameter method of the ServletConfig interface.

Answer: A.C
--

QUESTION NO: 88
When a servlet context is initialized, which method will be invoked on an object implementing the specified interface?
A. contectCreated of the javax.servlet.ServletContextListener interface
B. contextInitialized of the javax.servlet.ServletContextListener interface
C. contextCreated of the javax.servlet.http.HtppServletContextListener interface
D. contextInitialized of the javax.servlet.http.HttpServletContextListener inteface

Answer: B
昵称: swanky  时间: 2003-08-23 21:49:00
QUESTION NO: 92
Which static value from the javax.servlet.jsp.tagext.Tag interface must be returned from a tag
handler's doEndTag method so that the rest of the JSP page following the tag is NOT processed?
Note: Do not specify the interface name in your response.
--
QUESTION NO: 95
Given:
1. public class SListener implements HttpSessionAttributeListener{
2. public void attributeAdded(HttpSessionBindingEvent hsbe){
3. }
4. public void attributeRemoved(HttpSessionBindingEvent hsbe){
5. }
6. }
What is true?
A. The class will compile as is.
B. The public method void attributeChanged(HttpSessionBindingEvent hsbe)
must be defined for the class to compile correctly.
C. The public method void attributeUpdated(HttpSessionBindingEvent hsbe)
must be defined for the class to compile correctly.
D. The public method void attributeReplaced(HttpSessionBindingEvent hsbe)
must be defined for the class to compile correctly.
--
QUESTION NO: 96
Which J2EE design pattern increase reusability by partially decoupling data presentation,
data representation, and application operations?
A. Data Access Object
B. Model-View-Controller
C. Session Entity Facade
D. Bimodal Data Access
--
QUESTION NO: 100
Given:
<jsp:useBean id="YoshiBean" class="com.yoshi.JellyBean"/>
Where is the declared JavaBean accessible?
A. Throughout the remainder of the JSP page.
B. Within other servlets or JSP pages in the same Web application.
C. Within other servlets or JSP pages in the same servlet context.
D. Throughout all future invocations of the JSP page, until the session expires.
E. Throughout all future invocations of the JSP page, until the servlet container is stopped or the JSP page is changed.
昵称: swanky  时间: 2003-08-23 22:01:00

QUESTION NO: 92
Which static value from the javax.servlet.jsp.tagext.Tag interface must be returned from a tag
handler's doEndTag method so that the rest of the JSP page following the tag is NOT processed?
Note: Do not specify the interface name in your response.

Answer: SKIP_PAGE
--

QUESTION NO: 95
Given:
1. public class SListener implements HttpSessionAttributeListener{
2. public void attributeAdded(HttpSessionBindingEvent hsbe){
3. }
4. public void attributeRemoved(HttpSessionBindingEvent hsbe){
5. }
6. }
What is true?
A. The class will compile as is.
B. The public method void attributeChanged(HttpSessionBindingEvent hsbe)
must be defined for the class to compile correctly.
C. The public method void attributeUpdated(HttpSessionBindingEvent hsbe)
must be defined for the class to compile correctly.
D. The public method void attributeReplaced(HttpSessionBindingEvent hsbe)
must be defined for the class to compile correctly.

Answer: D
--

QUESTION NO: 96
Which J2EE design pattern increase reusability by partially decoupling data presentation,
data representation, and application operations?
A. Data Access Object
B. Model-View-Controller
C. Session Entity Facade
D. Bimodal Data Access

Answer: B
--

QUESTION NO: 100
Given:
<jsp:useBean id="YoshiBean" class="com.yoshi.JellyBean"/>
Where is the declared JavaBean accessible?
A. Throughout the remainder of the JSP page.
B. Within other servlets or JSP pages in the same Web application.
C. Within other servlets or JSP pages in the same servlet context.
D. Throughout all future invocations of the JSP page, until the session expires.
E. Throughout all future invocations of the JSP page, until the servlet container is stopped or the JSP page is changed.

Answer: A
昵称: swanky  时间: 2003-08-23 22:04:00
QUESTION NO: 103
Given this code in a servlet method:
Principal user = request.getUserPrincipal();
If this servlet is used to respond to a request in which the user HAS NOT been authenticated, what happens at runtime?
A. Null is returned from the getUserPrincipal method.
B. The getUserPrincipal method throws thejava.security DigestException.
C. A Principal object is returned, but the getName method of the principal returns null.
D. A Principal object is returned method, but the getName method of the principal returns an empty string.
--
QUESTION NO: 105
Which XML tag may be used to specify the JSP page directive?
A. <jsp />
B. <page />
C. <jsp.page />
D. <jsp:page />
E. <jsp:directive.page />
--
QUESTION NO: 106
Exhibit:
1. public class JellyBean {
2. private int count;
3. public void setCount(int count) {
4. this.count = count;
5. }
6. public int getCount() {
7. return count;
8. }
9. }
Given:
1. <html>
2. <body>
3. <jsp:useBean id="YoshiBean" class="JellyBean">
4.
5. </jsp:useBean>
6. </body>
7. </html>

Which two inserted individually at line 4, will initialize the count property of the newly created JellyBean YoshiBean? (Choose two)
A. YoshiBean.count = 1;
B. <% YoshiBean.count = 1; %>
C. <% YoshiBean.setCount(1); %>
D. <jsp:init property="count" value="1" />
E. <jsp:setProperty name="YoshiBean" property="count" value="1" />
--
QUESTION NO: 107
Given:
<jsp:useBean id="baz" class="com.yoshi.Yoshi" type="com.yoshi.Bar" />
Which two are true? (Choose two)
A. An object of type com.yoshi.Yoshi is instantiated and assigned to a variable
baz of type com.yoshi.Bar.
B. An object of type com.yoshi.Bar is instantiated and assigned to a variable baz of type com.yoshi.Yoshi.
C. To avoid error, com.yoshi.Bar must be superclass of
com.yoshi.Yoshi or an interface implemented by com.yoshi.Yoshi.
D. To avoid error, com.yoshi.Yoshi must be a superclass of
com.yoshi.Bar or an interface implemented by com.yoshi.Bar.
--
QUESTION NO: 108
Given:
<jsp:useBean id="YoshiBean" class="com.yoshi.Yoshi" scope="xxxx" />
Which value, substituted for xxxx, will automatically store YoshiBean as an attribute in the JSP page's ServletContext?
A. page
B. global
C. servlet
D. request
E. httpsession
F. application
--
QUESTION NO: 109
Exhibit:
01. package beans;
02. public class ValueBean {
03. private int value;
04. public ValueBean() {
05. this.value = 200;
06. }
07. public void setValue(int value) {
08. this.value = value;
09. }
10. public int getValue() {
11. return value;
12. }
13. }

Given:
<jsp:useBean id='valueBean' class='beans.ValueBean'>
<jsp:setProperty name='valueBean' property='value' value='<%= 100 %>'/>
</jsp:useBean>
<%= valueBean.getValue() %>
<jsp:useBean id='valueBeanTwo' class='beans.ValueBean'/>
<%= valueBeanTwo.getValue() %>

What is the result?
A. The JSP page will not compile
B. 200 100 will be printed in the browser.
C. 100 200 will be printed in the browser.
D. 100 101 will be printed in the browser.
E. 200 200 will be printed in the browser.
--
QUESTION NO: 110
Which two are true about Web application archive files? (Choose two)
A. They must NOT be signed.
B. They may contain JAR files.
C. They must have a ".web" extension.
D. They may serve files from the META-INF directory.
E. They may contain JSP files in addition to HTML files.
F. They CANNOT define their dependencies in the manifest.mf file.
昵称: swanky  时间: 2003-09-06 09:10:00

QUESTION NO: 103
Given this code in a servlet method:
Principal user = request.getUserPrincipal();
If this servlet is used to respond to a request in which the user HAS NOT been authenticated, what happens at runtime?
A. Null is returned from the getUserPrincipal method.
B. The getUserPrincipal method throws thejava.security DigestException.
C. A Principal object is returned, but the getName method of the principal returns null.
D. A Principal object is returned method, but the getName method of the principal returns an empty string.

Answer: A
--
QUESTION NO: 105
Which XML tag may be used to specify the JSP page directive?
A. <jsp />
B. <page />
C. <jsp.page />
D. <jsp:page />
E. <jsp:directive.page />

Answer: E
--

QUESTION NO: 106
Exhibit:
1. public class JellyBean {
2. private int count;
3. public void setCount(int count) {
4. this.count = count;
5. }
6. public int getCount() {
7. return count;
8. }
9. }
Given:
1. <html>
2. <body>
3. <jsp:useBean id="YoshiBean" class="JellyBean">
4.
5. </jsp:useBean>
6. </body>
7. </html>

Which two inserted individually at line 4, will initialize the count property of the newly created JellyBean YoshiBean? (Choose two)
A. YoshiBean.count = 1;
B. <% YoshiBean.count = 1; %>
C. <% YoshiBean.setCount(1); %>
D. <jsp:init property="count" value="1" />
E. <jsp:setProperty name="YoshiBean" property="count" value="1" />

Answer: C.E
--

QUESTION NO: 107
Given:
<jsp:useBean id="baz" class="com.yoshi.Yoshi" type="com.yoshi.Bar" />
Which two are true? (Choose two)
A. An object of type com.yoshi.Yoshi is instantiated and assigned to a variable
baz of type com.yoshi.Bar.
B. An object of type com.yoshi.Bar is instantiated and assigned to a variable baz of type com.yoshi.Yoshi.
C. To avoid error, com.yoshi.Bar must be superclass of
com.yoshi.Yoshi or an interface implemented by com.yoshi.Yoshi.
D. To avoid error, com.yoshi.Yoshi must be a superclass of
com.yoshi.Bar or an interface implemented by com.yoshi.Bar.

Answer: A.C
--

QUESTION NO: 108
Given:
<jsp:useBean id="YoshiBean" class="com.yoshi.Yoshi" scope="xxxx" />
Which value, substituted for xxxx, will automatically store YoshiBean as an attribute in the JSP page's ServletContext?
A. page
B. global
C. servlet
D. request
E. httpsession
F. application

Answer: F
--

QUESTION NO: 109
Exhibit:
01. package beans;
02. public class ValueBean {
03. private int value;
04. public ValueBean() {
05. this.value = 200;
06. }
07. public void setValue(int value) {
08. this.value = value;
09. }
10. public int getValue() {
11. return value;
12. }
13. }

Given:
<jsp:useBean id='valueBean' class='beans.ValueBean'>
<jsp:setProperty name='valueBean' property='value' value='<%= 100 %>'/>
</jsp:useBean>
<%= valueBean.getValue() %>
<jsp:useBean id='valueBeanTwo' class='beans.ValueBean'/>
<%= valueBeanTwo.getValue() %>

What is the result?
A. The JSP page will not compile
B. 200 100 will be printed in the browser.
C. 100 200 will be printed in the browser.
D. 100 101 will be printed in the browser.
E. 200 200 will be printed in the browser.

Answer: C
--

QUESTION NO: 110
Which two are true about Web application archive files? (Choose two)
A. They must NOT be signed.
B. They may contain JAR files.
C. They must have a ".web" extension.
D. They may serve files from the META-INF directory.
E. They may contain JSP files in addition to HTML files.
F. They CANNOT define their dependencies in the manifest.mf file.

Answer: D.E
昵称: swanky  时间: 2003-09-06 09:15:00
QUESTION NO: 111
Given that the deployment descriptor for a Web application named test contains:
12. <servlet-mapping>
13. <servlet-name>yoshi</servlet-name>
14. <url-pattern>*.bop</url-pattern>
15. </servlet-mapping>
Assume the URL for the entry point of the web application is "http://servername/".
Which will invoke the servlet instance named yoshi?

A.  http://servername/test.bop
B.  http://servername/yoshi/bar.bop
C.  http://servername/test/yoshi/bop
D.  http://servername/baz/bat/boo.bop
E.  http://servername/test/yoshi/bar/baz.hop
--
QUESTION NO: 113
Which element name is used in a deployment descriptor to specify the name of the a servlet
definition?
A. name
B. class
C. instance
D. servlet-name
E. servlet-class
F. instance-name
--
QUESTION NO: 114
Which two methods of HttpServletResponse will allow an HTTP header to be set in the
response? (Choose two)
A. setHeader
B. setHeaders
C. setDateHeader
D. setHeaderValue
--
QUESTION NO: 115
You are developing a servlet to generate a GIF image stream:
Given:
12. response.setContentType("image/gif");
13.
14. // Write image to out.
15. out.close();
Which, inserted at line 13, will initialize the out variable?
A. PrintWriter out = response.getWriter();
B. PrintWriter out = response.GetOutputStream();
C. OutputStream out = response.getOutputStream();
D. ServeletOutputStream out = response.getServletOutput();
--
QUESTION NO: 116
Place the steps of a JSP life cycle in the correct order.
Call _jspService
Call jspDestroy
Call jspInit
Create instance
JSP compilation
Load class
Page translation
--
QUESTION NO: 117
Which method in HttpServlet, apart from service, handles an HTTP GET request?
Note: Type only the same of the method, without parameters. The answer is case sensitive.
--
QUESTION NO: 118
The service method of a servlet instance is invoked under which three conditions? (Choose
three)
A. The servlet instance receives an HTTP GET request.
B. An HTTP POST request is made of the servlet instance.
C. The servlet instance is activated by the servlet container.
D. An instance of the servlet is loaded by the servlet container.
E. A browser sends an HTTP HEAD request to the servlet instance.
F. An instance of the servlet is placed into service by the servlet container.
--
QUESTION NO: 119
Which two are valid arguments for the getRequestDispatcher method of the
ServletContext interface?
A. /fred.txt
B. error.html
C. /error.html
D.  www.sun.com/error.html
E.  http://www.sun.com/error.html
--
QUESTION NO: 120
Which two methods can be used to access static content within a Web application? (Choose
two)
A. getResource of the Webapp interface.
B. getResource of the HttpServlet class.
C. getResource of the ServletContext interface.
D. getResourceAsStream of the Webapp interface.
E. getResourceAsStream of the HttpServlet class.
F. getResourceAsStream of the ServletContext interface.
昵称: swanky  时间: 2003-09-06 09:18:00

QUESTION NO: 111
Given that the deployment descriptor for a Web application named test contains:
12. <servlet-mapping>
13. <servlet-name>yoshi</servlet-name>
14. <url-pattern>*.bop</url-pattern>
15. </servlet-mapping>
Assume the URL for the entry point of the web application is "http://servername/".
Which will invoke the servlet instance named yoshi?

A. http://servername/test.bop
B. http://servername/yoshi/bar.bop
C. http://servername/test/yoshi/bop
D. http://servername/baz/bat/boo.bop
E. http://servername/test/yoshi/bar/baz.hop

Answer: A
--

QUESTION NO: 113
Which element name is used in a deployment descriptor to specify the name of the a servlet
definition?
A. name
B. class
C. instance
D. servlet-name
E. servlet-class
F. instance-name

Answer: D
--

QUESTION NO: 114
Which two methods of HttpServletResponse will allow an HTTP header to be set in the
response? (Choose two)
A. setHeader
B. setHeaders
C. setDateHeader
D. setHeaderValue

Answer: AC
--

QUESTION NO: 115
You are developing a servlet to generate a GIF image stream:
Given:
12. response.setContentType("image/gif");
13.
14. // Write image to out.
15. out.close();
Which, inserted at line 13, will initialize the out variable?
A. PrintWriter out = response.getWriter();
B. PrintWriter out = response.GetOutputStream();
C. OutputStream out = response.getOutputStream();
D. ServeletOutputStream out = response.getServletOutput();

Answer: C
--

QUESTION NO: 116
Place the steps of a JSP life cycle in the correct order.
Call _jspService
Call jspDestroy
Call jspInit
Create instance
JSP compilation
Load class
Page translation

Answer: translation, compilation, load class, create instance, jspInit, _jspService, jspDestroy
--

QUESTION NO: 117
Which method in HttpServlet, apart from service, handles an HTTP GET request?
Note: Type only the same of the method, without parameters. The answer is case sensitive.

Answer: doGet
--

QUESTION NO: 118
The service method of a servlet instance is invoked under which three conditions? (Choose
three)
A. The servlet instance receives an HTTP GET request.
B. An HTTP POST request is made of the servlet instance.
C. The servlet instance is activated by the servlet container.
D. An instance of the servlet is loaded by the servlet container.
E. A browser sends an HTTP HEAD request to the servlet instance.
F. An instance of the servlet is placed into service by the servlet container.

Answer: A.B.E
--

QUESTION NO: 119
Which two are valid arguments for the getRequestDispatcher method of the
ServletContext interface?
A. /fred.txt
B. error.html
C. /error.html
D. www.sun.com/error.html
E. http://www.sun.com/error.html

Answer: A.C
--

QUESTION NO: 120
Which two methods can be used to access static content within a Web application? (Choose
two)
A. getResource of the Webapp interface.
B. getResource of the HttpServlet class.
C. getResource of the ServletContext interface.
D. getResourceAsStream of the Webapp interface.
E. getResourceAsStream of the HttpServlet class.
F. getResourceAsStream of the ServletContext interface.

Answer: C.F
昵称: swanky  时间: 2003-09-06 09:22:00
QUESTION NO: 121
Which two are true about the HTTP POST method? (Choose two)
A. POST requests are faster.
B. It supports multipart MIME requests.
C. Request data is sent in a separate content block.
D. Parameters are accessible using the getQueryString method of the
HttpServletRequest interface.
--
QUESTION NO: 122
Which element name in the Web application deployment descriptor is used to declare that a
custom tag library can be used by the JSP pages in that Web application?
A. tag
B. taglib
C. tag-lib
D. taglibrary
E. tag-library
--
QUESTION NO: 124
Given a tag library with the following tag:
a tag called getYoshi that has one attribute called hierarchy that is not mandatory.
Which two options are a valid use of this tag in a JSP page? (Choose two)
A. <mT:getYoshi>
B. </mT:getYoshi>
C. <mT:getYoshi></mT:getYoshi>
D. <mT:getYoshi hierarchy="vol1,chap1">
E. </mT:getYoshi hierarchy="vol1,chap1">
F. <mT:getYoshi hierarchy="vol1,chap1"/>
--
QUESTION NO: 125
Which three constants describe the body content of a JSP custom tag in a tag library
descriptor? (Choose three)
A. JSP
B. none
C. empty
D. tei-class
E. tagdependent
--
QUESTION NO: 126
What is the meaning of the SKIP_PAGE constant when it is returned from the doEndTag method?
A. SKIP_PAGE is not a valid return value for the doEndTag method.
B. SKIP_PAGE directs the JSP page to disregard the body of the custom tag.
C. SKIP_PAGE directs the JSP page to disregard the rest of the JSP page content.
D. SKIP_PAGE directs the JSP page to disregard any included JSP fragments from the jsp:include standard action.
--
QUESTION NO: 127
Given:
1. <html>
2. <body>
3. <%
4. for(int i = 0; 1 < 10; i++) {
5.
6. }
7. %>
8. </body>
9. </html>

Which can appear at line 5 without causing an error?
A. <%= i %>
B. <b>i</b>
C. %><%= i %><%
D. <h1>Hello</h1>
--
QUESTION NO: 128
Given:
3. <a:tagX attr="123">
4. <a:tagY>
5. <a:tagZ/>
6. </a:tagY>
7. </a:tagX>
Which TagSupport method can be used by the tagZ handler class to access the tagX handler?
A. getParent
B. findAncestor
C. getParentWithClass
D. findAncestorWithClass
--
QUESTION NO: 129
Given a tag that iterates over a set of values, which static value from the
javax.servlet.jsp.tagext.Tag interface must be returned from the doAfterBody
method to end the iteration?
Note: Do not specify the interface name in your response.
--
QUESTION NO: 130
Which tag library descriptor element name identifies the type of body content for a JSP custom tag?
A. JSP
B. Body
C. content
D. body-content
昵称: swanky  时间: 2003-11-16 16:49:00

QUESTION NO: 121
Which two are true about the HTTP POST method? (Choose two)
A. POST requests are faster.
B. It supports multipart MIME requests.
C. Request data is sent in a separate content block.
D. Parameters are accessible using the getQueryString method of the
HttpServletRequest interface.

Answer: BC

QUESTION NO: 122
Which element name in the Web application deployment descriptor is used to declare that a
custom tag library can be used by the JSP pages in that Web application?
A. tag
B. taglib
C. tag-lib
D. taglibrary
E. tag-library

Answer: B

QUESTION NO: 124
Given a tag library with the following tag:
a tag called getYoshi that has one attribute called hierarchy that is not mandatory.
Which two options are a valid use of this tag in a JSP page? (Choose two)
A. <mT:getYoshi>
B. </mT:getYoshi>
C. <mT:getYoshi></mT:getYoshi>
D. <mT:getYoshi hierarchy="vol1,chap1">
E. </mT:getYoshi hierarchy="vol1,chap1">
F. <mT:getYoshi hierarchy="vol1,chap1"/>

Answer: CF

QUESTION NO: 125
Which three constants describe the body content of a JSP custom tag in a tag library
descriptor? (Choose three)
A. JSP
B. none
C. empty
D. tei-class
E. tagdependent

Answer: ACE

QUESTION NO: 126
What is the meaning of the SKIP_PAGE constant when it is returned from the doEndTag method?
A. SKIP_PAGE is not a valid return value for the doEndTag method.
B. SKIP_PAGE directs the JSP page to disregard the body of the custom tag.
C. SKIP_PAGE directs the JSP page to disregard the rest of the JSP page content.
D. SKIP_PAGE directs the JSP page to disregard any included JSP fragments from the jsp:include standard action.

Answer: C

QUESTION NO: 127
Given:
1. <html>
2. <body>
3. <%
4. for(int i = 0; 1 < 10; i++) {
5.
6. }
7. %>
8. </body>
9. </html>

Which can appear at line 5 without causing an error?
A. <%= i %>
B. <b>i</b>
C. %><%= i %><%
D. <h1>Hello</h1>

Answer: C

QUESTION NO: 128
Given:
3. <a:tagX attr="123">
4. <a:tagY>
5. <a:tagZ/>
6. </a:tagY>
7. </a:tagX>
Which TagSupport method can be used by the tagZ handler class to access the tagX handler?
A. getParent
B. findAncestor
C. getParentWithClass
D. findAncestorWithClass

Answer: D

QUESTION NO: 129
Given a tag that iterates over a set of values, which static value from the
javax.servlet.jsp.tagext.Tag interface must be returned from the doAfterBody
method to end the iteration?
Note: Do not specify the interface name in your response.

Answer: SKIP_BODY

QUESTION NO: 130
Which tag library descriptor element name identifies the type of body content for a JSP custom tag?
A. JSP
B. Body
C. content
D. body-content

Answer: D
昵称: swanky  时间: 2003-11-16 16:57:00
QUESTION NO: 131
Given:
1. public class Yo***ag extends BodyTagSupport { // 注: jute 不让我打 Yoshi-Tag
2. public int doAfterBody() throws JspException {
3. Object obj = pageContext.getAttribute("anObject");
4. return 2;
5. }
6. }
Assuming that the Object reference returned in line 3 is not null, in what scope does that
object reside?
A. page
B. session
C. request
D. application
--
QUESTION NO: 132
What is the name of the tag library descriptor element that declares the name of a tag?
--
QUESTION NO: 133

How many times can the doEndTag method be called when processing a custom tag handler in
a JSP page?
A. Only one, regardless of the return value of the doStartTag method.
B. Zero or one, depending on the return value of the doStartTag method.
C. One or more, depending on the return value of the doStartTag method.
D. Zero or more, regardless of the return value of the doStartTag method.
--
QUESTION NO: 134
Given servlet A:
1. public class A extends HttpServlet {
2. public void doPost( HttpServletRequest req, HttpServletResponse resp) throws ServletException {
3. String id = "yoshi";
4.
5. }
6. }
Servlet A and servlet B share the same active session.
Which, inserted at line 4, will allow servlet B to access the value "yoshi" in subsequent
POST requests to servlet B?
A. req.getSession().put("ID",id);
B. req.getSession().setValue("ID"),id)
C. req.getSession().putAttribute("ID",id);
D. req.getSession().setAttribute("ID",id);
--
QUESTION NO: 136
Which interface must a class implement so that instances of that class will be notified when they are added as attributes of an HTTP session?
A. java.util.EventListener
B. javax.servlet.http.HttpSessionListener
C. javax.servlet.http.HttpSessionValueListener
D. javax.servlet.http.HttpSessionBindingListener
--
QUESTION NO: 137
Given:
11. public class Yoshi extends HttpServlet {
12. public void doPost(HttpServletRequest req, HttpServletResponse resp) {
13.
14. }
15. }
Assume that no other servlets participating in the same session as servlet Yoshi explicitly invalidates the session.
Which, inserted at line 13, will ensure that the session remains valid for at least six minutes?
A. req.getSession().setTimeout(6);
B. req.getSession().setTimeout(360);
C. Nothing can be inserted to ensure the given condition.
D. req.getSession().setMaxInactiveInterval(6);
E. req.getSession().setMaxInactiveInterval(360);
--
QUESTION NO: 138
Which declares the current JSP page to be an error page?
A. <%@ page info="error" %>
B. <%@ page errorPage="true" %>
C. <%@ page isErrorPage="true" %>
D. <%@ page pageEndcoding="error" %>
E. <%@ page extends="javax.servlet.jsp.JspErrorPage" %>
--
QUESTION NO: 139
Given:
11. public class Acc1 extends HttpServlet implements SingleThreadModel {
12. private StringBuffer bar = new StringBuffer("bar");
13. private static StringBuffer xyz = new StringBuffer();
14. public void doPost(HttpServletRequest req, HttpServletResponse resp) {
15. StringBuffer yoshi = new StringBuffer("yoshi");
16. HttpSession session = req.getSession():
17. }
18. }
Which three variables reference objects are thread-safe? (Choose three)
A. bar at line 12.
B. xyz at line 13.
C. yoshi at line 15.
D. req at line 14.
E. session at line 16.
--
QUESTION NO: 140
If a servlet is designed to execute in single-threaded mode as part of a distributed Web application, which is true?
A. The servlet container must only instantiate one instance of the servlet within each Java Virtual Machine.
B. The servlet definition in the Web application deployment descriptor must include the <distributable/> element.
C. The servlet container may instantiate multiple instances of that servlet in each Java Virtual Machine within the container.
D. The servlet container manages the thread-safety of the session object within each of the Java Virtual Machines in the distributed application.
昵称: swanky  时间: 2003-11-16 17:04:00

QUESTION NO: 131
Given:
1. public class Yo***ag extends BodyTagSupport { // 注: jute 不让我打 Yoshi-Tag
2. public int doAfterBody() throws JspException {
3. Object obj = pageContext.getAttribute("anObject");
4. return 2;
5. }
6. }
Assuming that the Object reference returned in line 3 is not null, in what scope does that
object reside?
A. page
B. session
C. request
D. application

Answer: A

getAttribute 的 API:

public abstract java.lang.Object getAttribute(java.lang.String name)

return the object associated with the name in the page scope or null

Parameters:
name - the name of the attribute to get
Throws:
NullPointerException - if the name is null
java.lang.IllegalArgumentException - if the scope is invalid


QUESTION NO: 132
What is the name of the tag library descriptor element that declares the name of a tag?

Answer: <name>

QUESTION NO: 133

How many times can the doEndTag method be called when processing a custom tag handler in
a JSP page?
A. Only one, regardless of the return value of the doStartTag method.
B. Zero or one, depending on the return value of the doStartTag method.
C. One or more, depending on the return value of the doStartTag method.
D. Zero or more, regardless of the return value of the doStartTag method.

Answer: A

QUESTION NO: 134
Given servlet A:
1. public class A extends HttpServlet {
2. public void doPost( HttpServletRequest req, HttpServletResponse resp) throws ServletException {
3. String id = "yoshi";
4.
5. }
6. }
Servlet A and servlet B share the same active session.
Which, inserted at line 4, will allow servlet B to access the value "yoshi" in subsequent
POST requests to servlet B?
A. req.getSession().put("ID",id);
B. req.getSession().setValue("ID"),id)
C. req.getSession().putAttribute("ID",id);
D. req.getSession().setAttribute("ID",id);

Answer: D

QUESTION NO: 136
Which interface must a class implement so that instances of that class will be notified when they are added as attributes of an HTTP session?
A. java.util.EventListener
B. javax.servlet.http.HttpSessionListener
C. javax.servlet.http.HttpSessionValueListener
D. javax.servlet.http.HttpSessionBindingListener

Answer: D

QUESTION NO: 137
Given:
11. public class Yoshi extends HttpServlet {
12. public void doPost(HttpServletRequest req, HttpServletResponse resp) {
13.
14. }
15. }
Assume that no other servlets participating in the same session as servlet Yoshi explicitly invalidates the session.
Which, inserted at line 13, will ensure that the session remains valid for at least six minutes?
A. req.getSession().setTimeout(6);
B. req.getSession().setTimeout(360);
C. Nothing can be inserted to ensure the given condition.
D. req.getSession().setMaxInactiveInterval(6);
E. req.getSession().setMaxInactiveInterval(360);

Answer: E

QUESTION NO: 138
Which declares the current JSP page to be an error page?
A. <%@ page info="error" %>
B. <%@ page errorPage="true" %>
C. <%@ page isErrorPage="true" %>
D. <%@ page pageEndcoding="error" %>
E. <%@ page extends="javax.servlet.jsp.JspErrorPage" %>

Answer: C

QUESTION NO: 139
Given:
11. public class Acc1 extends HttpServlet implements SingleThreadModel {
12. private StringBuffer bar = new StringBuffer("bar");
13. private static StringBuffer xyz = new StringBuffer();
14. public void doPost(HttpServletRequest req, HttpServletResponse resp) {
15. StringBuffer yoshi = new StringBuffer("yoshi");
16. HttpSession session = req.getSession():
17. }
18. }
Which three variables reference objects are thread-safe? (Choose three)
A. bar at line 12.
B. xyz at line 13.
C. yoshi at line 15.
D. req at line 14.
E. session at line 16.

Answer: ACD

QUESTION NO: 140
If a servlet is designed to execute in single-threaded mode as part of a distributed Web application, which is true?
A. The servlet container must only instantiate one instance of the servlet within each Java Virtual Machine.
B. The servlet definition in the Web application deployment descriptor must include the <distributable/> element.
C. The servlet container may instantiate multiple instances of that servlet in each Java Virtual Machine within the container.
D. The servlet container manages the thread-safety of the session object within each of the Java Virtual Machines in the distributed application.

Answer: C
昵称: swanky  时间: 2003-11-16 17:12:00
QUESTION NO: 142
You are developing a Web application to provide inventory management for a wine store. The
application will require an Inventory class, to manage the whole store inventory, and an
InventoryItems class, to represent the specific information about an item in the inventory.
The InventoryItem class has the following goals:
- The information in an InventoryItem object is immutable.
- The inventory data is stored in a remote server.
- The InventoryItem will be referenced multiple times in the same JSP.

Which design pattern matches the goals of the InventoryItem class?
A. Facade
B. Value Object
C. Front Component
D. Model-View-Controller
--
QUESTION NO: 143
Which J2EE design pattern unifies and simplifies workflow by interpreting user request and
dispatching screen from a single point?
A. Value Object
B. Front Component
C. Data Access Object
D. Model-View-Controller
E. Session Entity Facade
--
QUESTION NO: 144
As a programmer at Yoshi Inc you are developing a Web application that must load
information from several different sources, including databases and XML files.
Which design pattern is intended to support this functionality?
A. Value Object
B. Front Component
C. Template Method
D. Data Access Object
--
QUESTION NO: 145
Which J2EE design pattern provides flexible, extensible access to data and other resources?
A. Value Object
B. Front Component
C. Data Access Object
D. Bimodal Data Access
E. Session Entity Facade
--
QUESTION NO: 146
Given this code from the doGet method, where response is an HttpServletResponse:
12. response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
13. response.setHeader("Location", "http://www.yoshi.com");
Which is equivalent?
A. response.forward("http://www.yoshi.com");
B. response.include("http://www.yoshi.com");
C. response.redirect("http://www.yoshi.com");
D. response.setLocation("http://www.yoshi.com");
E. response.sendRedirect("http://www.yoshi.com");
--
QUESTION NO: 147
Given:
1. public class ServletYoshi extends HttpServlet {
2. public void doGet(HttpServletRequest request,
3. HttpServletResponse response)
4. throws ServletException, IOException
5. {
6. try {
7. Integer.parseInt("one");
8. } catch(Exception e) {
9. String message = "Caught exception";
10.
11. }
12. }
13. }
Which two, inserted individually at line 10, will place a descriptive message and the stack trace
of the caught exception in the servlet log file? (Choose two)
A. log(message, e);
B. request.log(message, e);
C. getServletInfo().log(message, e);
D. getServletConfig().log(message, e);
E. getServletContext().log(message, e);
F. request.getSession().log(message, e);
--
QUESTION NO: 148
Which two represent valid JSP expressions? (Choose two)
A. <% x %>
B. <%= Math.random() %>
C. <%= "YOSHI" + "EXAMINATOR" %>
D. <%= Math.random(); %>
E. <% int x = "4" + "2"; %>
F. <% String x = "4" + "2" %>
--
QUESTION NO: 149
Which event is received by the appropriate listeners when a servlet context is first created?
A. javax.servlet.ServletContextEvent
B. javax.servlet.ServletCreatedEvent
C. javax.servlet.ServletInitializedEvent
D. javax.servlet.http.HttpServletContextEvent
E. javax.servlet.http.HttpServletInitializedEvent
--
QUESTION NO: 150
Within a Web application deployment descriptor, which specifies an
HttpSessionActivationListener implemented by the class wcd.http.ActivationListener?
A. <listener>
wcd.http.ActivationListener
</listener>
B. <listener>
<class>wcd.http.ActavationListener</class>
</listener>
C. <attr-listener>
<class>wcd.http.ActivationListener</class>
</attr-listener>
D. <listener>
<listener-class>
wcd.http.ActicationListener
</listener-class>
</listener>
E. <session-listener>
<listener-class>
wcd.http.ActivationListener
</listener-class>
</session-listener>
昵称: swanky  时间: 2003-11-16 17:17:00

QUESTION NO: 142
You are developing a Web application to provide inventory management for a wine store. The
application will require an Inventory class, to manage the whole store inventory, and an
InventoryItems class, to represent the specific information about an item in the inventory.
The InventoryItem class has the following goals:
- The information in an InventoryItem object is immutable.
- The inventory data is stored in a remote server.
- The InventoryItem will be referenced multiple times in the same JSP.

Which design pattern matches the goals of the InventoryItem class?
A. Facade
B. Value Object
C. Front Component
D. Model-View-Controller

Answer: B

QUESTION NO: 143
Which J2EE design pattern unifies and simplifies workflow by interpreting user request and
dispatching screen from a single point?
A. Value Object
B. Front Component
C. Data Access Object
D. Model-View-Controller
E. Session Entity Facade

Answer: B (or D)

QUESTION NO: 144
As a programmer at Yoshi Inc you are developing a Web application that must load
information from several different sources, including databases and XML files.
Which design pattern is intended to support this functionality?
A. Value Object
B. Front Component
C. Template Method
D. Data Access Object

Answer: D

QUESTION NO: 145
Which J2EE design pattern provides flexible, extensible access to data and other resources?
A. Value Object
B. Front Component
C. Data Access Object
D. Bimodal Data Access
E. Session Entity Facade

Answer: C

QUESTION NO: 146
Given this code from the doGet method, where response is an HttpServletResponse:
12. response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
13. response.setHeader("Location", "http://www.yoshi.com");
Which is equivalent?
A. response.forward("http://www.yoshi.com");
B. response.include("http://www.yoshi.com");
C. response.redirect("http://www.yoshi.com");
D. response.setLocation("http://www.yoshi.com");
E. response.sendRedirect("http://www.yoshi.com");

Answer: E

QUESTION NO: 147
Given:
1. public class ServletYoshi extends HttpServlet {
2. public void doGet(HttpServletRequest request,
3. HttpServletResponse response)
4. throws ServletException, IOException
5. {
6. try {
7. Integer.parseInt("one");
8. } catch(Exception e) {
9. String message = "Caught exception";
10.
11. }
12. }
13. }
Which two, inserted individually at line 10, will place a descriptive message and the stack trace
of the caught exception in the servlet log file? (Choose two)
A. log(message, e);
B. request.log(message, e);
C. getServletInfo().log(message, e);
D. getServletConfig().log(message, e);
E. getServletContext().log(message, e);
F. request.getSession().log(message, e);

Answer: AE

QUESTION NO: 148
Which two represent valid JSP expressions? (Choose two)
A. <% x %>
B. <%= Math.random() %>
C. <%= "YOSHI" + "EXAMINATOR" %>
D. <%= Math.random(); %>
E. <% int x = "4" + "2"; %>
F. <% String x = "4" + "2" %>

Answer: BC

QUESTION NO: 149
Which event is received by the appropriate listeners when a servlet context is first created?
A. javax.servlet.ServletContextEvent
B. javax.servlet.ServletCreatedEvent
C. javax.servlet.ServletInitializedEvent
D. javax.servlet.http.HttpServletContextEvent
E. javax.servlet.http.HttpServletInitializedEvent

Answer: A

QUESTION NO: 150
Within a Web application deployment descriptor, which specifies an
HttpSessionActivationListener implemented by the class wcd.http.ActivationListener?
A. <listener>
wcd.http.ActivationListener
</listener>
B. <listener>
<class>wcd.http.ActavationListener</class>
</listener>
C. <attr-listener>
<class>wcd.http.ActivationListener</class>
</attr-listener>
D. <listener>
<listener-class>
wcd.http.ActicationListener
</listener-class>
</listener>
E. <session-listener>
<listener-class>
wcd.http.ActivationListener
</listener-class>
</session-listener>

Answer: D
昵称: swanky  时间: 2003-11-16 17:21:00
QUESTION NO: 151
What single method is defined by javax.servlet.http.HttpSessionEvent?
Note: Provide only the method name; for example, yoshi NOT yoshi().
--
QUESTION NO: 152
Given this fragment from a Web application deployment descriptor?
12. <context-param>
13. <param-name>user</param-name>
14. <param-value>yoshi</param-value>
15. </context-param>
From within a servlet's doPost method, which retrieves the value of the user parameter?
A. getServletConfig().getAttribute("user");
B. getServletContext().getAttribute("user");
C. getServletConfig().getInitParameter("user");
D. getServletContext().getInitParameter("user");
--
QUESTION NO: 153
What is true regarding a session within a distributed Web application?
A. URL rewriting may not be used when redirecting responses.
B. Attributes in the session object CANNOT be shared between servlet contexts.
C. An instance of HttpSessionActivationListener must be defined for each Java VM
in the servlet container.
D. Object attributes in the session object must implement the
HttpSessionActivationListener interface.
--
QUESTION NO: 154
Given the JSP page, yoshi.jsp:
1. <html>
2. <jsp:include page="abc.jsp">
3. <jsp:param name="subTitle" value="Registration Form"/>
4. </jsp:include>
5. </html>
Which would you use in the abc.jsp fragment to produce the HTML response?
<h3>Registration Form</h3>
A. <h3><jsp:getParam name="subTitle"/></h3>
B. <h3><jsp:include param="subTitle"/></h3>
C. <h3><%= request.getParameter("subTitle") %></h3>
D. <h3><%= request.getAttribute("subTitle") %></h3>
--
QUESTION NO: 155
Which correctly defines authentication?
A. Authentication identifies a user and verifies the user's passphrase.
B. Authentication protects the Web server from denial-of-service attacks.
C. Authentication uses the user's passphrase to encrypt the TCP stream.
D. Authentication verifies that a user has access to a specific resource on the Web server.
--
QUESTION NO: 156
Which two API techniques can be used to get the name of an authenticated user? (Choose two)
A. Use the getUser on the HTTP servlet request object.
B. Use the getUserName on the HTTP servlet request object.
C. Use the getRemoteUser on the HTTP servlet request object.
D. Retrieve the principal object from the HTTP servlet request object using getUser and use the getName on the principal object.
E. Retrieve the principal object from the HTTP servlet request object using getPricipal and use the getName on the principal object.
--
QUESTION NO: 157
Which deployment descriptor elements are used to configure Web services for authorization?
A. security-constraint, login-form, realm-name
B. security-constraint, login-config, security-role
C. web-resource-constraint, login-form, security-role
D. web-resource-constraint, login-config, security-role
--
QUESTION NO: 158
Your Web application requires that an authenticated request guarantee that the
ServletRequest method isSecure returns true.
Which value of the auth-method deployment descriptor will cause this behavior?
A. HTTPS
B. DIGEST
C. CLIENT-CERT
D. CERTIFICATE
--
QUESTION NO: 159
Which will print the value of the Accept-Charset HTTP header in a JSP page?
A. <%= headers.get("Accept-Charset") %>
B. <%= page.getHeader("Accept-Charset") %>
C. <%= headers.getValue("Accept-Charset") %>
D. <%= request.getHeader("Accept-Charset") %>
--
QUESTION NO: 160
Which includes a file in a JSP page at request time?
A. <%@ include file="yoshi.html" %>
B. <%@ include page="yoshi.html" %>
C. <%@ page include="yoshi.html" %>
D. <jsp:include file="yoshi.html" />
E. <jsp:include page="yoshi.html" flush="true" />
--
QUESTION NO: 161
Which two set the content type of a JSP page? (Choose two)
A. <%@ contentType "text/plain" %>
B. <jsp:contentType "text/plain">
C. <%@ page contentType="text/plain" %>
D. <% session.setContentType("text/plain"); %>
E. <% request.setContentType("text/plain"); %>
F. <% response.setContentType("text/plain"); %>
--
QUESTION NO: 162
Which attribute and value of the jsp:setProperty action causes a JSP page to iterate over all ServletRequest parameters and assign values of the corresponding properties in a JavaBean?
Note: Type the attribute and value exactly as they would appear within the
jsp:setProperty element. Do not type any other part of the jsp:setProperty element.
昵称: swanky  时间: 2003-11-16 17:24:00

QUESTION NO: 151
What single method is defined by javax.servlet.http.HttpSessionEvent?
Note: Provide only the method name; for example, yoshi NOT yoshi().

Answer: getSession

QUESTION NO: 152
Given this fragment from a Web application deployment descriptor?
12. <context-param>
13. <param-name>user</param-name>
14. <param-value>yoshi</param-value>
15. </context-param>
From within a servlet's doPost method, which retrieves the value of the user parameter?
A. getServletConfig().getAttribute("user");
B. getServletContext().getAttribute("user");
C. getServletConfig().getInitParameter("user");
D. getServletContext().getInitParameter("user");

Answer: D

QUESTION NO: 153
What is true regarding a session within a distributed Web application?
A. URL rewriting may not be used when redirecting responses.
B. Attributes in the session object CANNOT be shared between servlet contexts.
C. An instance of HttpSessionActivationListener must be defined for each Java VM
in the servlet container.
D. Object attributes in the session object must implement the
HttpSessionActivationListener interface.

Answer: B

QUESTION NO: 154
Given the JSP page, yoshi.jsp:
1. <html>
2. <jsp:include page="abc.jsp">
3. <jsp:param name="subTitle" value="Registration Form"/>
4. </jsp:include>
5. </html>
Which would you use in the abc.jsp fragment to produce the HTML response?
<h3>Registration Form</h3>
A. <h3><jsp:getParam name="subTitle"/></h3>
B. <h3><jsp:include param="subTitle"/></h3>
C. <h3><%= request.getParameter("subTitle") %></h3>
D. <h3><%= request.getAttribute("subTitle") %></h3>

Answer: C

QUESTION NO: 155
Which correctly defines authentication?
A. Authentication identifies a user and verifies the user's passphrase.
B. Authentication protects the Web server from denial-of-service attacks.
C. Authentication uses the user's passphrase to encrypt the TCP stream.
D. Authentication verifies that a user has access to a specific resource on the Web server.

Answer: A

QUESTION NO: 156
Which two API techniques can be used to get the name of an authenticated user? (Choose two)
A. Use the getUser on the HTTP servlet request object.
B. Use the getUserName on the HTTP servlet request object.
C. Use the getRemoteUser on the HTTP servlet request object.
D. Retrieve the principal object from the HTTP servlet request object using getUser and use the getName on the principal object.
E. Retrieve the principal object from the HTTP servlet request object using getPricipal and use the getName on the principal object.

Answer: CE

QUESTION NO: 157
Which deployment descriptor elements are used to configure Web services for authorization?
A. security-constraint, login-form, realm-name
B. security-constraint, login-config, security-role
C. web-resource-constraint, login-form, security-role
D. web-resource-constraint, login-config, security-role

Answer: B

QUESTION NO: 158
Your Web application requires that an authenticated request guarantee that the
ServletRequest method isSecure returns true.
Which value of the auth-method deployment descriptor will cause this behavior?
A. HTTPS
B. DIGEST
C. CLIENT-CERT
D. CERTIFICATE

Answer: C

QUESTION NO: 159
Which will print the value of the Accept-Charset HTTP header in a JSP page?
A. <%= headers.get("Accept-Charset") %>
B. <%= page.getHeader("Accept-Charset") %>
C. <%= headers.getValue("Accept-Charset") %>
D. <%= request.getHeader("Accept-Charset") %>

Answer: D

QUESTION NO: 160
Which includes a file in a JSP page at request time?
A. <%@ include file="yoshi.html" %>
B. <%@ include page="yoshi.html" %>
C. <%@ page include="yoshi.html" %>
D. <jsp:include file="yoshi.html" />
E. <jsp:include page="yoshi.html" flush="true" />

Answer: E

QUESTION NO: 161
Which two set the content type of a JSP page? (Choose two)
A. <%@ contentType "text/plain" %>
B. <jsp:contentType "text/plain">
C. <%@ page contentType="text/plain" %>
D. <% session.setContentType("text/plain"); %>
E. <% request.setContentType("text/plain"); %>
F. <% response.setContentType("text/plain"); %>

Answer: CF

QUESTION NO: 162
Which attribute and value of the jsp:setProperty action causes a JSP page to iterate over all ServletRequest parameters and assign values of the corresponding properties in a JavaBean?
Note: Type the attribute and value exactly as they would appear within the
jsp:setProperty element. Do not type any other part of the jsp:setProperty element.

Answer: <jsp:setProperty name="address" property="*" />
昵称: swanky  时间: 2003-11-16 17:28:00
QUESTION NO: 110
Which two are true about Web application archive files? (Choose two)
A. They must NOT be signed.
B. They may contain JAR files.
C. They must have a ".web" extension.
D. They may serve files from the META-INF directory.
E. They may contain JSP files in addition to HTML files.
F. They CANNOT define their dependencies in the manifest.mf file.

Answer: D.E 

我看到有同样题目,但答案是B.D,有人可以解答一下吗??
谢谢
昵称: batpig  时间: 2004-04-08 22:57:00
batpig wrote:
QUESTION NO: 110
Which two are true about Web application archive files? (Choose two)
A. They must NOT be signed.
B. They may contain JAR files.
C. They must have a ".web" extension.
D. They may serve files from the META-INF directory.
E. They may contain JSP files in addition to HTML files.
F. They CANNOT define their dependencies in the manifest.mf file.

Answer: D.E 

我看到有同样题目,但答案是B.D,有人可以解答一下吗??
谢谢

其实我觉得B.D.E都没有错
题目可能要改成选三个~
昵称: swanky  时间: 2004-04-08 23:19:00
batpig wrote:
QUESTION NO: 110
Which two are true about Web application archive files? (Choose two)
A. They must NOT be signed.
B. They may contain JAR files.
C. They must have a ".web" extension.
D. They may serve files from the META-INF directory.
E. They may contain JSP files in addition to HTML files.
F. They CANNOT define their dependencies in the manifest.mf file.

Answer: D.E 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在信号处理领域,DOA(Direction of Arrival)估计是一项关键技术,主要用于确定多个信号源到达接收阵列的方向。本文将详细探讨三种ESPRIT(Estimation of Signal Parameters via Rotational Invariance Techniques)算法在DOA估计中的实现,以及它们在MATLAB环境中的具体应用。 ESPRIT算法是由Paul Kailath等人于1986年提出的,其核心思想是利用阵列数据的旋不变性来估计信号源的角度。这种算法相比传统的 MUSIC(Multiple Signal Classification)算法具有较低的计算复杂度,且无需进行特征值分解,因此在实际应用中颇具优势。 1. 普通ESPRIT算法 普通ESPRIT算法分为两个主要步骤:构造等效旋不变系统和估计角度。通过空间平移(如延时)构建两个子阵列,使得它们之间的关系具有旋不变性。然后,通过对子阵列数据进行最小二乘拟合,可以得到信号源的角频率估计,进一步换为DOA估计。 2. 常规ESPRIT算法实现 在描述中提到的`common_esprit_method1.m`和`common_esprit_method2.m`是两种不同的普通ESPRIT算法实现。它们可能在实现细节上略有差异,比如选择子阵列的方式、参数估计的策略等。MATLAB代码通常会包含预处理步骤(如数据归一化)、子阵列构造、旋不变性矩阵的建立、最小二乘估计等部分。通过运行这两个文件,可以比较它们在估计精度和计算效率上的异同。 3. TLS_ESPRIT算法 TLS(Total Least Squares)ESPRIT是对普通ESPRIT的优化,它考虑了数据噪声的影响,提高了估计的稳健性。在TLS_ESPRIT算法中,不假设数据噪声是高斯白噪声,而是采用总最小二乘准则来拟合数据。这使得算法在噪声环境下表现更优。`TLS_esprit.m`文件应该包含了TLS_ESPRIT算法的完整实现,包括TLS估计的步骤和旋不变性矩阵的改进处理。 在实际应用中,选择合适的ESPRIT变体取决于系统条件,例如噪声水平、信号质量以及计算资源。通过MATLAB实现,研究者和工程师可以方便地比较不同算法的效果,并根据需要进行调整和优化。同时,这些代码也为教学和学习DOA估计提供了一个直观的平台,有助于深入理解ESPRIT算法的工作原理。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值