JSP Online Quiz


Advertisements


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

Q 1 - response is instance of which class?

A - Response

B - HttpResponse

C - HttpServletResponse

D - ServletResponse

Answer : C

Explaination

request is object of HttpServletResponse.

Q 2 - 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

Answer : D

Explaination

<%page contentType="text/xml">

Q 3 - Which of the following attributes are mandatory in <jsp:getProperty /> tag?

A - name, property

B - type, id

C - name, type

D - id, property

Answer : A

Explaination

The getProperty action is used to retrieve the value of a given property and converts it to a string, and finally inserts it into the output.

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.

Answer : C

Explaination

JSP Filters are Java classes that can be used in JSP Programming for both of the above purposes.

Answer : A

Explaination

When buffer is set to "none", servlet output is immediately directed to the response output 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.

Answer : C

Explaination

The getProperty action is used to retrieve the value of a given property and converts it to a string, and finally inserts it into the output.

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 : A

Explaination

The <c:catch> tag catches any Throwable that occurs in its body and optionally exposes it. Simply it is used for error handling and to deal more gracefully with the problem.


jsp_questions_answers.htm

Advertisements