You are on page 1of 7

Jsp question Which of the tag is used to show the comments in the JSP page <%-- comment -- %>

<%! Declarations %> <%= expressions %> <% code fragment %> <br/> Implementing the tag < %@ page isThreadSafe="false" % >implements the SingleThre adModel interface making the Jsp thread safe synchornised content safe None of the above Which codeline must be set before any of the lines that use the PrintWriter setContentType() setPrintType() setWriter() setContentWriter() <br/> Domain name service (DNS) maps one particular IP address to a string of ________ ___. characters <br/> digits <br/> special symbols <br/> binary digits <br/> Calling of which of the following method causes unpredictable results in the Ser vlet. doPost() doGet() System.out.println() System.exit(0); Which jar file should be mandatory be there in the CLASSPATH for working with Se rvlet. javax.servlet.* java.servlet.*; javax.servlet.HttpRequest javax.servlet.HttpResponse Which of the following statements is true regarding the access to the informatio n provided by the ServletContext Information such as the names of the parameters passed in by the client, the protocol (scheme) being used by the client,&nbsp; The names of the remote host that made the request and the server that recei ved it.&nbsp; Also the input stream, as ServletInputStream.Servlets use the input stream t o get data from clients that use application protocols such as the HTTP POST and GET methods.&nbsp; All of the above <br/>

JSP is the Java platform technology for building applications containing dynamic web contents such as (Multiple choice)

