Which of the following is the correct way to complete the above code snippet?
Answer
Correct Answer:
</libraryPrefix:handlerName>
Note: This Question is unanswered, help us to find answer for this one
24.
Which design pattern did technical designers of JSP use to provide centralized dispatching of requests via a controller servlet?
Answer
Correct Answer:
Model-view-Controller
Note: This Question is unanswered, help us to find answer for this one
25.
Which method is called by the servlet container just after the servlet is removed from service?
Answer
Correct Answer:
public void destroy() {// code...}
Note: This Question is unanswered, help us to find answer for this one
26.
Which of the following is the listener interface for servlet context attributes?
Answer
Correct Answer:
ServletContextAttributeListener
Note: This Question is unanswered, help us to find answer for this one
27.
Which of the following is a JSP implicit object?
Answer
Correct Answer:
request
Note: This Question is unanswered, help us to find answer for this one
28.
Which of the following is the name of the cookie used by Servlet Containers to maintain
session information?
Answer
Correct Answer:
JSESSIONID
Note: This Question is unanswered, help us to find answer for this one
29.
Which design pattern reduces network traffic by acting as a caching proxy of a remote object?
Answer
Correct Answer:
Value Object
Note: This Question is unanswered, help us to find answer for this one
30.
Which design pattern is used to decouple presentation from core data access functionality?
Answer
Correct Answer:
ModelView Controller
Note: This Question is unanswered, help us to find answer for this one
31.
With regard to the service() lifecycle method, identify two correct statements about its purpose or about how and when it is invoked.
Answer
Correct Answer:
It is called whenever the servlet is requested
Note: This Question is unanswered, help us to find answer for this one
32.
Which of the following are used by Servlet Containers to maintain session information?
Answer
Correct Answer:
Cookies
Note: This Question is unanswered, help us to find answer for this one
33.
Which JSP action retrieves the value of a property from a properly declared JavaBean in a JSP page?
Answer
Correct Answer:
jsp:getProperty
Note: This Question is unanswered, help us to find answer for this one
34.
If cookies are turned off on the client, which two methods still work with the session ID?
Answer
Correct Answer:
encodeRedirectURL()
Note: This Question is unanswered, help us to find answer for this one
35.
What output will be sent to the browser by the following code snippet?
<!—
Que <%="Reader"%>
-->
Answer
Correct Answer:
'Que Reader' within HTML comment markers
Note: This Question is unanswered, help us to find answer for this one
36.
What does the container do with the following code snippet?
<!--#include file="somefile.html"-->
Answer
Correct Answer:
The container passes this line of code through to the client
Note: This Question is unanswered, help us to find answer for this one
37.
Assuming the servlet method for handling HTTPGET requests is doGet(HttpServletRequest req, HTTPServletResponse res), how do you get a request parameter in that servlet?
From the statements given below, which one applies to the code snippet?
Answer
Correct Answer:
The taglib directive can reference a TLD by name
Note: This Question is unanswered, help us to find answer for this one
47.
Which method in the HttpServlet class corresponds to the HTTPPOST method?
Answer
Correct Answer:
doPost
Note: This Question is unanswered, help us to find answer for this one
48.
Which of following interfaces can make a servlet thread safe?
Answer
Correct Answer:
SingleThreadModel
Note: This Question is unanswered, help us to find answer for this one
49.
In which directory do you place servlet class files?
Answer
Correct Answer:
WEB-INF\classes
Note: This Question is unanswered, help us to find answer for this one
50. Which of following interfaces can make a servlet thread safe?
Answer
Correct Answer:
Servlets can't be made thread safe<br>
Note: This Question is unanswered, help us to find answer for this one
51. When using HTML forms which of the following is true for POST method?
Answer
Correct Answer:
POST method sends data in the body of the request
Note: This Question is unanswered, help us to find answer for this one
52. What is the likely outcome from running the code below? protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { RequestDispatcher dispatcher = getServletContext().getNamedDispatcher("/ServletB"); dispatcher.forward(request, response); }
Answer
Correct Answer:
NullPointerException
Note: This Question is unanswered, help us to find answer for this one
53. When comparing servlet initialisation parameters to context intialisation parameters, which is true among the following?
Answer
Correct Answer:
In their respective DD tags, they both have a <param-name> and a <param-value> tag
Note: This Question is unanswered, help us to find answer for this one
54. What is true about the life cycle of a servlet?
Answer
Correct Answer:
Each time doPost() is invoked, it runs in its own thread
Note: This Question is unanswered, help us to find answer for this one
55.
Answer
Correct Answer:
Invoke a Servlet from a JSP page.
Note: This Question is unanswered, help us to find answer for this one
56. How can you make the JSP class implement the SingleThreadModel interface?
Answer
Correct Answer:
<%@ page isThreadSafe=
Note: This Question is unanswered, help us to find answer for this one
57. javax.servlet.jsp.JspPage extends which of the following interfaces?
Answer
Correct Answer:
Servlet
Note: This Question is unanswered, help us to find answer for this one
58. Which of the following is an INVALID attribute for tag directive?
Answer
Correct Answer:
tag-attributes
Note: This Question is unanswered, help us to find answer for this one
59. What is the limit of data to be passed from HTML when doGet() method is used?
Answer
Correct Answer:
2k
Note: This Question is unanswered, help us to find answer for this one
60. Where in JSP page source can EL functions be used?
Answer
Correct Answer:
In the body of a tag where body-content is set to JSP
Note: This Question is unanswered, help us to find answer for this one
61. Which of the following object scope is defined as follows : Objects with this scope are accessible from pages processing requests in the same application as the one in which they were created?
Answer
Correct Answer:
application
Note: This Question is unanswered, help us to find answer for this one
62. Which of the following is not a valid java bean (POJO) scope in JSP?
Answer
Correct Answer:
response
Note: This Question is unanswered, help us to find answer for this one
63. Why do you get this error? NoClassDefFoundError: org.apache.commons.lang.StringUtils. 1. The given class could not be found. 2. The given class could be found, but something went wrong when initializing it 3. None of them
Answer
Correct Answer:
2
Note: This Question is unanswered, help us to find answer for this one
64. Which of the following is valid about 'page' JSP directive?
Answer
Correct Answer:
Controls properties of the JSP
Note: This Question is unanswered, help us to find answer for this one
65. A programmer needs to update a live, running servlet’s initialization parameters so that the web application will begin to use the new parameters immediately. In order to accomplish this, which must be true (although not necessarily sufficient)? 1. The container must destroy and then reinitialize the servlet 2. The servlet’s constructor must retrieve the updated DD parameter from the servlet’s ServletConfig object 3. For each parameter, the DD must have a separate <init-param> tag 4. For each parameter, you must modify a DD tag that specifies the name of the servlet, the name of the parameters, and the new value of the parameter.
Answer
Correct Answer:
1 and 3
Note: This Question is unanswered, help us to find answer for this one
66. JSP implicit object 'application' is an object of which of the following class?
Answer
Correct Answer:
javax.servlet.ServletContext
Note: This Question is unanswered, help us to find answer for this one
67. The http GET, PUT, and DELETE verbs are idempotent. What does the term "idempotent" stand for?
Answer
Correct Answer:
The same operation applied multiple times yields the same result
Note: This Question is unanswered, help us to find answer for this one
68. Given a servlet containing the following code, what is the outcome of attempting to compile and run the servlet? ServletContext context = getServletContext(); String s = context.getAttribute(
Answer
Correct Answer:
The servlet won’t compile
Note: This Question is unanswered, help us to find answer for this one
69. JSP implicit object 'exception' is an object of which of the following classes?
Answer
Correct Answer:
java.lang.Throwable
Note: This Question is unanswered, help us to find answer for this one
70. Which of the following method is called before the page service any requests?
Answer
Correct Answer:
jspInit()
Note: This Question is unanswered, help us to find answer for this one
71. What results from a call to the getInitParameterNames() method on ServletContext when there are no context parameters set up in the deployment descriptor?
Answer
Correct Answer:
An empty Enumeration object is returned
Note: This Question is unanswered, help us to find answer for this one
72. JSP implicit object 'out' is an object of which of the following classes?
Answer
Correct Answer:
JspWriter
Note: This Question is unanswered, help us to find answer for this one
73. Which of the following HTTP method sends the same response as request?
Answer
Correct Answer:
TRACE
Note: This Question is unanswered, help us to find answer for this one
74. Considering the following Servlet code, choose the statement which is true: package com.nullhaus; import javax.servlet.annotation.*; import javax.servlet.http.*; @WebServlet("nullHausServlet") public class NullServlet extends HttpServlet { }
Answer
Correct Answer:
This is an invalid usage of @WebServlet annotations because of the wrongly formed url-pattern value
Note: This Question is unanswered, help us to find answer for this one
75. By default, the servlet API uses a ______ to store a session ID.
Answer
Correct Answer:
cookie
Note: This Question is unanswered, help us to find answer for this one
76. Which statements are true: a. The element (subelement of ) set to “false” forces the container to make the servlet unreachable for request to the defined url-pattern, b. The element (subelement of ) set to “false” forces the container to make the request for the servlet respond with HTTP Code 503 (Service unavailable), c. The web fragment is merged into the final Deployment Descriptor after the web fragment related annotations are processed, d. All web fragments are processed together (in a batch) and all are merged into the final Deployment Descriptor before the web fragments’ related annotations are processed.
Answer
Correct Answer:
a only
Note: This Question is unanswered, help us to find answer for this one
77. Which methods are needed to get the complete and exact URL that causes the call to arrive at the servlet? 1. getRequestURL() 2. getQueryString() 3. Both of them 4. None of them
Answer
Correct Answer:
3
Note: This Question is unanswered, help us to find answer for this one
78. Which of the following is an INVALID implicit EL objects?
Answer
Correct Answer:
session
Note: This Question is unanswered, help us to find answer for this one
79. Which one is not a part of the JSTL library group?
Answer
Correct Answer:
HTML
Note: This Question is unanswered, help us to find answer for this one
80. Which of the following methods can be used to get initialization and startup parameters of a servlet?
Answer
Correct Answer:
getServletConfig
Note: This Question is unanswered, help us to find answer for this one
81. Which of the following classes has an implementation of getSession method that returns an HttpSession object?
Answer
Correct Answer:
HttpServletRequest
Note: This Question is unanswered, help us to find answer for this one
82. Which of the following is not a 'page' directive attribute?
Answer
Correct Answer:
implements
Note: This Question is unanswered, help us to find answer for this one
83. Which types can be used in conjunction with HttpServletResponse methods to stream output data?
Answer
Correct Answer:
java.io.PrintWriter
Note: This Question is unanswered, help us to find answer for this one
84. Objects which when compiled down are contained in (a) ____ file.
Answer
Correct Answer:
jar
Note: This Question is unanswered, help us to find answer for this one
85. Once the JSP has been requested and the page is loaded and initialized, the JSP engine calls the:
Answer
Correct Answer:
_jspService() method
Note: This Question is unanswered, help us to find answer for this one
86. Which of the following is not a valid implicit object in a JSP?
Answer
Correct Answer:
context
Note: This Question is unanswered, help us to find answer for this one
87. Which of the following methods is abstract in HttpServlet?
Answer
Correct Answer:
It has no abstract methods
Note: This Question is unanswered, help us to find answer for this one
88. Which of the following statement correctly describe attribute 'buffer'?
Answer
Correct Answer:
It indicates whether the content output from the page will be buffered
Note: This Question is unanswered, help us to find answer for this one
89. How can you call a servlet to autofill a dropdown list which depends on selection from previous 2 dropdown lists? 1. Print all possible values of the 2nd and 3rd dropdown out as a Javascript object 2. Make use of XMLHttpRequest in Javascript to fire an asynchronous request to a servlet during the onchange event 3. Both of them 4. None of them
Answer
Correct Answer:
3
Note: This Question is unanswered, help us to find answer for this one
90. When might a JSP get translated (Choose all that apply)? a. When the application is started b. When the developer compiles code in the src folder c. The first time a user requests the JSP d. After jspdestroy() is called, it gets retranslated
Answer
Correct Answer:
a and c
Note: This Question is unanswered, help us to find answer for this one
91. Which of the following is a valid JSP expression?
Answer
Correct Answer:
<%= some-java-expression %>
Note: This Question is unanswered, help us to find answer for this one
92. Which of the following provides a handle to access page directive attributes in the scripting environment?
Answer
Correct Answer:
pageContext
Note: This Question is unanswered, help us to find answer for this one
93. If req is a reference to an HttpServletRequest and there is no current session, what is true about req.getSession() ?
Answer
Correct Answer:
Invoking req.getSession(true) will return a new session
Note: This Question is unanswered, help us to find answer for this one
94. Which of the following is a Scriplet?
Answer
Correct Answer:
<% Java statements %>
Note: This Question is unanswered, help us to find answer for this one
95. Which of the following root element provides the global configuration information for the JSP files in a Web application?
Answer
Correct Answer:
jsp-config
Note: This Question is unanswered, help us to find answer for this one
96. Which of the following actions is a specialized tag that generates the appropriate