- 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
- 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
JSP Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to JSP Fundamentals. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.
Q 1 - 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
Q 2 - 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.
Q 3 - Which of the following are the valid scopes in JSP?
A - request, page, session, application
B - request, page, session, global
Answer : A
Explaination
The scope attribute identifies the lifecycle of the Action element. It has four possible values: (a) page, (b) request, (c) session, and (d) application.
Q 4 - Which of the following attribute is used to have uncaught run-time exceptions automatically forwarded to an error processing page?
Answer : B
Explaination
<%@ page errorPage="error.jsp" %>
It will redirect the browser to the JSP page error.jsp if an uncaught exception is encountered during request processing.
Q 5 - Which of the following method can be used to read a multiple values with same name, for example check box selections?
Answer : C
Explaination
You call request.getParameterValues() method to get the value of a form parameter if the parameter appears more than once and returns multiple values.
Q 6 - 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.
Answer : A
Explaination
The default value (true) of isScriptingEnabled attribute enables scriptlets, expressions, and declarations.
Q 8 - 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 9 - Which of the following is true about locale?
Answer : C
Explaination
Locale is a particular cultural or geographical region. It is usually referred to as a language symbol followed by a country symbol which are separated by an underscore. For example "en_US" represents english locale for US.
Q 10 - Which of the following is true about <c:forEach > tag?
B - The <c:forEach > is used to iterate over a list of items in jsp.
Answer : C
Explaination
The <c:forEach > tag exists as a good alternative to embedding a Java for, while, or do-while loop via a scriptlet.