1. Given the following code from a servlet, and given that myvar is a reference to either an HttpSession or a ServletContext: 1. myVar.setAttribute(“myName”, “myVal”); 2. String s = (String) myVar.getAttribute(“myName”); // more code After line 2 executes, which is true?
2. init() or jspInit() is invoked by the container on a servlet or a jsp?
3. Which of the following is an INVALID JSP action?
4. JSP stands for ____.
5. JSP uses what kind of syntax for an expression?
6. How does container process a JSP page after compilation?
7. a JavaBean is basically a:
8. A scriptlet is a piece of code that can be embedded inside the HTML, however it has to be inside which tags?
9. If you wanted to print out the html from your program, which would you use?
10. JSP caches data on a web server called___.
11. JSP's are written in____.
12. The correct way to import the input/ouput java library is:
13. JavaScript is to the client as JSP is to the ____.
14. What is the proper Try Catch clause?
15. The correct way to import the text library in your JSP page is:
16. The correct syntax for a IF statement in Java is:
17. JSP are coded in:
18. The correct way to instantiate a new date object is:
19. Data runs between the client and the server via a ___ request.
20. What is the correct way to test if x is equal to 1?
21. Which file is a configuration file for JSP?
22. How are JSP comments written?
23. The correct way to create a single line comment is:
24. The correct way to create a string in Java is:
25. Which one is the correct syntax for JSTL?
26. A Servlet runs on ____
27. HTTP is stateless. What does that mean?
28. Which file contains the mapping for and ?
29. Service method of a generic servlet takes which of the following parameters?
30. Which method is most appropriate to send the large amount of data?
31. A JSP directive has the following form:
32. What is the proper taglib for SQL?
33. The correct way to create a cookie is:
34. To deploy and run JavaServer Pages you need...
35. Another way to track user data between pages is:
36. Which is the best place to define error pages for JSPs?
37. If submit a form without mentioning the method type(get or post) and called servlet. which method will invoke? doGet() or doPost().
38. When a web browser asks for a JSP page, the first thing the JSP engine does is:
39. public class SomeServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setAttribute("a", "value") ; .... } } What would be the scope of a attribute ?
40. The 3 ways to maintain session between web client and the server are:
41. A container invokes ____ method before taking care of any requests.
42. Which servlet methods gets called for each client request?
43. A JSP comment is ___ in the page code.
44. Which JSP action can be described as following : Action to substitute the referenced resource's content for the forwarding page's content?
45. Which is an INVALID bean(object) scope?
46. Which is valid sub-elements of taglib?
47. What is the correct definition for ?
48. The JSP container calls the which method if it needs the page to release resources?
49. If a jsp page uses classes from java.util package. Which of the following statements would import the package?
50. Which code block is correct?
51. Which of the implicit JSP object represents the servlet configuration information?
52. What's the difference between servlets and applets? 1.Servlets executes on Servers, where as Applets executes on Browser 2.Servlets have no GUI, where as an Applet has GUI 3. Both of them 4. None of them
53. JSP renders pages vis a ____ Life Cycle.
54. What does JSTL stand for?
55. Which action is a specialized tag that generates the appropriate or tag to load the Java Plug-in software?
56. Which root element provides the global configuration information for the JSP files in a Web application?
57. Which is a Scriplet?
58. If req is a reference to an HttpServletRequest and there is no current session, what is true about req.getSession() ?
59. The Web container creates JSP implicit objects like...
60. Which provide a handle to access page directive attributes in the scripting environment?
61. Which is a valid JSP expression?
62. 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
63. 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
64. Which statement correctly describe attribute 'buffer'?
65. Which method is abstract in HttpServlet?
66. Which is not a valid implicit object in a JSP?
67. Once the JSP has been requested and the page is loaded and initialized, the JSP engine calls the:
68. Objects which when compiled down are contained in (a) ____ file.
69. Which types can be used in conjunction with HttpServletResponse methods to stream output data?
70. Which is not a 'page' directive attribute?
71. Which classe has an implementation of getSession method that returns an HttpSession object?
72. Which is not a valid standard method called as part of the JSP life cycle by the container?
73. Which method can be used to get initialization and startup parameters of a servlet?
74. Which one is not a part of the JSTL library group?
75. Which is an INVALID implicit EL objects?
76. 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
77. 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.
78. By default, the servlet API uses a ______ to store a session ID.
79. 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 { }
80. Which HTTP method sends the same response as request?
81. JSP implicit object 'out' is an object of which of the following classes?
82. What results from a call to the getInitParameterNames() method on ServletContext when there are no context parameters set up in the deployment descriptor?
83. Given: 1. <%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %> 2. <%@ taglib prefix = “tables” uri= http://www.javaranch.com/tables %> 3. <%@ taglib prefix = “jsp” tagdir=”/WEB_INF/tags” %> 4. <%@ taglib uri=”UtilityFunctions” prefix=”util” %> What about the above taglib directives would cause the JSP to not function?
84. Which method is called before the page service any requests?
85. JSP implicit object 'exception' is an object of which of the following classes?
86. 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('javax.servlet.context.tempdir');
87. The http GET, PUT, and DELETE verbs are idempotent. What does the term 'idempotent' stand for?
88. JSP implicit object 'application' is an object of which of the following class?
89. 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.
90. Which is valid about 'page' JSP directive?
91. 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
92. Which is a non-idempotent HTTP method
93. Which is not a valid java bean (POJO) scope in JSP?
94. Which 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?
95. Where in JSP page source can EL functions be used?
96. What is the limit of data to be passed from HTML when doGet() method is used?
97. Which is an INVALID attribute for tag directive?
98. javax.servlet.jsp.JspPage extends which of the following interfaces?
99. How can you make the JSP class implement the SingleThreadModel interface?
100. jsp:include page='/servlet/MyServlet' flush='true'/
101. What is true about the life cycle of a servlet?
102. When comparing servlet initialisation parameters to context intialisation parameters, which is true among the following?
103. 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); }
104. When using HTML forms which of the following is true for POST method?
105. Which interface can make a servlet thread safe?
106. In which directory do you place servlet class files?
107. Which interface can make a servlet thread safe?
108. Which method in the HttpServlet class corresponds to the HTTPPOST method?
109. Read the following code snippet and answer the question based upon it: http://www.yourcompany.com/you TagLibrary /WEB-INF/yourTagLibrary.tld From the statements given below, which one applies to the code snippet?
110. Which object is the best choice to share information between pages for a single user?
111. Which statement is true regarding a servlet context listener?
112. What is the file name of the WebApp deployment descriptor?
113. Suppose you had a servlet that simply returned an error message because that resource was forbidden to that user. Read the following code snippet: 1.public void service(HttpServletRequestrequest, 2.HttpServletResponseresponse) 3.throws ServletException, IOException 4. { 5. 6. } What code would you type on line 5 to return an error message to the requesting client?
114. Which option is a valid expression?
115. What is Template Data?
116. Which interface provides access to request scoped attributes?
117. Which method in the HttpServlet class corresponds to the HTTPPUT method?
118. Assuming the servlet method for handling HTTPGET requests is doGet(HttpServletRequest req, HTTPServletResponse res), how do you get a request parameter in that servlet?
119. What does the container do with the following code snippet?
120. What output will be sent to the browser by the following code snippet? -->
121. If cookies are turned off on the client, which two methods still work with the session ID?
122. Which JSP action retrieves the value of a property from a properly declared JavaBean in a JSP page?
123. Which is used by Servlet Containers to maintain session information?
124. With regard to the service() lifecycle method, identify two correct statements about its purpose or about how and when it is invoked.
125. Which design pattern is used to decouple presentation from core data access functionality?
126. Which design pattern reduces network traffic by acting as a caching proxy of a remote object?
127. Which is the name of the cookie used by Servlet Containers to maintain session information?
128. Which is a JSP implicit object?
129. Which is the listener interface for servlet context attributes?
130. Which method is called by the servlet container just after the servlet is removed from service?
131. Which design pattern did technical designers of JSP use to provide centralized dispatching of requests via a controller servlet?
132. Read the following code snippet: 1 2 <%=23*counter %> 3 Congratulations! Which is the correct way to complete the above code snippet?
133. With regard to the destroy lifecycle method, identify the correct statements about its purpose or about how and when it is invoked.
134. Which statement is true regarding ServletContext Initialization Parameters in the deployment descriptor?
135. With regard to the servletcontextlistener interface, which methods is valid?
136. Which interface and method name should be used to acquire a text stream for the response?
137. Which statement is best associated with the HTTPPOST method?
138. Which statement is true regarding the HTTP GET method?
139. Which statement is true regarding the structure of a WebArchive file?
140. Which is not a JSP implicit object?
141. After executing the following code, resultvar contains false. What should the next step be? boolean resultvar=stmt.execute(sql);
142. Consider the following statement: PreparedStatement ps=con.prepareStatement('INSERT INTO ORDER (CUSTOMER_ID ,PRICE) VALUES(?,?)'); Which of the following should come after this statement?
143. What is the WebApp deployment descriptor element name for the Servlet Context Initialization Parameters?
144. Assuming the tag library is in place and the tag handler is correct, which is the correct way to use a custom tag in a JSP page?
145. Which option is a valid declaration?
146. How would you use a bean in a JSP page?
147. Assume the custom tag is GLOOP and the prefix is TWONG. Which is the syntax for an empty custom tag?
148. Which interface and method name should be used to retrieve HTTP request header information?
149. From which package are the classes (i.e JSite, JAdministrator and JInstallation) which make up the Joomla CMS application extended?
150. Why does Joomla use templateDetails.xml files?
151. What is the role of the template metadata file in the system?
152. Which method must you use to deny access from an external direct call?
153. How do you create the Parameter buttons the toolbar for component com_hello?
154. Which statement apply to redirecting a HTTP request to another URL?