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 - jspDestroy() method of HttpJspPage class can be overridden.

A - True

B - False

Answer : A

Explaination

Yes, jspDestroy() method can be overridden.

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.

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

A - id, type

B - id, class

C - type, class

D - type,property

Answer : B

Explaination

The useBean action first searches for an existing object utilizing the id and scope variables. If an object is not found, it then tries to create the specified object using class.

Q 4 - isErrorPage is by default true.

A - True

B - False

Answer : B

Explaination

isErrorPage is required to be set true, it is false by default.

Answer : A

Explaination

Filters are defined in the deployment descriptor file web.xml and then mapped to either servlet or JSP names or URL patterns in your application's deployment descriptor.

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

Explaination

The destruction phase of the JSP life cycle represents when a JSP is being removed from use by a container.The jspDestroy() method is the JSP equivalent of the destroy method for servlets.

Q 9 - Can you make use of a ServletOutputStream object from within a JSP page?

A - true

B - false

Answer : B

Explaination

No. You are supposed to make use of only a JSPWriter object (given to you in the form of the implicit object out) for replying to clients.

Answer : D

Explaination

The <c:choose> works like a Java switch statement in that it lets you choose between a number of alternatives. Where the switch statement has case statements, the <c:choose> tag has <c:when> tags. A a switch statement has default clause to specify a default action and similar way <c:choose> has <otherwise> as default clause.

jsp_questions_answers.htm
Advertisements