JSP ________ let you insert arbitrary code into the servlet's _JspService method (which is
called by service).
Scriptlets.
A. scriptlets
B. expressions
C. declarations correct answers A
Considerthe HTML code below. Which ofthe following method calls can retrieve the "email"
value sentfrom the browser? (Choose one)
A. getField("email") of HttpServletRequest
B. getFormValue("email") of HttpServletRequest
C. getParameter("email") ofServletRequest
D. getParameters("email") of HttpServlet correct answers C
3. Which ofthe following elements are used for error handling and are child elements of
<web-app> ofa deployment descriptor?
A. <error-location>
B. <error>
C. <error-page>
D. <error_page> correct answers C
4. Consider the following taglibrary descriptor element
<tag>
<name>Hello<lname>
<tag-class>com.abc.HelloTag</tag-class>
<body-content> "- </body-content>
</tag>
Which ofthe following is NOT a valid value for <body-content> element?
A. empty
B. tagdependent
C. JSP
D. generic correct answers C
5. Which statements are BEST describe isErrorPage attribute of <%@ page
isErrorPage=_.°/o> directive?
A. Specifies ifthe current page is an error page thatwill be invoked in response to an error on
another page. lfthe attribute value is true. the implicit object exception is create:
B. Specifies the MIME type ofthe data in the response to the client The default type is
textlhtml.
C. Any exceptions in the current page that are not caught are sent to the error page for
processing. The error page implicit object exception references the original exception.
D. Specifies the class from which the translated JSP will be inherited. This attribute must be a
fully qualified package and class name. correct answers C
6. Which is the CORRECT statement about JMS?
A. JMS enhances access to email services
B. JMS uses JNDI to find destination
C. JMS uses JMX to create a connectionFactory correct answers B
,7. Identify the parent element of <session-timeout> element in webxml correct answers A.
<webapp>
B. <session-config>
C. <session-configuration>
D. <session_config>
B
8. EJB 3.0 specifications are first implemented in_______ correct answers A. Java EE 5
B. Java EE 4
C. Java EE 3
D. Java EE 6
A
9. Study the statements: correct answers 1) The special directory [WEB-INF/lib contains Java
class files-servlets and supporting code.
2) The special directory [WEB-INF/classes contains JAR files with supporting libraries of
code.
A. Both 1 and 2 are true
B. Both 1 and 2 are not true
C. Only statement2 is true
D. Only statement 1 is true
B
10. You want to use a bean that is stored in "com/enthu/GUl.ser" file. Which offollowing
statements correctly defines the tag that accesses the bean? correct answers A. <jsp:useBean
id="pref' name="com.enthu.GUl"
B. <jsp:useBean id="pref' type="com/enthu/GUl.ser"
C. <jsp:useBean id="pref' beanName="com.enthu.GUl" type="com.enthu.GUl"/>
D. <jsp:useBean id="pref" class="com.enthu.GUl.ser"
E. <jsp:useBean id="pref' name="com/enthu/GUI.ser" l>
C
11. Consider the following tag declaration in a TLD file: correct answers <tag>
<name>simplelnterest</name>
<tag-class>SimplelnterestTag</tag-class>
</tag>
SimplelnterestTag calculates simple interest for any amount and requires two attributes
'amount' and 'rate'.
Which of the following sub elements would you need to add inside the <tag> element in the
TLD in place of //1 as shown above?
Two separate <attribute> elements.
A. One <attribute> element with sub'elements
B. One <attribute-list> element with sub-elements
C. One <amount> element and one <rate> element
A
12. An objectwith page scope exists in every JSP ofa patticularWeb application. correct
answers A. True
B. False
,B
13. To be a servlet a class should extend HttpServlet and override doGet or doPost depending
on whetherthe data is being sent by GET or by POST. correct answers A. True
B. False
A
14. In which ofthe following cases will the method doEndTag( ) ofa tag handler be invoked?
correct answers A. lt will be invoked only if doStartTag( ) and doAfterBody( ) complete
successfully.
B. This method is invoked if doStartTag( ) method returns true.
C. lt will be invoked only if doStartTag( ) or doAfterBody( ) return Tag.DO_END_TAG.
D. lt will be invoked in all case even if doStartTag( ) or doAfterBody( ) throw an exception.
C
15. What is the result of attempting to access the following JSP page? correct answers
<html>
<body>
<%! public String methodA(){
return methodB():
}
%>
<%! public String methodB(){
return "JAD Final Test":
}
%>
<h2><%= methodA() %></h2>
</body>
</html>
A. A runtime error occurs.
B. A translation error occurs.
C. The web page is blank.
D. JAD Final Test" is output to the resulting web page.
D
16. Which ofthe following lines of code are correct? (Choose one) correct answers A.
@Entity
public class Company{
...
}
public class Employee extends Company{
...
}
B. @Entity
public class Company{
...
}
@Entity
public class Employee extends Company{
...
, }
C. All of others
D. public class Company{
...
}
C
17. Which ofthe following statement correctly store an object associated with a name at a
place where all the servlets/jsps ofthe same webapp participating in a session can access it'?
correct answers Assume that request response. name. value etc. are references to objects of
appropriate types.(Choose one)
A. request.setAttribute(name, value):
B. request.getSession.setAttribute(name, value):
C. response.setAttribute(name, value);
D. request.setParameter(name, value)
B
18. Your web application named "FWorks" uses SpecialMath.class. This is an unbundled
class and is not contained in any jar file. correct answers Where will you keep this class file?
A. FWorks/WEB-INF
B. FWorks/classes
C. FWorks/WEB-INF/classes
D. FWorks/WEB-lNF/lib/classes
C
19. Which ofthese is a correctfragmentwithin the web-app element ofdeployment descriptor?
Selectthe one correct answer correct answers A. <exception> <exception-type>
mypackage.MyException</exception-type> <location> /error.jsp</location> </exception>
B. <error-page> <exception-type> mypackage.MyException</exception-type> <location>
/error.jsp</location> </error-page>
C. <error-page> <exception> mypackageMyException </exception-type> <location>
/error.jsp </location> </error-page>
D. <error-page> <exception-type> mypackage.MyException</exception-type> </error-page>
E. <error-page> <servlet-name> myservlet</servlet-name> <exception-type>
mypackage.MyException</exception-type> </error-page>
F. <exception> <servlet-name> myservlet</servlet-name> <exception-type>
mypackage.MyException</exception-type> </exception>
B
20. The form attribute __________ specifies the server-side form handler. i.e.. the program
correct answers that handles the request
A. name
B. action
C. localhost
D. id
B
23. Which statements are BEST describe prefix attribute of <%@ taglib prefix=_%>directive
of JSP file? correct answers A. The scripting language used in the JSP. Currently. the only
valid value for this attribute is java.