PRJ321 Key || All Solutions are Verified.
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
A. <webapp>
B. <session-config>
C. <session-configuration>
D. <session_config> correct answers B
8. EJB 3.0 specifications are first implemented in_______
A. Java EE 5
B. Java EE 4
C. Java EE 3
D. Java EE 6 correct answers A
9. Study the statements:
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 correct answers 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?
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> correct answers C
11. Consider the following tag declaration in a TLD file:
<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 correct answers A
12. An objectwith page scope exists in every JSP ofa patticularWeb application.
A. True
B. False correct answers 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.
, A. True
B. False correct answers A
14. In which ofthe following cases will the method doEndTag( ) ofa tag handler be invoked?
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.
correct answers C
15. What is the result of attempting to access the following JSP page?
<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. correct answers D
16. Which ofthe following lines of code are correct? (Choose one)
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{
...
} correct answers C
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
A. <webapp>
B. <session-config>
C. <session-configuration>
D. <session_config> correct answers B
8. EJB 3.0 specifications are first implemented in_______
A. Java EE 5
B. Java EE 4
C. Java EE 3
D. Java EE 6 correct answers A
9. Study the statements:
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 correct answers 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?
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> correct answers C
11. Consider the following tag declaration in a TLD file:
<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 correct answers A
12. An objectwith page scope exists in every JSP ofa patticularWeb application.
A. True
B. False correct answers 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.
, A. True
B. False correct answers A
14. In which ofthe following cases will the method doEndTag( ) ofa tag handler be invoked?
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.
correct answers C
15. What is the result of attempting to access the following JSP page?
<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. correct answers D
16. Which ofthe following lines of code are correct? (Choose one)
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{
...
} correct answers C