MCQs > IT & Programming > JSP And Servlets MCQs > Basic JSP and Servlets MCQs

Basic JSP and Servlets MCQ

1.

Which statement among the following apply to redirecting a HTTP request to another URL?

Answer

Correct Answer: The redirect method must be called before the response body is committed, otherwise an IllegalStateException is thrown

Note: This Question is unanswered, help us to find answer for this one

2.

How do you create the Parameter buttons the toolbar for component com_hello?

Answer

Correct Answer: JToolBarHelper::preferences('com_hello', '500');

Note: This Question is unanswered, help us to find answer for this one

3.

Which of the following methods must you use to deny access from an external direct call?

Answer

Correct Answer: defined('_VALID_MOS') or die('Direct Access to this location is not allowed.')

Note: This Question is unanswered, help us to find answer for this one

4.

What is the role of the template metadata file in the system?

Answer

Correct Answer: All of these.

Note: This Question is unanswered, help us to find answer for this one

5.

Why does Joomla use templateDetails.xml files?

Answer

Correct Answer: To provide information and allow selection of the template within the template manager;

Note: This Question is unanswered, help us to find answer for this one

6.

From which package are the classes (i.e JSite, JAdministrator and JInstallation) which make up the Joomla CMS application extended?

Answer

Correct Answer: Installer

Note: This Question is unanswered, help us to find answer for this one

7.

Which interface and method name should be used to retrieve HTTP request header information?

Answer

Correct Answer: HttpServletRequest.getHeaderNames

Note: This Question is unanswered, help us to find answer for this one

8.

Assume the custom tag is GLOOP and the prefix is TWONG. Which of the following is the syntax for an empty custom tag?

 

Answer

Correct Answer: TWONG:GLOOP/>

Note: This Question is unanswered, help us to find answer for this one

9.

How would you use a bean in a JSP page?

 

Answer

Correct Answer: <jsp:useBean id="houseLotBean" scope="session" class="session.Realestate"/>

Note: This Question is unanswered, help us to find answer for this one

10.

Which of the following options is a valid declaration?

 

Answer

Correct Answer: <%! String name="Patricia"; %>

Note: This Question is unanswered, help us to find answer for this one

11.

Assuming the tag library is in place and the tag handler is correct, which of the following is the correct way to use a custom tag in a JSP page?

 

Answer

Correct Answer: <yourLibrary:whatColorlslt color="red"/>

Note: This Question is unanswered, help us to find answer for this one

12.

What is the WebApp deployment descriptor element name for the Servlet Context Initialization Parameters?

 

Answer

Correct Answer: <context-param>

Note: This Question is unanswered, help us to find answer for this one

13.

Consider the following statement:

PreparedStatement ps=con.prepareStatement("INSERT INTO ORDER (CUSTOMER_ID ,PRICE) VALUES(?,?)");

Which of the following should come after this statement?

Answer

Correct Answer: ps.clearParameters(); ps.setInt(1,3); ps.setDouble(2,790.50); ps.executeUpdate();

Note: This Question is unanswered, help us to find answer for this one

14.

After executing the following code, resultvar contains false. What should the next step be?

boolean resultvar=stmt.execute(sql);

Answer

Correct Answer: stmt.executeUpdate();

Note: This Question is unanswered, help us to find answer for this one

15.

Which of the following is not a JSP implicit object?

Answer

Correct Answer: in

Note: This Question is unanswered, help us to find answer for this one

16.

Which of the following statements are true regarding the structure of a WebArchive file?

Answer

Correct Answer: It is a JAR archive of the WebApplication structure

Note: This Question is unanswered, help us to find answer for this one

17.

Which of the following statements are true regarding the HTTP GET method?

Answer

Correct Answer: There is a limit on how much data this HTTP method can send

Note: This Question is unanswered, help us to find answer for this one

18.

Which of the following statements are best associated with the HTTPPOST method?

Answer

Correct Answer: There is no limit on how much data this HTTP method can send

Note: This Question is unanswered, help us to find answer for this one

19.

Which interface and method name should be used to acquire a text stream for the response?

Answer

Correct Answer: ServletResponse.getWriter

Note: This Question is unanswered, help us to find answer for this one

20.

With regard to the servletcontextlistener interface, which of the following methods is valid?

Answer

Correct Answer: contextInitialized

Note: This Question is unanswered, help us to find answer for this one

21.

Which statement is true regarding ServletContext Initialization Parameters in the deployment descriptor?

Answer

Correct Answer: They are accessible by all servlets in a given web application

Note: This Question is unanswered, help us to find answer for this one

22.

With regard to the destroy lifecycle method, identify the correct statements about its purpose or about how and when it is invoked.

Answer

Correct Answer: It gives the servlet an opportunity to clean up resources

Note: This Question is unanswered, help us to find answer for this one

23.

