Statement

A JSP page is compiled into a Servlet; therefore, it can do everything that a Servlet can do. If the above statement is TRUE, then why is an IllegalStateException thrown when opening a Binary Stream output to the client from a JSP page but NOT to a Servlet? JSP pages use a different Streaming mechanism to Servlets. JSP pages can write a Binary Stream using its implicit out stream.

Choice 1 Choice 2 Choice 3 Choice 4

JSP pages must flush their buffers before changing the stream type; Servlets do not have this limitation. JSP pages have more security settings than Servlets. JSP has already opened the stream as a JspWriter.

Choice 5

Submit

Java Server Pages (JSP 1.1), Question 1 of 40

Take a 15 minute break AFTER this question (one per test)

©1998 - 2002 Brainbench, Inc. All rights reserved.

Example Syntax

<calculate>9+10*4/2+1</calculate> Given the above example syntax, which class is EXTENDED to implement a custom tag that parses an expression in its body, calculates, and then displays the result of that expression? javax.servlet.jsp.tagext.BodyTag

Choice 1

javax.servlet.jsp.tagext.TagData
Choice 2

javax.servlet.jsp.tagext.Tag
Choice 3

javax.servlet.jsp.tagext.TagBody
Choice 4

javax.servlet.jsp.tagext.BodyTagSupport
Choice 5

Submit

Java Server Pages (JSP 1.1), Question 2 of 40

Take a 15 minute break AFTER this question (one per test)

Sample Code

<html> <body> <jsp:include file="sidemenu.html"/> <jsp:useBean id="checkout" scope="page" class="com.shop.CheckOut" /> <% if (checkout.ifTransactionComplete()) { %> <jsp:forward page="confirmpurchase.jsp" /> <% } %> <jsp:include file="checkout.html"/> </body> </html> Assume that the sample sales JSP page above for an e-commerce store is syntactically correct. Why does the page sometimes result in an IllegalStateException being thrown? One of the relative URLs does not exist.

Choice 1 Choice 2 Choice 3

The jsp:forward only works if the JSP buffer has been flushed prior to the jsp:forward call. The sample JSP page is not thread safe. The jsp:forward cannot be called after jsp:include.

Choice 4

The jsp:useBean tag must be declared at the top of the file.
Choice 5

Submit

Java Server Pages (JSP 1.1), Question 3 of 40

Take a 15 minute break AFTER this question (one per test)
©1998 - 2002 Brainbench, Inc. All rights reserved.

Which one of the following implicit objects is used to determine the scope of a given object or attribute? response
Choice 1

application
Choice 2

pageContext
Choice 3

config
Choice 4

session
Choice 5

Submit

Java Server Pages (JSP 1.1), Question 4 of 40

Take a 15 minute break AFTER this question (one per test)

©1998 - 2002 Brainbench, Inc. All rights reserved.

Inc.1).Which implicit object represents a java.2002 Brainbench.Throwable object? error Choice 1 pagecontext Choice 2 exception Choice 3 response Choice 4 config Choice 5 Submit Java Server Pages (JSP 1. Question 5 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 .lang. . All rights reserved.

2002 Brainbench.How do you include a file in your JSP file that you do NOT know the filename of until runtime? <%jsp:include file="prompt user"%> Choice 1 <%@include file="<%= filename %>"%> Choice 2 <%@jsp:include page="null"%> Choice 3 <jsp:include page="<%= filename %>"> Choice 4 <%include page="null"%> Choice 5 Submit Java Server Pages (JSP 1.1). Question 6 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . Inc. . All rights reserved.

From a Web Application that has been deployed via a Web Archive (WAR) file. how can files from the WEB-INF directory be retrieved? servletContext.1).getResource() Choice 1 <%@ include file="/WEB-INF/file"/%> Choice 2 <jsp:include file="/WEB-INF/file"/> Choice 3 Choice 4 Choice 5 From a Web browser. Question 7 of 40 Submit Take a 15 minute break AFTER this question (one per test) ©1998 . request http://domain/appname/WEBINF/file new FileOutputStream(new File("/WEB-INF/file")) Java Server Pages (JSP 1. .2002 Brainbench. All rights reserved. Inc.

