JSP Mock Test

This section presents you various set of Mock Tests related to JSP Framework.  You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Q 1 - What is the correct signature of jspDestroy() method of HttpJspPage class?
A - void jspDestroy(HTTPRequest request, HTTPResponse response)
B - void jspDestroy(HTTPRequest request, HTTPResponse response) throws ServletException, IOException
C - void jspDestroy()
D - void jspDestroy() throws ServletException, IOException
Correct Signature is
void jspDestroy()
Q 2 - What is the correct signature of jspInit() method of HttpJspPage class?
A - void jspInit(HTTPRequest request, HTTPResponse response)
B - void jspInit(HTTPRequest request, HTTPResponse response) throws ServletException, IOException
C - void jspInit()
D - void jspInit() throws ServletException, IOException
Correct Signature is
void jspInit()
Q 3 - What is the correct signature of _jspService() method of HttpJspPage class?
A - void _jspService(HTTPRequest request, HTTPResponse response)
B - void _jspService(HTTPRequest request, HTTPResponse response) throws ServletException, IOException
C - void _jspService()
D - void _jspService() throws ServletException, IOException
Correct Signature is
void _jspService(HTTPRequest request, HTTPResponse response) throws ServletException, IOException
Q 4 - _jspService() method of HttpJspPage class should not be overridden.
A - True
B - False
JSP container creates _jspService() methods so it should not be overridden.
Q 5 - _jspService() method of HttpJspPage class should not be overridden.
A - True
B - False
JSP container creates _jspService() methods so it should not be overridden.
Q 6 - jspInit() method of HttpJspPage class can be overridden.
A - True
B - False
Yes, jspInit() method can be overridden.
Q 7 - jspDestroy() method of HttpJspPage class can be overridden.
A - True
B - False
Yes, jspDestroy() method can be overridden.
Q 8 - Which of the following is not a implicit object?
A - request
B - response
C - cookie
D - session
There is no cookie object in jsp.
Q 9 - request is instance of which class?
A - Request
B - HttpRequest
C - HttpServletRequest
D - ServletRequest
request is object of HttpServletRequest.
Q 10 - response is instance of which class?
A - Response
B - HttpResponse
C - HttpServletResponse
D - ServletResponse
request is object of HttpServletResponse.
Q 11 - if isThreadSafe attribute of page directive is set as true, then generated servlet implements SingleThreadModel interface.
A - True
B - False
If isThreadSafe attribute of page directive is set as false, then generated servlet implements SingleThreadModel interface.
Q 12 - This object can be used to access other implicit objects in JSP.
A - request
B - page
C - context
D - pageContext
pageContext can be used to retrieve other implicit objects using its methods like getPage(), getRequest() etc.
Q 13 - What is default value of isThreadSafe?
A - True
B - False
The isThreadSafe option marks a page as being thread-safe. By default, it is true and all JSPs are considered thread-safe.
Q 14 - Setting isThreadSafe false can lead to poor performance.
A - True
B - False
If you set the isThreadSafe option to false, the JSP engine makes sure that only one thread at a time is executing your JSP.
Q 15 - session is instance of which class?
A - Session
B - HttpSession
C - HttpServletSession
D - ServletSession
request is object of HttpSession.
Q 16 - If a jsp is to generate a pdf page, what attribute of page directive it should use?
A - contentType
B - generatePdf
C - typePDF
B - contentPDF
<%page contentType="application/pdf">
Above tag is used to generate PDF using JSP.
Q 17 - If a jsp is to generate a xml page, what attribute of page directive it should use?
A - contentXML
B - generateXML
C - typeXML
D - contentType
<%page contentType="text/xml">
Q 18 - Which of the following is not a directive?
A - include
B - page
C - export
D - useBean
export is not a page directive.
Q 19 - Which of the following is not a valid attribute of a page directives?
A - language
B - extend
C - export
D - import
export is not a valid attribute of a page directive.
Q 20 - Which of the following is a server side technology?
A - html
B - jsp
C - javaScript
D - css
jsp is a server side technology.
Q 21 - All jsp pages are required to be mapped and configured in web.xml.
A - True
B - False
No, Jsp pages are not required to be mapped/configured in web.xml
Q 22 - All servlet classes are required to be mapped and configured in web.xml.
A - True
B - False
Yes, all servlets are required to be mapped/configured in web.xml
Q 23 - Which of the following do not supports JSP directly?
A - Weblogic Server
B - WebSphere Server
C - Tomcat Server
D - Apache HTTP Server
Apache HTTP Server do not supports JSP directly.
Q 24 - What JSP stands for?
A - Java Service Programming
B - Java Server Programming
C - Java Service Pages
D - Java Server Pages
JSP stands for Java Server Pages.
Q 25 - Which is the methods of generated Servlet?
A - jspInit()
B - _jspService()
C - jspDestroy()
D - All of the above
All of the above methods get generated in generated servlet.

    108 Lectures 
     11 hours 

 Chaand Sheikh

    517 Lectures 
     57 hours 

 Chaand Sheikh

    41 Lectures 
     4.5 hours 

 Karthikeya T

    42 Lectures 
     5.5 hours 

 TELCOMA Global

    15 Lectures 
     3 hours 

 TELCOMA Global

    44 Lectures 
     15 hours 

 Uplatz
 Print
 Add Notes
 Bookmark this page