Read the following code snippet:

1 <libraryPrefix:handlerName parameterNAme="value">

2 <%=23*counter %>

3 <b>Congratulations!</b>

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?

Answer

Correct Answer: String value=req.getParameter("product");

Note: This Question is unanswered, help us to find answer for this one

38.

Which method in the HttpServlet class corresponds to the HTTPPUT method?

Answer

Correct Answer: doPut

Note: This Question is unanswered, help us to find answer for this one

39.

Which interface provides access to request scoped attributes?

Answer

Correct Answer: ServletRequest

Note: This Question is unanswered, help us to find answer for this one

40.

What is Template Data?

Answer

Correct Answer: The taglib XML namespace

Note: This Question is unanswered, help us to find answer for this one

41.

Which of the following options is a valid expression?

Answer

Correct Answer: <%=(new java.util.Date()).toLocaleString() %>

Note: This Question is unanswered, help us to find answer for this one

42.

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?

Answer

Correct Answer: response.sendError(HTTPServletResponse.SC_FORBIDDEN,"Error");

Note: This Question is unanswered, help us to find answer for this one

43.

What is the file name of the WebApp deployment descriptor?

Answer

Correct Answer: web.xml

Note: This Question is unanswered, help us to find answer for this one

44.

Which statement is true regarding a servlet context listener?

Answer

Correct Answer: An object that implements a context listener is notified when its Web App context is created or destroyed

Note: This Question is unanswered, help us to find answer for this one

45.

Which among the following objects is the best choice to share information between pages for a single user?

Answer

Correct Answer: session

Note: This Question is unanswered, help us to find answer for this one

46.

Read the following code snippet and answer the question based upon it:

<taglib>
<taglib-uri>
     http://www.yourcompany.com/you TagLibrary
</taglib-uri>
<taglib-location>
       /WEB-INF/yourTagLibrary.tld
</taglib-location>
</taglib>

 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 or tag to load the Java Plug-in software?
Answer

Correct Answer: jsp:plugin

Note: This Question is unanswered, help us to find answer for this one

97. What does JSTL stand for?

Answer

Correct Answer: Java Server Pages Standard Library

Note: This Question is unanswered, help us to find answer for this one

98. JSP renders pages vis a ____ Life Cycle.

Answer

Correct Answer: JSP

Note: This Question is unanswered, help us to find answer for this one

99. Which of the implicit JSP object represents the servlet configuration information?

Answer

Correct Answer: config

Note: This Question is unanswered, help us to find answer for this one

100. If a jsp page uses classes from java.util package. Which of the following statements would import the package?

Answer

Correct Answer: <%@ page import="java.util.*"%>

Note: This Question is unanswered, help us to find answer for this one

101. The JSP container calls the which of the following method if it needs the page to release resources?

Answer

Correct Answer: jspDestroy()

Note: This Question is unanswered, help us to find answer for this one

102. What is the correct definition for ?

Answer

Correct Answer: tries to find an object, creates it if it does not exist

Note: This Question is unanswered, help us to find answer for this one

103. Which of the following are valid sub-elements of taglib?

Answer

Correct Answer: Both taglib-uri and taglib-location

Note: This Question is unanswered, help us to find answer for this one

104. Which of the following is an INVALID bean(object) scope?

Answer

Correct Answer: config

Note: This Question is unanswered, help us to find answer for this one

105. Which of the following JSP action can be described as following : Action to substitute the referenced resource's content for the forwarding page's content?

Answer

Correct Answer: jsp:forward

Note: This Question is unanswered, help us to find answer for this one

106. A JSP comment is ___ in the page code.

Answer

Correct Answer: not included

Note: This Question is unanswered, help us to find answer for this one

107. Which of the follolwing servlet methods gets called for each client request?

Answer