Choice 3 All of the .1.class files have not been sent to the Web Server. Choice 2 The client browser is not using Java 1. .Problem Your JSP file compiles just fine.2002 Brainbench. Question 8 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . Choice 4 Your beans do not belong to the package.1 instead of API 2.1). Why does the above problem occur? You are using API 2. Choice 1 The useBean tag has not been defined from within the script. however. All rights reserved.2.1. Choice 5 Submit Java Server Pages (JSP 1. All of the required files have been included on the CLASSPATH and exist on the Web Server. you always get a NoClassDefFoundError when you try to access a bean via the useBean tag. Inc.

Question 9 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . .2002 Brainbench. Inc. All rights reserved.Which one of the following JSP lifecycle methods CANNOT be defined within a JSP page? _jspService() Choice 1 jspInit() Choice 2 _jspRemove() Choice 3 jspRestore() Choice 4 jspDestroy() Choice 5 Submit Java Server Pages (JSP 1.1).

. Inc.2002 Brainbench.Sample Code <%! line 1: String nameSake. %> Which one of the lines above causes a compile-time error? Line 2 Choice 1 Line 3 Choice 2 Line 4 Choice 3 Line 5 Choice 4 Code will compile.1). } Line 6: float amount = 1. Line 4: synchronized void doItAgain() {} Line 5: int getCount() { return count. Line 3: String rollUp = count + " " + nameSake.00f. Choice 5 Submit Java Server Pages (JSP 1. All rights reserved. Question 10 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . Line 2: int count = 0.

1). All rights reserved.Which implicit object is used to determine the real path to a resource on the Web Server? session Choice 1 config Choice 2 pageContext Choice 3 request Choice 4 application Choice 5 Submit Java Server Pages (JSP 1. Inc. Question 11 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . .2002 Brainbench.

setMaxInactivePeriod(10*60) Choice 3 session.1). All rights reserved.Which one of the following commands causes a JSP session to be automatically closed after the user has been inactive for 10 minutes? response.setExpirePeriod(10*60) Choice 1 session.setMaxIdleTime(10*60) Choice 5 Submit Java Server Pages (JSP 1. . Inc.setMaxInactivePeriod(10) Choice 4 sessionContext. Question 12 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 .setMaxInactiveInterval(10*60) Choice 2 session.2002 Brainbench.

. if(counter > 3) { %> Counter is greater than three (<%= new Integer(counter). %> <% boolean flag = false. Question 13 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . (1) Counter is still less than three. (4) Choice 4 An IllegalStateException will be thrown.2002 Brainbench.Sample Code <%! int counter = 0. Inc.toString() %>)! <% } %> What is the output of the above JSP the second time the document is accessed? Counter is still less than three. Choice 5 Submit Java Server Pages (JSP 1. %> Counter is still less than three (<%= new Integer(counter). All rights reserved. (2) Choice 1 Choice 2 Counter is still less than three.1).toString() %>)! <% } else { counter++. counter++. (4) Choice 3 Counter is greater than three.

1). During system testing. All rights reserved. Inc. a customer can view his or her current bank details and transfer money between accounts. Question 14 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . Given the above scenario. this problem does not exist if the user disconnects cleanly. . However.2002 Brainbench.finalize() Choice 3 Implement JspSessionListener Choice 4 Implement JspScopeListener Choice 5 Submit Java Server Pages (JSP 1. it has been discovered that the BankSession bean does not close cleanly the moment the user's session times out.release() Choice 1 Implement HttpSessionBindingListener Choice 2 Implement BankSession. a BankSession bean is added to the JSP Session Scope.Scenario In a banking Web Application. When the user logs out. the BankSession bean is removed from the JSP Session Scope. what can be done to solve this? Implement BankSession. When a user logs on.

1). what can be done by authors of custom tag libraries to prevent the data integrity of the tag handlers from being corrupted? Implement a cleanup finalize() method. Choice 5 Submit Java Server Pages (JSP 1. some JSP Engines reuse the Java instances of a Custom Tag. Choice 1 Choice 2 Nothing. Each tag should synchronize on a lock object. the JSP Engine handles all of these issues for all custom Tags. . Given that some JSP Engines have the above optimization.Information As a performance optimization. Choice 4 Implement a cleanup release() method. Choice 3 Implement a TagPoolListener.2002 Brainbench. Inc. All rights reserved. Question 15 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 .

Which one of the following code segments is sent to the browser exactly as is? <%= "this is a comment" %> Choice 1 <% String comment="this is a comment" %> Choice 2 <!-. All rights reserved.1).2002 Brainbench."this is a comment" --%> Choice 5 Submit Java Server Pages (JSP 1. Question 16 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . . Inc."this is a comment" --> Choice 3 <%@ page comment="this is a comment" %> Choice 4 <%-.

Choice 1 The users2resource is not thread safe. <%= users2resource.Sample Code <%! HashMap users2resource = new HashMap(). exists for the sample JSP page above? j = j+1 is not atomic. if any. . Choice 5 Submit Java Server Pages (JSP 1. .get(.put(.) %> <% int j. . Question 17 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . Choice 3 The people is not thread safe..2002 Brainbench.1).) %> What potential problem. Inc. %> . Choice 2 There is no problem.. Choice 4 The resources put into people will never be garbage collected. %> <% HashMap people = new HashMap() %> <% users2resource. j = j+1. All rights reserved.

What is the implication of using cookies to track sessions when a user opens multiple browser windows? Neither browser will share the same session ID. Choice 5 Submit Java Server Pages (JSP 1.1). Choice 2 It does not list any entries in the session logs. Inc. Question 18 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 .2002 Brainbench. Choice 4 The page cannot be bookmarked. Choice 3 Duplicate entries in the session logs will occur. All rights reserved. . Choice 1 They will both share the same session ID.

Inc. Question 19 of 40 Submit Take a 15 minute break AFTER this question (one per test) ©1998 . .Choice 1 Choice 2 Choice 3 Choice 4 Choice 5 Which one of the following describes the benefit of using a <jsp:plugin /> tag? It ensures that the client-side program will be loaded from the browser every time it is executed. It allows internationalization features of the scripting language to be used. All rights reserved. Java Server Pages (JSP 1. It ensures that the correct HTML tag is placed in the output for the given browser.2002 Brainbench. It reduces the size of a JSP that includes applets or other client-side programs.1). It avoids the need for signed code when serving applets or other client-side programs.

%> When the JSP code above is translated. Question 20 of 40 Submit Take a 15 minute break AFTER this question (one per test) ©1998 .i<10. Inc.println(++count). All rights reserved. %> <% for(int i=0. out.i++) out. %> String there = "there".1).2002 Brainbench.println(myStr + " " + there). Choice 2 All scriptlet variables are defined with "page" level scope. and a translation error will occur.Sample Code <% <% String myStr = "Hello". All scriptlet code becomes part of the same method. Java Server Pages (JSP 1. . Choice 3 Choice 4 Choice 5 The variables are not available across scriptlets. int count = 1. how are the variables defined in different scriptlets made available to the other scriptlets? All scriptlet variables are defined as class variables. Choice 1 The translator copies all variables to each scriptlet before compiling.

Tag OR javax.tagext.jsp.tagext.servlet.tagext.TagSupport OR javax.JspPage Only javax.servlet.jsp.1).BodyTagSupport Java Server Pages (JSP 1.jsp.BodyTag Choice 1 Choice 2 Choice 3 javax.2002 Brainbench.servlet.tagext.BodyTag Only javax.jsp.servlet.servlet.tagext.Tag Choice 4 Choice 5 javax. All rights reserved.tagext.jsp.A tag handler object is a Java object that implements what interface? Only javax.jsp. Question 21 of 40 Submit Take a 15 minute break AFTER this question (one per test) ©1998 .servlet.servlet. Inc.jsp. .

All rights reserved. Question 22 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 .jsp" /> Within a JSP document.2002 Brainbench.1). Inc. given that the JspWriter's buffer will NOT be flushed until the end of the JSP page has been reached? Anywhere within the document Choice 1 Only before any directives Choice 2 Only on the very first line of the document Choice 3 Only before any declarations Choice 4 Only before any scriptlets that write output to the Response object Choice 5 Submit Java Server Pages (JSP 1. where can the above code appear.Sample Code <jsp:forward page="eBusiness. .

Inc. .Image Given the above diagram. Which one of the following technologies is an INCORRECT choice for the visualization component? JSP Choice 1 ASP Choice 2 HTML Choice 3 TLD Choice 4 PHP Choice 5 Submit Java Server Pages (JSP 1.2002 Brainbench. the Model 2 architecture is an adaptation of the Model View Controller (MVC) paradigm for Web sites that use JSP pages.1). All rights reserved. Question 23 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 .

All rights reserved.2002 Brainbench.1).getTags() Choice 5 Submit Java Server Pages (JSP 1.getTags() Choice 4 tagLibraryInfo.getTags() Choice 3 tagLibraryContext.getTags() Choice 1 jspEngine.getTags() Choice 2 tagSupport. Inc.How is it possible to programmatically retrieve a list of custom tags supported by a tag library? tldInfo. Question 24 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . .

Inc.Image The diagram above shows the Server process of creating and running JSP Servlets. . Question 25 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 .1). One of the steps has been blanked out with XXX.2002 Brainbench. Which one of the following correctly describes this step? JSP Page Changed Choice 1 Beans Valid Choice 2 Database Active Choice 3 JSP Engine Active Choice 4 JSP Page pre-compiled Choice 5 Submit Java Server Pages (JSP 1. All rights reserved.

Information Choice 1 Choice 2 A security policy domain is a scope over which security policies are defined and enforced by a security administrator.2002 Brainbench. Inc. Java Server Pages (JSP 1. Question 26 of 40 Submit Take a 15 minute break AFTER this question (one per test) ©1998 . Based on the information above. The security policy has a collection of users or principals. All rights reserved. Choice 3 Choice 4 Choice 5 The security policy uses a well-defined authentication protocol(s) for authenticating users. . The security policy contains an object that encapsulates single state information between two entities. which one of the following is NOT a characteristic of a security policy domain upon which a JSP can run? The security policy ensures that multiple security policy domains can exist within a single technology domain. The security policy may have groups to simplify setting of security policies.1).

.1). All rights reserved.2002 Brainbench. Question 27 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 .Which one of the following CANNOT be defined inside a JSP page? A class method Choice 1 A _httpService method Choice 2 A _jspService method Choice 3 A class Choice 4 A static method Choice 5 Submit Java Server Pages (JSP 1. Inc.

2002 Brainbench.Context Choice 1 Choice 2 Choice 3 Choice 4 Choice 5 By default.1). to set non-sensitive Bean properties. . Inc. Avoid revealing the name of sensitive properties by not using Bean aliases. Java Server Pages (JSP 1. Question 28 of 40 Submit Take a 15 minute break AFTER this question (one per test) ©1998 . a client has access to all of a Bean's properties. Mark sensitive Bean attributes as "Read-Only" in BeanInfo PropertyDescriptors. Use a shadow Bean. All rights reserved. also known as a proxy Bean. how can you prevent a client from accessing sensitive Bean properties? Use a firewall or a proxy to discourage data from being sent back to the client browser. Do not place the Bean in the root or virtual root directory. Given the above context.

1).Sample Code <jsp:useBean id="ww" scope="page" class="Ww.class" are created in the JSP engine after the JSP containing the above code is accessed five times? 0 Choice 1 1 Choice 2 2 Choice 3 4 Choice 4 5 Choice 5 Submit Java Server Pages (JSP 1.2002 Brainbench. Inc. Question 29 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . . All rights reserved.class" /> How many instances of the "Ww.

com/jsp Choice 2 /f1/temp1.xyz.1).Which one of the following URLs can be used inside a <jsp:include /> statement? http://www.jsp Choice 4 https://www.com/code/tt.jsp Choice 1 http://www.com Choice 5 Submit Java Server Pages (JSP 1.xyz.2002 Brainbench.xyz. . Inc.jsp Choice 3 ftp://ftp.com/dir1/temp1.xyz. All rights reserved. Question 30 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 .

getPageInfo() Choice 5 Submit Java Server Pages (JSP 1.Sample Code <%@ page info="Here is the info you requested.1)." %> Which one of the following methods is used to access the page information embedded in the directive above within a JSP? page.getServletInfo() Choice 4 page.2002 Brainbench.getInfo() Choice 3 page.getJspInfo() Choice 1 pageContext. All rights reserved. .getJspProperty() Choice 2 pageContext. Question 31 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . Inc.

2002 Brainbench. All rights reserved. Choice 5 Submit Java Server Pages (JSP 1. %> <% start += 1.%> Start=<%= start %> After the above JSP has been accessed five times. Inc. the page is not thread safe.Sample Code <%! int start = 0. Choice 4 It could be anything. .1). Question 32 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . what is the output on the sixth access? Start=0 Start=5 Choice 1 Choice 2 Start=6 Choice 3 The JSP page throws an exception.

When implementing a new custom tag. All rights reserved. Question 33 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . what is the role of a Tag Extra Info (TEI) class? Only to store meta information about the Tag Choice 1 Choice 2 Choice 3 Choice 4 To add extra validation to the custom tag and to declare new scripting variables introduced by the Tag To store meta information about the Tag and to add extra validation to the custom tag Only to add extra validation to the custom tag Only to declare new scripting variables introduced by the Tag Choice 5 Submit Java Server Pages (JSP 1. Inc.1). .2002 Brainbench.

How can a custom tag introduce new scripting variables into a JSP page? Implement getVariableInfo() on a TagExtraInfo class Choice 1 Choice 2 Choice 3 Add <scripting-variable>. Inc. Question 34 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 .</scripting-variable> to the tag's Tag Library Descriptor (TLD) entry Implement a new TagAttributeInfo for each new Scripting Variable Implement getScriptingVariables on a TagInfo class Choice 4 Implement getScriptingVariables to the tag's class implementation Choice 5 Submit Java Server Pages (JSP 1.1).2002 Brainbench. All rights reserved. ..

1).Sample Code <jsp:include page="second.addCookie() Choice 5 Submit Java Server Pages (JSP 1.encodeURL() Choice 2 response. which one of the following methods causes an exception to be thrown if called by code in "second. Inc.getCharacterEncoding() Choice 3 response.getWriter() Choice 1 response.2002 Brainbench.getOutputStream() Choice 4 response.jsp" flush="true" /> Using the code fragment shown above. Question 35 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . All rights reserved.jsp"? response. .

Inc. .2002 Brainbench. Question 36 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 .1). All rights reserved.What object or scriptlet code inside a JSP returns a reference to the JSP's javax.getContext() Choice 4 context Choice 5 Submit Java Server Pages (JSP 1.getServletContext() Choice 2 application Choice 3 config.ServletContext object? page.getContext() Choice 1 request.servlet.

