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

Q 1 - request is instance of which class?

A - Request

B - HttpRequest

C - HttpServletRequest

D - ServletRequest

Answer : C

Explaination

request is object of HttpServletRequest.

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 - All servlet classes are required to be mapped and configured in web.xml.

A - True

B - False

Answer : A

Explaination

Yes, all servlets are required to be mapped/configured in web.xml

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

Explaination

The config object is an instantiation of javax.servlet.ServletConfig and is a direct wrapper around the ServletConfig object for the generated servlet.

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

The info attribute lets you provide a description of the JSP.

Q 8 - Is it possible to include files using absolute path in a JSP page using include directive?

A - true

B - false

Answer : A

Explaination

No! include directive takes relative URL with respect to current domain of web application.

Q 9 - Is JSP technology extensible?

A - true

B - false

Answer : A

Explaination

Yes. JSP technology is extensible through the development of custom actions, or tags, which are encapsulated in tag libraries.

Answer : B

Explaination

The <c:set > tag is JSTL-friendly version of the setProperty action. The tag is helpful because it evaluates an expression and uses the results to set a value of a JavaBean or a java.util.Map object.

jsp_questions_answers.htm
Advertisements