Correct Answer: public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException{

Note: This Question is unanswered, help us to find answer for this one

108. A container invokes ____ method before taking care of any requests.

Answer

Correct Answer: jspInit()

Note: This Question is unanswered, help us to find answer for this one

109. The 3 ways to maintain session between web client and the server are:

Answer

Correct Answer: Cookies, hidden fields, URL rewrite.

Note: This Question is unanswered, help us to find answer for this one

110. 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 ?

Answer

Correct Answer: Request Scope

Note: This Question is unanswered, help us to find answer for this one

111. When a web browser asks for a JSP page, the first thing the JSP engine does is:

Answer

Correct Answer: see if the page needs to be compiled

Note: This Question is unanswered, help us to find answer for this one

112. If submit a form without mentioning the method type(get or post) and called servlet. which method will invoke? doGet() or doPost().

Answer

Correct Answer: By default it is a GET request

Note: This Question is unanswered, help us to find answer for this one

113. Which is the best place to define error pages for JSPs?

Answer

Correct Answer: web.xml

Note: This Question is unanswered, help us to find answer for this one

114. Another way to track user data between pages is:

Answer

Correct Answer: session and Cookies

Note: This Question is unanswered, help us to find answer for this one

115. To deploy and run JavaServer Pages you need...

Answer

Correct Answer: a compatible web server with a servlet container

Note: This Question is unanswered, help us to find answer for this one

116. What is the proper taglib for SQL?

Answer

Correct Answer: <sql:update> </sql:update>

Note: This Question is unanswered, help us to find answer for this one

117. A JSP directive has the following form:

Answer

Correct Answer: <%@ page %>

Note: This Question is unanswered, help us to find answer for this one

118. Which of the following methods is most appropriate to send the large amount of data?

Answer

Correct Answer: POST

Note: This Question is unanswered, help us to find answer for this one

119. Service method of a generic servlet takes which of the following parameters?

Answer

Correct Answer: Both ServletRequest & ServletResponse

Note: This Question is unanswered, help us to find answer for this one

120. Which of the following files contains the mapping for and ?

Answer

Correct Answer: web.xml

Note: This Question is unanswered, help us to find answer for this one

121. HTTP is stateless. What does that mean?

Answer

Correct Answer: Once a connection is open then closed, the web server doesn't recognize the request or any past requests.

Note: This Question is unanswered, help us to find answer for this one

122. Which one is the correct syntax for JSTL?

Answer

Correct Answer: <%@ taglib prefix="c" uri="http..." %>

Note: This Question is unanswered, help us to find answer for this one

123. The correct way to create a string in Java is:

Answer

Correct Answer: String var_str = "this";

Note: This Question is unanswered, help us to find answer for this one

124. The correct way to create a single line comment is:

Answer

Correct Answer: // comment

Note: This Question is unanswered, help us to find answer for this one

125. Which file is a configuration file for JSP?

Answer

Correct Answer: web.xml

Note: This Question is unanswered, help us to find answer for this one

126. What is the correct way to test if x is equal to 1?

Answer

Correct Answer: if(x == 1) { }

Note: This Question is unanswered, help us to find answer for this one

127. Data runs between the client and the server via a ___ request.

Answer

Correct Answer: HTTP

Note: This Question is unanswered, help us to find answer for this one

128. The correct way to instantiate a new date object is:

Answer

Correct Answer: Date myDate = new Date();

Note: This Question is unanswered, help us to find answer for this one

129. The correct syntax for a IF statement in Java is:

Answer

Correct Answer: if () { }

Note: This Question is unanswered, help us to find answer for this one

130. The correct way to import the text library in your JSP page is:

Answer

Correct Answer: <%@ page import="java.text.*" %>

Note: This Question is unanswered, help us to find answer for this one

131. What is the proper Try Catch clause?

Answer

Correct Answer: try { } catch () { }

Note: This Question is unanswered, help us to find answer for this one

132. JavaScript is to the client as JSP is to the ____.

Answer

Correct Answer: the server

Note: This Question is unanswered, help us to find answer for this one

133. The correct way to import the input/ouput java library is:

Answer

Correct Answer: <%@ page import="java.io.*" %>

Note: This Question is unanswered, help us to find answer for this one

134. JSP's are written in____.

Answer

Correct Answer: Java

Note: This Question is unanswered, help us to find answer for this one

135. JSP caches data on a web server called___.

Answer

Correct Answer: Tomcat

Note: This Question is unanswered, help us to find answer for this one

136. If you wanted to print out the html from your program, which would you use?

Answer

Correct Answer: out.println();

Note: This Question is unanswered, help us to find answer for this one

137. A scriptlet is a piece of code that can be embedded inside the HTML, however it has to be inside which tags?

Answer

Correct Answer: <% java code %>

Note: This Question is unanswered, help us to find answer for this one

138. a JavaBean is basically a:

Answer

Correct Answer: class

Note: This Question is unanswered, help us to find answer for this one

139. How does container process a JSP page after compilation?

Answer

Correct Answer: Servlet

Note: This Question is unanswered, help us to find answer for this one

140. JSP uses what kind of syntax for an expression?

Answer

Correct Answer: <%= expression %>

Note: This Question is unanswered, help us to find answer for this one

141. JSP stands for ____.

Answer

Correct Answer: Java Server Pages

Note: This Question is unanswered, help us to find answer for this one

142. Which of the following is an INVALID JSP action?

Answer

Correct Answer: jsp:setSession

Note: This Question is unanswered, help us to find answer for this one

143. init() or jspInit() is invoked by the container on a servlet or a jsp?

Answer

Correct Answer: Only once in the life time

Note: This Question is unanswered, help us to find answer for this one

144. 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?

Answer

Correct Answer: The value of s cannot be guaranteed

Note: This Question is unanswered, help us to find answer for this one

search
JSP And Servlets Subjects