2002 Brainbench. . Inc. All rights reserved.1).1 specification.As stated in the JSP1. Question 37 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . what do Custom Tag Libraries offer to Web Developers? Ability to distribute processing Choice 1 Dynamic modification of the browser Choice 2 Macros Choice 3 Compile time checking Choice 4 New actions Choice 5 Submit Java Server Pages (JSP 1.

Question 38 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . Inc. All rights reserved. .2002 Brainbench.out. %> Choice 1 <%@ output value="Hello" %> Choice 2 <%= "Hello" %> Choice 3 <% System.Which one of the following code segments sends a string of "Hello" STRAIGHT to the requesting client? <% out. %> Choice 4 <%! "Hello" %> Choice 5 Submit Java Server Pages (JSP 1.1).println("Hello").print("Hello").

1). in which method is the String object "t1" declared? Not in any method Choice 1 init method Choice 2 doGet method Choice 3 doPost method Choice 4 service method Choice 5 Submit Java Server Pages (JSP 1. .Sample Code <%! String t1="hello". All rights reserved. Question 39 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . %> When the declaration above is made in a JSP.2002 Brainbench. Inc.

Which one of the following correctly describes what happens at XXX? doBeforeTag Choice 1 Clear Buffer Choice 2 Read in Tag's Body Choice 3 Set Attributes Choice 4 Initialize Tag's Body Choice 5 Submit Java Server Pages (JSP 1. Inc. All rights reserved.Image The flow diagram above describes the live cycle of a BodyTag. Question 40 of 40 Take a 15 minute break AFTER this question (one per test) ©1998 . but it is missing a label.2002 Brainbench.1). .

21. You have now earned a Master certification in Java Server Pages (JSP 1.1).Congratulations! You passed at the Master's Level with a score of 4. Your Transcript ID Number is 3025842 .

Sign up to vote on this title
UsefulNot useful