<p>XHTML <br/></p> XML <br/> DHTML <br/> HTML <br/> Which of the tag contains a code fragment valid in the page scripting language. <code><%-- comment -- %></code> <code><%! Declarations %></code> <code><%= expressions %></code> <code><% code fragment %></code> The JspPage interface defines the __________ and ____ method which the page writ er can use in their pages and are invoked in much the same manner as the ____ an d _____ methods of a servlet. jspInit(), jspDestroy(), init() , destroy() init(),jspDestroy(),jspInit(),destroy() destroy(),jspDestroy(),jspInit(),init() init(),destroy(),jspInit(), jspDestroy() Java Server Pages technology commonly called JSP technology offers the following advantages(Multiple choice) :Separation of dynamic and static content. <br/> Support for scripting and tags <br/> Reuse of components and tags. <br/> Web access layer for N-tier enterprise application architecture <br/> The response.sendRedirect("..); is the response implicit object to redirect the bro wser to the different resource True False The ________ listeners are notified when session objects are created, invalidate d, or timed out. Session Servlet Session Servlet Attribute context attribute Listeners context listeners

Which of the following statements is true regarding the scope of page in JSP Objects with page scope are accessible only within the page where they are c reated. References to objects with page scope are stored in the pagecontext object All references to such an object shall be released after the response is sen t back to the client from the JSP page or the request is forwarded somewhere els e. All of the above. Which of the following statements are true I cookie.setMaxAge(0) delete the cook ie II cookie.setMaxAge(1) the cookie will live before it expires III cookie.setMa

xAge(-1) the cookie will not be stored beyond this session. I only II, III only I, II only I, II, III Which of the following is true (Multiple choice) out class refers to the output stream for the http page&nbsp; page class refers to the page Servlet interface&nbsp; pageContext refers to the pages Servlet interface&nbsp; config interface refers to the servlets configuration. <br/> Following method(s) cannot be overridden in the JSP page. _jspService() jspInit() jspDestroy() getParameter() Fill in the blanks -- The maximum age of the cookie in JSP can be set by _______ __________ cookie.setMaxAge(int seconds) cookie.setMaxAge(float seconds) cookie.setAgeMax (float seconds) cookie.setAgeMax (int seconds) To show money format on the JSP page we use __________ class AirthmaticFormat&nbsp; CurrencyFormat&nbsp; NumberFormat&nbsp; StringBuffer Following methods can be overridden in the JSP page. (Multiple choice) _jspService() jspInit() jspDestroy() getParameter() State true or false -- It is possible to call an external application like MSWor d by the click on the JSP page or Servlet? True False Under JSP 1.0 , the implicit object which can be used for reference is this. It is used to refer to the ______________ Servlet Servlet Calling None of generated by the JSP page <br/> called by the jsp page <br/> the previous JSP page <br/> the above <br/>

State true or false :- URL instance represents the location of a resource True False

Java Server Pages specification includes (Multiple choice) JSP standard directives JSP standard actions. Script language declarations, scriplets and expressions. A portable tag extension mechanism. Which of the following statements is true for reducing the number of writes to t he client from the Servlet? Use StringBuffer instead of String even for concatenating a group of Strings . Avoid writing every small string to client Instead store all the strings into a StringBuffer and after sufficient data is available, send this data to Browser. All of the above. The code block <%@ page isErrorPage="true" %> <% out.println(" "); PrintWriter pw = response.getWriter(); exception.printStackTrace(pw); out.println(" "); %> Helps in printing the ______________ of exception on JSP. We can restrict the calling of the errorPage in the JSP by setting the value tru e for the ______ param in the ErrorPage attribute of the Page Directory An HTTP Servlet handles client requests through its service() method. True False The tag %@include file=......... % > helps in including the ______ file in the JSP page (Multiple choice) static dynamic readOnly None of the above Which of the following statements is true about the GenericServlet. (Multiple ch oice) GenericServlet is for servlets that might P service. As of only Http is implemented completely The GenericServlet has a service() method uest is made. GenericServlet is called by both incoming given to the servlet as they are. not use HTTP, like for instance FT in GenericServlet. that gets called when a client req requests and the HTTP requests are

1. Which of the tag is used to show the comments in the JSP page Answer: <%-- comment -- %> 2. Implementing the tag < %@ page isThreadSafe="false" % >implements the SingleT hreadModel interface making the Jsp Answer: thread safe 3. Which codeline must be set before any of the lines that use the PrintWriter Answer: setContentType() 4. Calling of which of the following method causes unpredictable results in the Servlet. Answer: System.exit(0); 5. Which jar file should be mandatory be there in the CLASSPATH for working with Servlet. Answer: javax.servlet.* 6. Which of the following statements is true regarding the access to the informa tion provided by the ServletContext Answer: All of the above 7. JSP is the Java platform technology for building applications containing dynamic web contents such as (Multiple choice)

Answer: XHTML XML DHTML HTML 8. Which of the tag contains a code fragment valid in the page scripting languag e. Answer: <% code fragment %> 9. The JspPage interface defines the __________ and ____ method which the page w riter can use in their pages and are invoked in much the same manner as the ____ and _____ methods of a servlet. Answer: jspInit(), jspDestroy(), init() , destroy() 10. Java Server Pages technology commonly called JSP technology offers the follo wing advantages(Multiple choice) :Answer: Separation of dynamic and static content. Support for scripting and tags Reuse of components and tags. Web access layer for N-tier enterprise application architecture

11. The response.sendRedirect("..); is the response implicit object to redirect the browser to the different resource Answer: True 12. The ________ listeners are notified when session objects are created, invali dated, or timed out. Answer: Session Listeners 13. Which of the following statements are true I cookie.setMaxAge(0) delete the cookie II cookie.setMaxAge(1) the cookie will live before it expires III cookie.s etMaxAge(-1) the cookie will not be stored beyond this session. Answer: I, II, III 14. Which of the following is true (Multiple choice) Answer: out class refers to the output stream for the http page page class refers to the page Servlet interface pageContext refers to the pages Servlet interface config interface refers to the servlets configuration. 15. Fill in the blanks -- The maximum age of the cookie in JSP can be set by ___ ______________ Answer: cookie.setMaxAge(int seconds) 16. State true or false :- URL instance represents the location of a resource Answer: True 17. Java Server Pages specification includes (Multiple choice) Answer: Script language declarations, scriplets and expressions. JSP standard actions. JSP standard directives A portable tag extension mechanism. 18. An HTTP Servlet handles client requests through its service() method. Answer: True 19. The tag %@include file=......... % > helps in including the ______ file in the JSP page (Multiple choice) Answer: readOnly static 20. Which of the following statements is true about the GenericServlet. (Multipl e choice) Answer: GenericServlet is for servlets that might not use HTTP, like for instanc e FTP service. The GenericServlet has a service() method that gets called when a client request is made. GenericServlet is called by both incoming requests and the HTTP requests are giv en to the servlet as they are. Incorrect Questions (10 / 30) 1. Domain name service (DNS) maps one particular IP address to a string of _____ ______. Answer: characters 2. Which of the following statements is true regarding the scope of page in JSP

Answer: All of the above. 3. Following method(s) cannot be overridden in the JSP page. Answer: _jspService() 4. To show money format on the JSP page we use __________ class Answer: NumberFormat 5. Following methods can be overridden in the JSP page. (Multiple choice) Answer: jspDestroy() jspInit() 6. State true or false -- It is possible to call an external application like MS Word by the click on the JSP page or Servlet? Answer: True 7. Under JSP 1.0 , the implicit object which can be used for reference is this. It is used to refer to the ______________ Answer: Servlet generated by the JSP page 8. Which of the following statements is true for reducing the number of writes t o the client from the Servlet? Answer: All of the above. 9. The code block <%@ page isErrorPage="true" %> <% out.println(" "); PrintWriter pw = response.getWriter(); exception.printStackTrace(pw); out.println(" "); %> Helps in printing the ______________ of exception on JSP. Answer: stacktrace 10. We can restrict the calling of the errorPage in the JSP by setting the value true for the ______ param in the ErrorPage attribute of the Page Directory Answer: isErrorpage

You might also like