
- 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 III
Q 1 - What are cookies?
Answer : A
Explaination
Cookies are text files stored on the client computer and they are kept for various information tracking purpose.
Q 2 - Which of the following is true about isELIgnored Attribute?
A - The isELIgnored option gives you the ability to disable the evaluation of scriplets.
B - The isELIgnored option gives you the ability to disable the evaluation of java code in jsp.
Answer : C
Explaination
The isELIgnored option gives you the ability to disable the evaluation of Expression Language (EL) expressions. The default value of the attribute is true, meaning that expressions, ${...}, are evaluated as dictated by the JSP specification. If the attribute is set to false, then expressions are not evaluated but rather treated as static text.
Answer : A
Explaination
The default value of the attribute is true, meaning that expressions, ${...}, are evaluated as dictated by the JSP specification. If the attribute is set to false, then expressions are not evaluated but rather treated as static text.
Q 4 - Which of the following is true about buffer Attribute?
A - The buffer attribute specifies the size of buffer.
B - The buffer attribute specifies buffering characteristics for the server output response object.
Answer : C
Explaination
The buffer attribute specifies buffering characteristics for the server output response object.
Q 5 - What happens when buffer is set to a value "none"?
A - Servlet output is immediately directed to the response output object.
Answer : A
Explaination
When buffer is set to "none", servlet output is immediately directed to the response output object.
Q 6 - Which of the following is true about autoFlush Attribute?
Answer : C
Explaination
The autoFlush attribute specifies whether buffered output should be flushed automatically when the buffer is filled, or whether an exception should be raised to indicate buffer overflow.
Answer : A
Explaination
A value of true (default) indicates automatic buffer flushing and a value of false throws an exception.
Q 8 - What happens when autoFlush is set to a value "false"?
A - JSP container throws exceptionto indicate buffer overflow when buffer is filled.
B - JSP container flushed the buffered output when buffer is filled.
Answer : A
Explaination
A value of true (default) indicates automatic buffer flushing and a value of false throws an exception.
Q 9 - Which of the following is true about extends Attribute?
A - The extends attribute can be used to define a subclass of generated servlet.
B - The extends attribute is used to specify a superclass that the generated servlet must extend.
Answer : B
Explaination
The extends attribute specifies a superclass that the generated servlet must extend.
Q 10 - Which of the following is true about import Attribute?
A - The import attribute serves the same function as, and behaves like, the Java import statement.
B - The value for the import option is the name of the package you want to import.
Answer : C
Explaination
The import attribute serves the same function as, and behaves like, the Java import statement. The value for the import option is the name of the package you want to import.
Q 11 - Which of the following is true about info Attribute?
A - The info attribute lets you provide a description of the JSP.
B - The info attribute is used by JSP container for optimization of generated servlet code.
Answer : A
Explaination
The info attribute lets you provide a description of the JSP.
Q 12 - Which of the following is true about isThreadSafe Attribute?
A - The isThreadSafe option marks a page as being thread-safe.
Answer : D
Explaination
The isThreadSafe option marks a page as being thread-safe. By default, all JSPs are considered thread-safe. 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 13 - Which of the following is true about session Attribute?
A - The session attribute indicates whether or not the JSP page uses HTTP sessions.
B - A value of true means that the JSP page has access to a builtin session object.
C - A value of false means that the JSP page cannot access the builtin session object.
Answer : D
Explaination
The session attribute indicates whether or not the JSP page uses HTTP sessions. A value of true means that the JSP page has access to a builtin session object and a value of false means that the JSP page cannot access the builtin session object.
Q 14 - Which of the following is true about isELIgnored Attribute?
Answer : C
Explaination
The isELIgnored option gives you the ability to disable the evaluation of Expression Language (EL) expressions. The default value of the attribute is true, meaning that expressions, ${...}, are evaluated as dictated by the JSP specification. If the attribute is set to false, then expressions are not evaluated but rather treated as static text.
Answer : A
Explaination
The default value of isELIgnored attribute is true, meaning that expressions, ${...}, are evaluated as dictated by the JSP specification.
Q 16 - What will happen if isELIgnored attribute is set as false?
A - Expression Language (EL) expressions will not be evaluated and will be treated as static text.
B - JSP container will ignore the EL expressions similar to comments.
Answer : A
Explaination
If the attribute is set to false, then expressions are not evaluated but rather treated as static text.
Q 17 - Which of the following is true about isScriptingEnabled Attribute?
A - The isScriptingEnabled attribute determines if scripting elements are allowed for use.
B - The default value (true) enables scriptlets, expressions, and declarations.
Answer : C
Explaination
The isScriptingEnabled attribute determines if scripting elements are allowed for use. The default value (true) enables scriptlets, expressions, and declarations. If the attribute's value is set to false, a translation-time error will be raised if the JSP uses any scriptlets, expressions (non-EL), or declarations.
Answer : A
Explaination
The default value (true) of isScriptingEnabled attribute enables scriptlets, expressions, and declarations.
Q 19 - What will happen if isScriptingEnabled attribute is set as false?
Answer : A
Explaination
A translation-time error will be raised if the JSP uses any scriptlets, expressions (non-EL), or declarations.
Q 20 - Which of the following is true about include directive?
A - The include directive is used to include a file during the translation phase.
Answer : C
Explaination
The include directive is used to includes a file during the translation phase. This directive tells the container to merge the content of other external files with the current JSP during the translation phase.
Q 21 - Is it possible to include files using absolute path in a JSP page using include directive?
Answer : A
Explaination
No! include directive takes relative URL with respect to current domain of web application.
Q 22 - Which of the following depicts correct order of phases in JSP life cycle?
A - Compilation, Initialization, Execution, Cleanup
B - Initialization, Compilation, Cleanup, Execution
Answer : A
Explaination
Compilation, Initialization, Execution, Cleanup is the correct order.
Q 23 - Which of the following step is taken by JSP container during Compilation phase?
Answer : C
Explaination
The compilation process involves three steps: a) Parsing the JSP, b) Turning the JSP into a servlet, c) Compiling the servlet.
Q 24 - Which of the following is true about Initialization phase in JSP life cycle?
A - When a container loads a JSP it invokes the jspInit() method before servicing any requests.
B - Container invokes _jspService() method during Initialization phase.
Answer : A
Explaination
When a container loads a JSP it invokes the jspInit() method before servicing any requests.
Q 25 - Which of the following is true about Execution phase in JSP life cycle?
Answer : D
Explaination
Whenever a browser requests a JSP and the page has been loaded and initialized, the JSP engine invokes the _jspService() method in the JSP.The _jspService() method of a JSP is invoked once per a request and is responsible for generating the response for that request and this method is also responsible for generating responses to all seven of the HTTP methods ie. GET, POST, DELETE etc.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | A |
2 | C |
3 | A |
4 | C |
5 | A |
6 | C |
7 | A |
8 | A |
9 | B |
10 | C |
11 | A |
12 | D |
13 | D |
14 | C |
15 | A |
16 | A |
17 | C |
18 | A |
19 | A |
20 | C |
21 | A |
22 | A |
23 | C |
24 | A |
25 | D |