- Basic JSP Tutorial
- JSP - Home
- JSP - Overview
- JSP - Environment Setup
- JSP - Architecture
- JSP - Lifecycle
- JSP - Syntax
- JSP - Directives
- JSP - Actions
- JSP - Implicit Objects
- JSP - Client Request
- JSP - Server Response
- JSP - Http Status Codes
- JSP - Form Processing
- JSP - Writing Filters
- JSP - Cookies Handling
- JSP - Session Tracking
- JSP - File Uploading
- JSP - Handling Date
- JSP - Page Redirect
- JSP - Hits Counter
- JSP - Auto Refresh
- JSP - Sending Email
- Advanced JSP Tutorials
- JSP - Standard Tag Library
- JSP - Database Access
- JSP - XML Data
- JSP - Java Beans
- JSP - Custom Tags
- JSP - Expression Language
- JSP - Exception Handling
- JSP - Debugging
- JSP - Security
- JSP - Internationalization
- JSP Useful Resources
- JSP - Questions and Answers
- JSP - Quick Guide
- JSP - Useful Resources
- JSP - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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.
JSP Mock Test I
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
Answer : C
Explaination
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
Answer : C
Explaination
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)
Answer : B
Explaination
Correct Signature is
void _jspService(HTTPRequest request, HTTPResponse response) throws ServletException, IOException
Answer : A
Explaination
JSP container creates _jspService() methods so it should not be overridden.
Answer : A
Explaination
JSP container creates _jspService() methods so it should not be overridden.
Answer : A
Explaination
Yes, jspInit() method can be overridden.
Answer : A
Explaination
Yes, jspDestroy() method can be overridden.
Q 8 - Which of the following is not a implicit object?
Answer : C
Explaination
There is no cookie object in jsp.
Q 9 - request is instance of which class?
Answer : C
Explaination
request is object of HttpServletRequest.
Q 10 - response is instance of which class?
Answer : C
Explaination
request is object of HttpServletResponse.
Q 11 - if isThreadSafe attribute of page directive is set as true, then generated servlet implements SingleThreadModel interface.
Answer : B
Explaination
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.
Answer : D
Explaination
pageContext can be used to retrieve other implicit objects using its methods like getPage(), getRequest() etc.
Answer : A
Explaination
The isThreadSafe option marks a page as being thread-safe. By default, it is true and all JSPs are considered thread-safe.
Answer : A
Explaination
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?
Answer : B
Explaination
request is object of HttpSession.
Q 16 - If a jsp is to generate a pdf page, what attribute of page directive it should use?
Answer : A
Explaination
<%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?
Answer : D
Explaination
<%page contentType="text/xml">
Answer : C
Explaination
export is not a page directive.
Q 19 - Which of the following is not a valid attribute of a page directives?
Answer : C
Explaination
export is not a valid attribute of a page directive.
Answer : B
Explaination
jsp is a server side technology.
Answer : B
Explaination
No, Jsp pages are not required to be mapped/configured in web.xml
Answer : A
Explaination
Yes, all servlets are required to be mapped/configured in web.xml
Q 23 - Which of the following do not supports JSP directly?
Answer : D
Explaination
Apache HTTP Server do not supports JSP directly.
Q 24 - What JSP stands for?
Answer : D
Explaination
JSP stands for Java Server Pages.
Q 25 - Which is the methods of generated Servlet?
Answer : D
Explaination
All of the above methods get generated in generated servlet.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | C |
2 | C |
3 | B |
4 | A |
5 | A |
6 | A |
7 | A |
8 | C |
9 | C |
10 | C |
11 | B |
12 | D |
13 | A |
14 | A |
15 | B |
16 | A |
17 | D |
18 | C |
19 | C |
20 | B |
21 | B |
22 | A |
23 | D |
24 | D |
25 | D |