1) 1) final int MAX_COUNT = 9;
2) static int MAX_COUNT = 9;
3) int MAX_COUNT;
4) synchronized void doIt() { x++; }
5) public void doIt() { x++; }
Which line(s) of the above code fragments can appear inside a <%
.. %> SCRIPTLET?
Choice 1 Lines 1 and 2
Choice 2 Lines 1 and 3
Choice 3 Lines 2 and 5
Choice 4 Only Line 4
Choice 5 Only Line 5
3)How do you include a file in your JSP file that you do NOT know the
filename of until runtime?
Choice 1 <%@include file="<%= filename %>"%>
Choice 2 <%@jsp:include page="null"%>
Choice 3 <%jsp:include file="prompt user"%>
Choice 4 <%include page="null"%>
Choice 5 <jsp:include page="<%= filename %>">
4)You are nearing the end of a tight deadline, but the JSP page performance
is still too
slow.
Given the above scenario and that you have LIMITED time, which one of
the following
standard techniques do you use to gain a substantial JSP-DB performance gain?
Choice 1 Cache query data in the Web Server
Choice 2 Off-load page processing to client browsers
Choice 3 Move the database onto the same machine as the Web Server
Choice 4 Implement a Connection Pool
Choice 5 Add more Web Servers
5)<% if (someValue == 1) { %>
<%@ include file="filename" %>
Given the sample code above, how do you properly finish the "if"
statement?
Choice 1 Close the scriptlet using END ELSE.
Choice 2 Issue a Return statement to complete the scriptlet.
Choice 3 Close the scriptlet using <% } %>.
Choice 4 End the scriptlet using <%{ END If }>.
Choice 5 End the scriptlet using --%>.
6)Which one of the following URLs can be used inside a <jsp:include
/> statement?
Choice 1 https://www.xyz.com
Choice 2 ftp://ftp.xyz.com/dir1/temp1.jsp
Choice 3 http://www.xyz.com/code/tt.jsp
Choice 4 http://www.xyz.com/jsp
Choice 5 /f1/temp1.jsp
7)Which one of the following implicit objects is used to determine
the local scope of a given object or attribute?
Choice 1 config
Choice 2 application
Choice 3 pageContext
Choice 4 response
Choice 5 session
8)
<%!
String str1 = "Friend";
int int1 = 0;
%>
<%
String str1 = "Expert";
int1 = 3;
int1++;
%>
You are <%= str1 %> number <%= int1 %>.
Which one of the following is the output of the above code?
Choice 1 You are Friend number zero.
Choice 2 You are Friend number three.
Choice 3 You are Friend number four.
Choice 4 You are Expert number one.
Choice 5 You are Expert number four.
9)Which one of the following statements regarding JSPs is TRUE?
Choice 1 A JSP is compiled every time it is requested in a URL.
Choice 2 A JSP document is interpreted, not compiled, by the JSP engine when
its URL is requested.
Choice 3 A JSP document is compiled once per 24 hours by most JSP engines.
Choice 4 A JSP document is compiled directly whenever a new copy is loaded.
Choice 5 A JSP is converted into a Servlet .java file and then compiled whenever
it is changed and requested.
10)Fixed template data is any tag that a JSP engine passes straight through
to the browser
without modifying.
Based on the above, which one of the following appears in a fixed template?
Choice 1 <jsp:useBean/>
Choice 2 <com:translate id="hello.txt"/>
Choice 3 <jsp:include>
Choice 4 <% } else { %>
Choice 5 <H1>
11)Which one of the following code segments is sent to the browser
exactly as is?
Choice 1 <% String comment="this is a comment" %>
Choice 2 <%= "this is a comment" %>
Choice 3 <%-- "this is a comment" --%>
Choice 4 <%@ page comment="this is a comment" %>
Choice 5 <!-- "this is a comment" -->
12)Which implicit object represents a java.lang.Throwable object?
Choice 1 error
Choice 2 pagecontext
Choice 3 exception
Choice 4 config
Choice 5 Response
13)Which one of the following is NOT a valid attribute for the
jsp:useBean statement?
Choice 1 scope
Choice 2 class
Choice 3 beanType
Choice 4 Id
14)What attribute of the page directive can you use to have uncaught
run-time exceptions automatically forwarded to an error processing page?
Choice 1 page.error()
Choice 2 Respond
Choice 3 errorPage
Choice 4 Exception
Choice 5 javax.throwable
15) What of the following are valid scopes of a bean that is used in a JSP page?
a. request, response,application
b. request, response, session
c. application, session, request, page
d. page, session, application, response
![]() |
![]() |