JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java Certification » SCWCD  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 SCWCD Mock Exam [精華]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-21 22:00 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我把 worookie 所蒐集到的考題加以校對
以及把大家的回答加以整理

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

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

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


swanky edited on 2003-08-23 07:57
reply to postreply to post
作者 1~10(4題) [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-21 22:03 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
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


reply to postreply to post
作者 Re:1~10(4題) 解答 [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-21 22:07 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

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


reply to postreply to post
作者 11~20(3題) [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 14:00 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
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.


swanky edited on 2003-08-23 14:16
reply to postreply to post
作者 Re:11~20(3題) 解答 [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 14:01 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

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 edited on 2003-08-23 14:18
reply to postreply to post
作者 21~30(3題) [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 14:31 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
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?


reply to postreply to post
作者 Re:21~30(3題) 解答 [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 14:59 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

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 edited on 2003-08-23 15:13
reply to postreply to post
作者 31~40(5題) [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 16:01 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
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


reply to postreply to post
作者 Re:31~40(5題) 解答 [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 16:05 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

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


reply to postreply to post
作者 41~50(7題) [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 18:42 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
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


reply to postreply to post
作者 Re:41~50(7題) 解答 [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 18:44 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

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


reply to postreply to post
作者 51~60(3題) [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 18:51 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
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.


reply to postreply to post
作者 Re:51~60(3題) 解答 [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 18:53 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

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


reply to postreply to post
作者 61~70(4題) [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 19:11 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
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)


reply to postreply to post
作者 Re:61~70(4題) 解答 [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 19:13 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

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


reply to postreply to post
作者 71~80(3題) [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 19:19 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
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?


reply to postreply to post
作者 Re:71~80(3題) 解答 [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 19:20 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

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


reply to postreply to post
作者 81~90(4題) [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 21:47 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
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


reply to postreply to post
作者 Re:81~90(4題) 解答 [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 21:49 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

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


reply to postreply to post
作者 91~100(4題) [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 22:01 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
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 edited on 2004-05-09 08:11
reply to postreply to post
作者 Re:91~100(4題) 解答 [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-08-23 22:04 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

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 edited on 2004-05-09 08:11
reply to postreply to post
作者 101~110(7題) [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-09-06 09:10 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
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.


reply to postreply to post
作者 Re:101~110(7題) 解答 [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-09-06 09:15 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

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


reply to postreply to post
作者 111~120(9題) [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-09-06 09:18 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
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.


reply to postreply to post
作者 Re:111~120(9題) 解答 [Re:swanky]
swanky

暴走熊

版主

發文: 461
積分: 9
於 2003-09-06 09:22 user profilesend a private message to usersend email to swankyreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

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 edited on 2004-03-18 23:06
reply to postreply to post
go to first page go to previous page  1   2   3  go to next page go to last page
» JWorld@TW »  Java Certification » SCWCD

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8