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.

Questions and Answers

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?

A - language

B - extend

C - export

D - import

Answer : C

Explaination

export is not a valid attribute of a page directive.

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?

A - error

B - errorPage

C - exception

D - exceptionPage

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?

A - request.getParameter()

B - response.getParameter()

C - request.getParameterValues()

D - response.getParameterValues()

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.

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 7 - What is the default value of isScriptingEnabled attribute?

A - true

B - false

Answer : A

Explaination

The default value (true) of isScriptingEnabled attribute enables scriptlets, expressions, and declarations.

Answer : A

Explaination

Compilation, Initialization, Execution, Cleanup is the correct order.

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.

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.

jsp_questions_answers.htm
Advertisements