love fish大鹏一曰同风起,扶摇直上九万里

常用链接

统计

积分与排名

friends

link

最新评论

SCWCD Mock Exam(转)


我把 worookie 所蒐集到的考題加以校對
以及把大家的回答加以整理

依照樹狀結構分為題目以及答案
所以大家可以使用樹狀結構的瀏覽進行自我測驗

由於考題來源不一
所以會以十個題號為一個單位貼出
旁邊附註實際的題數

如果題目有錯誤或是解答不夠詳盡
歡迎大家提出討論 Smile

2.1~10(4題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-21 22:03

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

3.Re:1~10(4題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-21 22:07


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
publicvoid init(ServletConfig config) throws ServletException {
   _config = config;
   log("init called");
   init();
}publicvoid 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

4.11~20(3題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 14: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.

5.Re:11~20(3題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 14:01


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

6.21~30(3題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 14:31

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?

7.Re:21~30(3題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 14:59


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 %>

8.31~40(5題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 16:01

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

9.Re:31~40(5題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 16:05


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

10.41~50(7題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 18:42

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

11.Re:41~50(7題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 18:44


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

12.51~60(3題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 18:51

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.

13.Re:51~60(3題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 18:53


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

14.61~70(4題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 19:11

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)

15.Re:61~70(4題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 19:13


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

16.71~80(3題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 19:19

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?

17.Re:71~80(3題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 19:20


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

18.81~90(4題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 21:47

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

19.Re:81~90(4題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 21:49


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

20.91~100(4題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 22:01

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.

21.Re:91~100(4題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-08-23 22:04


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

22.101~110(7題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-09-06 09:10

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.

23.Re:101~110(7題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-09-06 09:15


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

24.111~120(9題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-09-06 09:18

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.

25.Re:111~120(9題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-09-06 09:22


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

26.121~130(9題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-11-16 16:49

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

27.Re:121~130(9題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-11-16 16:57


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

28.131~140(9題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-11-16 17:04

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.

29.Re:131~140(9題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-11-16 17:12


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

30.141~150(9題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-11-16 17:17

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>

31.Re:141~150(9題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-11-16 17:21


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

32.151~162(12題) [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-11-16 17:24

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.

33.Re:151~162(12題) 解答 [Re: swanky] Copy to clipboard
Posted by: swanky
Posted on: 2003-11-16 17:28


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="*" />

34.Re:101~110(7題) 解答 [Re: swanky] Copy to clipboard
Posted by: batpig
Posted on: 2004-04-08 22:57

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,有人可以解答一下嗎??
謝謝

35.Re:101~110(7題) 解答 [Re: batpig] Copy to clipboard
Posted by: swanky
Posted on: 2004-04-08 23:19

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都沒有錯
題目可能要改成選三個~

36.Re:101~110(7題) 解答 [Re: batpig] Copy to clipboard
Posted by: frankyilee
Posted on: 2004-04-11 13:49

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,有人可以解答一下嗎??
謝謝


這題我記得以前考SCWCD有出現這題...我是選 d e
結果好像錯了...我也是覺得該選 b d e 可惜考試就
要您挑 2個正確答案

37.Re:SCWCD Mock Exam [Re: swanky] Copy to clipboard
Posted by: b701209
Posted on: 2004-05-02 23:50

QUESTION NO: 137

答案應該是 D....
---------------------------------------------

Embaressed對不起 是E
<session-timeout>才是以分為單位

38.Re:SCWCD Mock Exam [Re: b701209] Copy to clipboard
Posted by: frankyilee
Posted on: 2004-05-03 01:18

b701209 wrote:
QUESTION NO: 137

答案應該是 D....


setMaxInactiveInterval() 是以秒為單位.....
答案是 E 並沒有錯

39.Re:SCWCD Mock Exam [Re: swanky] Copy to clipboard
Posted by: des001
Posted on: 2004-05-09 04:40

抱走熊兄
正在複習您整理的模考題..很棒的整理!
發現Question 92 的 javax.servlet.jsp.target.Tag
有點筆誤,應為 javax.servlet.jsp.tagext.Tag
雖不是什麼大錯誤,還是很雞婆的提一下
怕別的朋友一時誤會了.......^^

40.Re:SCWCD Mock Exam [Re: des001] Copy to clipboard
Posted by: swanky
Posted on: 2004-05-09 08:12

des001 wrote:
抱走熊兄
正在複習您整理的模考題..很棒的整理!
發現Question 92 的 javax.servlet.jsp.target.Tag
有點筆誤,應為 javax.servlet.jsp.tagext.Tag
雖不是什麼大錯誤,還是很雞婆的提一下
怕別的朋友一時誤會了.......^^

已更正
感謝~Smile

41.Re:SCWCD Mock Exam [Re: swanky] Copy to clipboard
Posted by: paulma
Posted on: 2004-12-31 17:35

請問這份考題適用SCWCD1.4 版本嗎? 謝謝!

42.Re:SCWCD Mock Exam [Re: paulma] Copy to clipboard
Posted by: swanky
Posted on: 2005-01-04 16:23

paulma wrote:
請問這份考題適用SCWCD1.4 版本嗎? 謝謝!

不適用喔
這是1.3的~

43.Re:SCWCD Mock Exam [Re: swanky] Copy to clipboard
Posted by: ttlz
Posted on: 2005-01-15 00:57

先感谢一下斑竹
请问第70题
选项c 为什么不行

44.Re:SCWCD Mock Exam [Re: swanky] Copy to clipboard
Posted by: emt2a7
Posted on: 2005-05-19 22:56

回答第70題:
因為給0或是0以上的正值,session是會time out掉的,
給個負值,比如說-1,那這樣session就永遠不會time out掉的,除非把Servlet Container給關掉。
PS.如有錯誤,請指教。新手~~~

45.Re:101~110(7題) 解答 [Re: frankyilee] Copy to clipboard
Posted by: edmak
Posted on: 2005-07-12 05:18

I think the answer should be B , E.
Answer D is unlikely to be correct becuase pages are not directly accessible under META_INF. ( rf. Head First JSP & Servlet p582 )

46.Re:SCWCD Mock Exam [Re: swanky] Copy to clipboard
Posted by: nightsky_ting
Posted on: 2005-08-12 01:30

This mock exam is for version 1.4 or 1.3??

47.Re:SCWCD Mock Exam [Re: swanky] Copy to clipboard
Posted by: u8806145
Posted on: 2006-04-06 23:22

在第111題中:
我想只要是*.bop...都可以對到吧

posted on 2006-05-19 18:45 liaojiyong 阅读(1570) 评论(0)  编辑  收藏 所属分类: Knowledge


只有注册用户登录后才能发表评论。


网站导航: